Class AfterCommitTask
java.lang.Object
ch.tocco.nice2.persist.core.api.util.AfterCommitTask
- All Implemented Interfaces:
PersistTask<Object,
Void>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal Context
Use 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> V
protected final <V> V
getValueOrNull
(Mode.Key<V> key) abstract void
onAfterCommit
(CommandContext commandContext) Implement this method for logic to be executed asynchronously after the commit.final Void
run
(Optional<Object> a, CommandContext commandContext) protected void
setCollectedEntities
(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, wait
Methods 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:
run
in 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
-