Interface ActivityStateManager<T extends ProcessContext<?>>

All Known Implementing Classes:
ActivityStateManagerImpl

public interface ActivityStateManager<T extends ProcessContext<?>>
Manages activity state for the current thread during workflow execution. Provides facility for registering state and RollbackHandler instances, as well as initiating rollbacks of previously registered state.
Author:
Jeff Fischer
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Remove all previously registered RollbackHandlers for the current workflow
    void
    Remove all previously registered Rollbackhandlers for the current workflow labelled with the specified region
    void
    registerState(Activity<T> activity, T processContext, String region, RollbackHandler<T> rollbackHandler, Map<String,Object> stateItems)
    Register a RollbackHandler instance and some arbitrary state items with the StateManager.
    void
    registerState(Activity<T> activity, T processContext, RollbackHandler<T> rollbackHandler, Map<String,Object> stateItems)
    Register a RollbackHandler instance and some arbitrary state items with the StateManager.
    void
    registerState(RollbackHandler<T> rollbackHandler, Map<String,Object> stateItems)
    Register a RollbackHandler instance and some arbitrary state items with the StateManager.
    void
    Cause the StateManager to call all registered RollbackHandlers
    void
    Cause the StateManager to call all registered RollbackHandlers in the specified region.
  • Method Details

    • registerState

      void registerState(RollbackHandler<T> rollbackHandler, Map<String,Object> stateItems)
      Register a RollbackHandler instance and some arbitrary state items with the StateManager. In the event of a rollbackAllState() call, the StateManager will execute all registered RollbackHandler instances. Note, Broadleaf does not try to wrap the RollbackHandler execution in a database transaction. Therefore, if the RollbackHandler implementation requires a database transaction (i.e. it's updating the database), then the implementer must supply it. The easiest way to achieve this is to register the RollbackHandler as a Spring bean and either use declaration in the app context xml, or use @Transactional annotations in the implementation itself. Then, inject the RollbackHandler into your activity and call registerState when appropriate.
      Parameters:
      rollbackHandler - A RollbackHandler instance that should be executed by the StateManager
      stateItems - Configuration items for the RollbackHandler (can be null)
    • registerState

      void registerState(Activity<T> activity, T processContext, RollbackHandler<T> rollbackHandler, Map<String,Object> stateItems)
      Register a RollbackHandler instance and some arbitrary state items with the StateManager. In the event of a rollbackAllState() call, the StateManager will execute all registered RollbackHandler instances. Note, Broadleaf does not try to wrap the RollbackHandler execution in a database transaction. Therefore, if the RollbackHandler implementation requires a database transaction (i.e. it's updating the database), then the implementer must supply it. The easiest way to achieve this is to register the RollbackHandler as a Spring bean and either use declaration in the app context xml, or use @Transactional annotations in the implementation itself. Then, inject the RollbackHandler into your activity and call registerState when appropriate.
      Parameters:
      activity - the current activity associated with the RollbackHandler (can be null)
      processContext - the current ProcessContext associated with the activity (can be null)
      rollbackHandler - A RollbackHandler instance that should be executed by the StateManager
      stateItems - Configuration items for the RollbackHandler (can be null)
    • registerState

      void registerState(Activity<T> activity, T processContext, String region, RollbackHandler<T> rollbackHandler, Map<String,Object> stateItems)
      Register a RollbackHandler instance and some arbitrary state items with the StateManager. Can be used in conjunction with rollbackRegionState() to limit the scope of a rollback. Note, Broadleaf does not try to wrap the RollbackHandler execution in a database transaction. Therefore, if the RollbackHandler implementation requires a database transaction (i.e. it's updating the database), then the implementer must supply it. The easiest way to achieve this is to register the RollbackHandler as a Spring bean and either use declaration in the app context xml, or use @Transactional annotations in the implementation itself. Then, inject the RollbackHandler into your activity and call registerState when appropriate.
      Parameters:
      activity - the current activity associated with the RollbackHandler (can be null)
      processContext - the current ProcessContext associated with the activity (can be null)
      region - Label this rollback handler with a particular name.
      rollbackHandler - A RollbackHandler instance that should be executed by the StateManager
      stateItems - Configuration items for the RollbackHandler (can be null)
    • rollbackAllState

      void rollbackAllState() throws RollbackFailureException
      Cause the StateManager to call all registered RollbackHandlers
      Throws:
      RollbackFailureException - if the rollback fails for some reason
    • rollbackRegionState

      void rollbackRegionState(String region) throws RollbackFailureException
      Cause the StateManager to call all registered RollbackHandlers in the specified region.
      Throws:
      RollbackFailureException - if the rollback fails for some reason
    • clearAllState

      void clearAllState()
      Remove all previously registered RollbackHandlers for the current workflow
    • clearRegionState

      void clearRegionState(String region)
      Remove all previously registered Rollbackhandlers for the current workflow labelled with the specified region
      Parameters:
      region - The region to which the scope of removal is limited