Class FlexAggregateRepository.DefaultFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>
- java.lang.Object
-
- dk.cloudcreate.essentials.components.eventsourced.aggregates.flex.FlexAggregateRepository.DefaultFlexAggregateRepository<ID,AGGREGATE_TYPE>
-
- All Implemented Interfaces:
FlexAggregateRepository<ID,AGGREGATE_TYPE>
- Enclosing interface:
- FlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>
public static class FlexAggregateRepository.DefaultFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>> extends Object implements FlexAggregateRepository<ID,AGGREGATE_TYPE>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.flex.FlexAggregateRepository
FlexAggregateRepository.DefaultFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<ID>aggregateIdType()The type of aggregate ID this repository usesClass<AGGREGATE_TYPE>aggregateRootImplementationType()The type ofFlexAggregateimplementation this repository handlesdk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateTypeaggregateType()The type ofAggregateTypethis repository is using to persist Eventsprotected dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.EventStoreeventStore()TheEventStorethat's being used for supportvoidpersist(EventsToPersist<ID,Object> eventsToPersist)Associate a newly created and not yet persistedFlexAggregateinstance with theUnitOfWorkFactory.getRequiredUnitOfWork()
Any changes to will be tracked and will be persisted to the underlyingEventStorewhen theUnitOfWorkis committed.StringtoString()Optional<AGGREGATE_TYPE>tryLoad(ID aggregateId, Optional<Long> expectedLatestEventOrder)Try to load anFlexAggregateinstance with the specifiedaggregateIdfrom the underlyingEventStore
If the aggregate instance exists it will be associated with theUnitOfWorkFactory.getRequiredUnitOfWork()and any changes to will be tracked and will be persisted to the underlyingEventStorewhen theUnitOfWorkis committed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.flex.FlexAggregateRepository
load, load, tryLoad, tryLoad
-
-
-
-
Method Detail
-
eventStore
protected dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.EventStore eventStore()
TheEventStorethat's being used for support
-
aggregateType
public dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType()
Description copied from interface:FlexAggregateRepositoryThe type ofAggregateTypethis repository is using to persist Events- Specified by:
aggregateTypein interfaceFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>
-
tryLoad
public Optional<AGGREGATE_TYPE> tryLoad(ID aggregateId, Optional<Long> expectedLatestEventOrder)
Description copied from interface:FlexAggregateRepositoryTry to load anFlexAggregateinstance with the specifiedaggregateIdfrom the underlyingEventStore
If the aggregate instance exists it will be associated with theUnitOfWorkFactory.getRequiredUnitOfWork()and any changes to will be tracked and will be persisted to the underlyingEventStorewhen theUnitOfWorkis committed.- Specified by:
tryLoadin interfaceFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>- Parameters:
aggregateId- the id of the aggregate we want to loadexpectedLatestEventOrder- Optional with the expectedPersistedEvent.eventOrder()of the last event stored in relation to the given aggregate instance (if any)- Returns:
- an
Optionalwith the matchingFlexAggregateinstance if it exists, otherwise it will return anOptional.empty()
-
aggregateRootImplementationType
public Class<AGGREGATE_TYPE> aggregateRootImplementationType()
Description copied from interface:FlexAggregateRepositoryThe type ofFlexAggregateimplementation this repository handles- Specified by:
aggregateRootImplementationTypein interfaceFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>
-
persist
public void persist(EventsToPersist<ID,Object> eventsToPersist)
Description copied from interface:FlexAggregateRepositoryAssociate a newly created and not yet persistedFlexAggregateinstance with theUnitOfWorkFactory.getRequiredUnitOfWork()
Any changes to will be tracked and will be persisted to the underlyingEventStorewhen theUnitOfWorkis committed.- Specified by:
persistin interfaceFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>- Parameters:
eventsToPersist- the events to persist to the underlyingEventStore(a result of a Command method invocation on anFlexAggregateinstance
-
aggregateIdType
public Class<ID> aggregateIdType()
Description copied from interface:FlexAggregateRepositoryThe type of aggregate ID this repository uses- Specified by:
aggregateIdTypein interfaceFlexAggregateRepository<ID,AGGREGATE_TYPE extends FlexAggregate<ID,AGGREGATE_TYPE>>
-
-