Class AfterCommitTask

java.lang.Object
ch.tocco.nice2.persist.core.api.util.AfterCommitTask
All Implemented Interfaces:
PersistTask<Object,Void>

public abstract class AfterCommitTask extends Object implements PersistTask<Object,Void>
  • Constructor Details Link icon

    • AfterCommitTask Link icon

      public AfterCommitTask()
  • Method Details Link icon

    • run Link icon

      public final Void run(Optional<Object> a, CommandContext commandContext) throws Exception
      Specified by:
      run in interface PersistTask<Object,Void>
      Throws:
      Exception
    • getValue Link icon

      protected final <V> V getValue(Mode.Key<V> key)
    • getValueOrNull Link icon

      @Nullable protected final <V> V getValueOrNull(Mode.Key<V> key)
    • onAfterCommit Link icon

      public abstract void onAfterCommit(CommandContext commandContext) throws Exception
      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 Link icon

      public final Context 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 Link icon

      protected final Iterable<Entity> getCreatedEntities()
      get all entities that were created during the transaction
      Returns:
      -
    • getCreatedEntityIds Link icon

      protected final Iterable<EntityId> getCreatedEntityIds()
    • getUpdatedEntities Link icon

      protected final Iterable<Entity> getUpdatedEntities()
      get all entities that were update during the transaction
      Returns:
      -
    • getUpdatedEntityIds Link icon

      protected final Iterable<EntityId> getUpdatedEntityIds()
    • getDeletedEntities Link icon

      protected final Iterable<EntityId> getDeletedEntities()
      get all entities that were deleted during the transaction
      Returns:
      -
    • setCollectedEntities Link icon

      protected void setCollectedEntities(Set<EntityId> createdEntities, Set<EntityId> updatedEntities, Set<EntityId> deletedEntities)