Interface AggregateRepository<T,K>
-
- Type Parameters:
T-@Aggregateclass.K-@AggregateIdentifierclass.
- All Known Implementing Classes:
CrudAggregateRepository
public interface AggregateRepository<T,K>Default contract to the@Aggregaterepository.- Author:
- Thiago A. de Souza Weber
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Longcount(String clause, org.springframework.jdbc.core.SqlParameterValue... arguments)Returns total registers of a table, matching the given clause and arguments or 0 if none found.voiddelete(K identifier)Delete the@Aggregatewith the given identifier.booleanexists(String clause, Object... arguments)Checks if, at least one,@Aggregateexists matching the given clause and arguments.booleanexists(String clause, org.springframework.jdbc.core.SqlParameterValue... arguments)Checks if, at least one,@Aggregateexists matching the given clause and arguments.booleanexists(K identifier)Checks if the@Aggregateexists with the given identifier.com.totvs.tjf.core.aggregate.repository.AggregateCollectionResult<T>findAll(String clause, String orderby, Integer limit, Integer offset, org.springframework.jdbc.core.SqlParameterValue... arguments)Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.Collection<T>findAll(String clause, String orderby, Object... arguments)Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.Collection<T>findAll(String clause, String orderby, org.springframework.jdbc.core.SqlParameterValue... arguments)Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.Collection<T>findAll(String clause, javax.persistence.LockModeType lockModeType, String orderby, org.springframework.jdbc.core.SqlParameterValue... arguments)Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.default com.totvs.tjf.core.aggregate.repository.AggregateCollectionResult<T>findAll(org.springframework.data.domain.Pageable pageable, String clause, String orderby, org.springframework.jdbc.core.SqlParameterValue... arguments)Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.Optional<T>findOne(String clause, Object... arguments)Returns a single@Aggregate, matching the given clause and arguments orOptional.empty()if none found.Optional<T>findOne(String clause, javax.persistence.LockModeType lockModeType, org.springframework.jdbc.core.SqlParameterValue... arguments)Returns a single@Aggregate, matching the given clause and arguments orOptional.empty()if none found.Optional<T>findOne(String clause, org.springframework.jdbc.core.SqlParameterValue... arguments)Returns a single@Aggregate, matching the given clause and arguments orOptional.empty()if none found.Optional<T>get(K identifier)Returns a single@Aggregate, matching the given identifier orOptional.empty()if none found.Optional<AggregateMetadataInfoContent>getMetadata(K identifier)Returns the aggregateAggregateMetadataInfoContent, matching the given identifier orOptional.empty()if none found.Tinsert(T aggregate)Serialize the given@Aggregatestate and store at the database as a document.Tupdate(T aggregate)Serialize the given@Aggregatestate and update document in the database .
-
-
-
Method Detail
-
exists
boolean exists(K identifier)
Checks if the@Aggregateexists with the given identifier.- Parameters:
identifier- can't be null.- Returns:
trueif exists, otherwise false.
-
exists
boolean exists(@Nullable String clause, @Nullable Object... arguments)Checks if, at least one,@Aggregateexists matching the given clause and arguments.- Parameters:
clause- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
trueif found at least one, otherwise false.
-
exists
boolean exists(@Nullable String clause, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)Checks if, at least one,@Aggregateexists matching the given clause and arguments.- Parameters:
clause- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
trueif found at least one, otherwise false.
-
get
Optional<T> get(K identifier)
Returns a single@Aggregate, matching the given identifier orOptional.empty()if none found.- Parameters:
identifier- can't be null.- Returns:
- an
Optionalinstance with the@Aggregateif found, otherwiseOptional.empty().
-
getMetadata
Optional<AggregateMetadataInfoContent> getMetadata(K identifier)
Returns the aggregateAggregateMetadataInfoContent, matching the given identifier orOptional.empty()if none found.- Parameters:
identifier- can't be null.- Returns:
- an
Optionalinstance with the aggregateAggregateMetadataInfoContentif found, otherwiseOptional.empty().
-
findOne
Optional<T> findOne(@Nullable String clause, @Nullable Object... arguments)
Returns a single@Aggregate, matching the given clause and arguments orOptional.empty()if none found.- Parameters:
clause- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- an
Optionalinstance with the@Aggregateif found any, otherwiseOptional.empty().
-
findOne
Optional<T> findOne(@Nullable String clause, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)
Returns a single@Aggregate, matching the given clause and arguments orOptional.empty()if none found.- Parameters:
clause- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- an
Optionalinstance with the@Aggregateif found any, otherwiseOptional.empty().
-
findOne
Optional<T> findOne(@Nullable String clause, javax.persistence.LockModeType lockModeType, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)
Returns a single@Aggregate, matching the given clause and arguments orOptional.empty()if none found.- Parameters:
clause- can be null.lockModeType- pass lock mode type if necessary.arguments- the arguments to be used for lookup, can be null.- Returns:
- an
Optionalinstance with the@Aggregateif found any, otherwiseOptional.empty().
-
findAll
Collection<T> findAll(@Nullable String clause, @Nullable String orderby, @Nullable Object... arguments)
Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.- Parameters:
clause- can be null.orderby- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- a
Collectioninstance with all the@Aggregatefound, otherwiseCollections.emptyList().
-
findAll
Collection<T> findAll(@Nullable String clause, @Nullable String orderby, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)
Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.- Parameters:
clause- can be null.orderby- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- a
Collectioninstance with all the@Aggregatefound, otherwiseCollections.emptyList().
-
findAll
com.totvs.tjf.core.aggregate.repository.AggregateCollectionResult<T> findAll(@Nullable String clause, @Nullable String orderby, @Nullable Integer limit, @Nullable Integer offset, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)
Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.- Parameters:
clause- can be null.orderby- can be null.limit- can be null.offset- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- a
AggregateCollectionResultinstance with all the@Aggregatefound, otherwise itemsCollections.emptyList().
-
findAll
default com.totvs.tjf.core.aggregate.repository.AggregateCollectionResult<T> findAll(@Nullable org.springframework.data.domain.Pageable pageable, @Nullable String clause, @Nullable String orderby, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)
Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.- Parameters:
pageable- can be null.clause- can be null.orderby- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- a
AggregateCollectionResultinstance with all the@Aggregatefound, otherwise itemsCollections.emptyList().
-
findAll
Collection<T> findAll(@Nullable String clause, javax.persistence.LockModeType lockModeType, @Nullable String orderby, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)
Returns all@Aggregates, matching the given clause and arguments orCollections.emptyList()if none found.- Parameters:
clause- can be null.lockModeType- pass lock mode type if necessary.orderby- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- a
Collectioninstance with all the@Aggregatefound, otherwiseCollections.emptyList().
-
insert
T insert(T aggregate)
Serialize the given@Aggregatestate and store at the database as a document.- Parameters:
aggregate- instance to be created- Returns:
- the saved aggregate
-
update
T update(T aggregate)
Serialize the given@Aggregatestate and update document in the database .- Parameters:
aggregate- instance to be store- Returns:
- the modified aggregate
-
delete
void delete(K identifier)
Delete the@Aggregatewith the given identifier.- Parameters:
identifier- of theAggregate
-
count
Long count(@Nullable String clause, @Nullable org.springframework.jdbc.core.SqlParameterValue... arguments)
Returns total registers of a table, matching the given clause and arguments or 0 if none found.- Parameters:
clause- can be null.arguments- the arguments to be used for lookup, can be null.- Returns:
- total registers of a table if found any, otherwise 0.
-
-