-
- All Implemented Interfaces:
-
org.enodeframework.commanding.CommandContext,org.enodeframework.commanding.CommandExecuteContext,org.enodeframework.commanding.TrackingContext
public final class DefaultCommandExecuteContext implements CommandExecuteContext
-
-
Field Summary
Fields Modifier and Type Field Description private Stringresultprivate ApplicationMessageapplicationMessageprivate final List<AggregateRoot>trackedAggregateRoots
-
Constructor Summary
Constructors Constructor Description DefaultCommandExecuteContext(Repository repository, AggregateStorage aggregateRootStorage, QueueMessage queueMessage, MessageContext messageContext, GenericCommandMessage genericCommandMessage, SendReplyService sendReplyService)
-
Method Summary
Modifier and Type Method Description StringgetResult()Get result. UnitsetResult(String result)Get result. ApplicationMessagegetApplicationMessage()Set an application message. UnitsetApplicationMessage(ApplicationMessage applicationMessage)Set an application message. List<AggregateRoot>getTrackedAggregateRoots()Get all the tracked aggregates. CompletableFuture<Boolean>onCommandExecutedAsync(CommandResult commandResult)Notify the given command is executed. Unitadd(AggregateRoot aggregateRoot)Add a new aggregate into the current command context. CompletableFuture<Boolean>addAsync(AggregateRoot aggregateRoot)Add a new aggregate into the current command context synchronously, and then return a completed task object. <T extends AggregateRoot> CompletableFuture<T>getAsync(Object id, Boolean firstFromCache, Class<T> aggregateRootType)Get an aggregate from the current command context. <T extends AggregateRoot> CompletableFuture<T>getAsync(Object id, Class<T> aggregateRootType)Get an aggregate async from the current command context, default from cache. <T extends AggregateRoot> Tget(Object id, Boolean firstFromCache, Class<T> aggregateRootType)Get an aggregate sync from the current command context. <T extends AggregateRoot> Tget(Object id, Class<T> aggregateRootType)Get an aggregate sync from the current command context, default from cache. Unitclear()Clear the tracking context. -
-
Constructor Detail
-
DefaultCommandExecuteContext
DefaultCommandExecuteContext(Repository repository, AggregateStorage aggregateRootStorage, QueueMessage queueMessage, MessageContext messageContext, GenericCommandMessage genericCommandMessage, SendReplyService sendReplyService)
-
-
Method Detail
-
getApplicationMessage
ApplicationMessage getApplicationMessage()
Set an application message.
-
setApplicationMessage
Unit setApplicationMessage(ApplicationMessage applicationMessage)
Set an application message.
-
getTrackedAggregateRoots
List<AggregateRoot> getTrackedAggregateRoots()
Get all the tracked aggregates.
-
onCommandExecutedAsync
CompletableFuture<Boolean> onCommandExecutedAsync(CommandResult commandResult)
Notify the given command is executed.
-
add
Unit add(AggregateRoot aggregateRoot)
Add a new aggregate into the current command context.
-
addAsync
CompletableFuture<Boolean> addAsync(AggregateRoot aggregateRoot)
Add a new aggregate into the current command context synchronously, and then return a completed task object.
-
getAsync
<T extends AggregateRoot> CompletableFuture<T> getAsync(Object id, Boolean firstFromCache, Class<T> aggregateRootType)
Get an aggregate from the current command context.
-
getAsync
<T extends AggregateRoot> CompletableFuture<T> getAsync(Object id, Class<T> aggregateRootType)
Get an aggregate async from the current command context, default from cache.
-
get
<T extends AggregateRoot> T get(Object id, Boolean firstFromCache, Class<T> aggregateRootType)
Get an aggregate sync from the current command context.
-
get
<T extends AggregateRoot> T get(Object id, Class<T> aggregateRootType)
Get an aggregate sync from the current command context, default from cache.
-
-
-
-