Class ActivityStateManagerImpl<T extends ProcessContext<?>>
java.lang.Object
org.broadleafcommerce.core.workflow.state.ActivityStateManagerImpl<T>
- All Implemented Interfaces:
ActivityStateManager<T>
@Service("blActivityStateManager")
public class ActivityStateManagerImpl<T extends ProcessContext<?>>
extends Object
implements ActivityStateManager<T>
- Author:
- Jeff Fischer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRemove all previously registered RollbackHandlers for the current workflowvoidclearRegionState(String region) Remove all previously registered Rollbackhandlers for the current workflow labelled with the specified regionprotected RollbackStateLocalstatic ActivityStateManagervoidinit()voidregisterState(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.voidregisterState(Activity<T> activity, T processContext, RollbackHandler<T> rollbackHandler, Map<String, Object> stateItems) Register a RollbackHandler instance and some arbitrary state items with the StateManager.voidregisterState(RollbackHandler<T> rollbackHandler, Map<String, Object> stateItems) Register a RollbackHandler instance and some arbitrary state items with the StateManager.voidCause the StateManager to call all registered RollbackHandlersvoidrollbackRegionState(String region) Cause the StateManager to call all registered RollbackHandlers in the specified region.
-
Field Details
-
stateMap
protected Map<String,Stack<ActivityStateManagerImpl<T extends ProcessContext<?>>.org.broadleafcommerce.core.workflow.state.ActivityStateManagerImpl.StateContainer>> stateMap
-
-
Constructor Details
-
ActivityStateManagerImpl
public ActivityStateManagerImpl()
-
-
Method Details
-
getStateManager
-
init
@PostConstruct public void init() -
clearAllState
public void clearAllState()Description copied from interface:ActivityStateManagerRemove all previously registered RollbackHandlers for the current workflow- Specified by:
clearAllStatein interfaceActivityStateManager<T extends ProcessContext<?>>
-
clearRegionState
Description copied from interface:ActivityStateManagerRemove all previously registered Rollbackhandlers for the current workflow labelled with the specified region- Specified by:
clearRegionStatein interfaceActivityStateManager<T extends ProcessContext<?>>- Parameters:
region- The region to which the scope of removal is limited
-
registerState
Description copied from interface:ActivityStateManagerRegister 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 usedeclaration 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. - Specified by:
registerStatein interfaceActivityStateManager<T extends ProcessContext<?>>- Parameters:
rollbackHandler- A RollbackHandler instance that should be executed by the StateManagerstateItems- Configuration items for the RollbackHandler (can be null)
-
registerState
public void registerState(Activity<T> activity, T processContext, RollbackHandler<T> rollbackHandler, Map<String, Object> stateItems) Description copied from interface:ActivityStateManagerRegister 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 usedeclaration 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. - Specified by:
registerStatein interfaceActivityStateManager<T extends ProcessContext<?>>- 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 StateManagerstateItems- Configuration items for the RollbackHandler (can be null)
-
registerState
public void registerState(Activity<T> activity, T processContext, String region, RollbackHandler<T> rollbackHandler, Map<String, Object> stateItems) Description copied from interface:ActivityStateManagerRegister 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 usedeclaration 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. - Specified by:
registerStatein interfaceActivityStateManager<T extends ProcessContext<?>>- 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 StateManagerstateItems- Configuration items for the RollbackHandler (can be null)
-
rollbackAllState
Description copied from interface:ActivityStateManagerCause the StateManager to call all registered RollbackHandlers- Specified by:
rollbackAllStatein interfaceActivityStateManager<T extends ProcessContext<?>>- Throws:
RollbackFailureException- if the rollback fails for some reason
-
rollbackRegionState
Description copied from interface:ActivityStateManagerCause the StateManager to call all registered RollbackHandlers in the specified region.- Specified by:
rollbackRegionStatein interfaceActivityStateManager<T extends ProcessContext<?>>- Throws:
RollbackFailureException- if the rollback fails for some reason
-
getRollbackStateLocal
-