Class AfterCommitTask
java.lang.Object
ch.tocco.nice2.persist.core.api.util.AfterCommitTask
- All Implemented Interfaces:
PersistTask<Object,Void>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ContextUse this method to retrieve the context.get all entities that were created during the transactionget all entities that were deleted during the transactionget all entities that were update during the transactionprotected final <V> Vprotected final <V> VgetValueOrNull(Mode.Key<V> key) abstract voidonAfterCommit(CommandContext commandContext) Implement this method for logic to be executed asynchronously after the commit.final Voidrun(Optional<Object> a, CommandContext commandContext) protected voidsetCollectedEntities(Set<EntityId> createdEntities, Set<EntityId> updatedEntities, Set<EntityId> deletedEntities) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.tocco.nice2.persist.core.api.exec.PersistTask
andThenDo, compose, compose2, composeWhen, discardResult, expand, expand, getDescription, ifElse, orWhen, orWhenNot, passWhen, passWhenNot, skipErrors, unwrap
-
Constructor Details
-
AfterCommitTask
public AfterCommitTask()
-
-
Method Details
-
run
- Specified by:
runin interfacePersistTask<Object,Void> - Throws:
Exception
-
getValue
-
getValueOrNull
-
onAfterCommit
Implement this method for logic to be executed asynchronously after the commit. To retrieve the affected entities consider the below methods.- Parameters:
commandContext- commandContext- Throws:
Exception- See Also:
-
getContext
Use this method to retrieve the context.
Important note: Do not inject your own context, but always use the one returned by this method.- Returns:
- a context to work with
-
getCreatedEntities
get all entities that were created during the transaction- Returns:
- -
-
getCreatedEntityIds
-
getUpdatedEntities
get all entities that were update during the transaction- Returns:
- -
-
getUpdatedEntityIds
-
getDeletedEntities
get all entities that were deleted during the transaction- Returns:
- -
-
setCollectedEntities
-