org.broadleafcommerce.core.workflow.state
Class ActivityStateManagerImpl

java.lang.Object
  extended by org.broadleafcommerce.core.workflow.state.ActivityStateManagerImpl
All Implemented Interfaces:
ActivityStateManager

@Service(value="blActivityStateManager")
public class ActivityStateManagerImpl
extends Object
implements ActivityStateManager

Author:
Jeff Fischer

Field Summary
protected  Map<String,List<org.broadleafcommerce.core.workflow.state.ActivityStateManagerImpl.StateContainer>> stateMap
           
 
Constructor Summary
ActivityStateManagerImpl()
           
 
Method Summary
 void clearAllState()
          Remove all previously registered RollbackHandlers for the current workflow
 void clearRegionState(String region)
          Remove all previously registered Rollbackhandlers for the current workflow labelled with the specified region
protected  RollbackStateLocal getRollbackStateLocal()
           
static ActivityStateManager getStateManager()
           
 void init()
           
 void registerState(Activity<? extends ProcessContext> activity, ProcessContext processContext, RollbackHandler rollbackHandler, Map<String,Object> stateItems)
          Register a RollbackHandler instance and some arbitrary state items with the StateManager.
 void registerState(Activity<? extends ProcessContext> activity, ProcessContext processContext, String region, RollbackHandler rollbackHandler, Map<String,Object> stateItems)
          Register a RollbackHandler instance and some arbitrary state items with the StateManager.
 void registerState(RollbackHandler rollbackHandler, Map<String,Object> stateItems)
          Register a RollbackHandler instance and some arbitrary state items with the StateManager.
 void rollbackAllState()
          Cause the StateManager to call all registered RollbackHandlers
 void rollbackRegionState(String region)
          Cause the StateManager to call all registered RollbackHandlers in the specified region.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stateMap

protected Map<String,List<org.broadleafcommerce.core.workflow.state.ActivityStateManagerImpl.StateContainer>> stateMap
Constructor Detail

ActivityStateManagerImpl

public ActivityStateManagerImpl()
Method Detail

getStateManager

public static ActivityStateManager getStateManager()

init

@PostConstruct
public void init()

clearAllState

public void clearAllState()
Description copied from interface: ActivityStateManager
Remove all previously registered RollbackHandlers for the current workflow

Specified by:
clearAllState in interface ActivityStateManager

clearRegionState

public void clearRegionState(String region)
Description copied from interface: ActivityStateManager
Remove all previously registered Rollbackhandlers for the current workflow labelled with the specified region

Specified by:
clearRegionState in interface ActivityStateManager
Parameters:
region - The region to which the scope of removal is limited

registerState

public void registerState(RollbackHandler rollbackHandler,
                          Map<String,Object> stateItems)
Description copied from interface: ActivityStateManager
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.

Specified by:
registerState in interface ActivityStateManager
Parameters:
rollbackHandler - A RollbackHandler instance that should be executed by the StateManager
stateItems - Configuration items for the RollbackHandler (can be null)

registerState

public void registerState(Activity<? extends ProcessContext> activity,
                          ProcessContext processContext,
                          RollbackHandler rollbackHandler,
                          Map<String,Object> stateItems)
Description copied from interface: ActivityStateManager
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.

Specified by:
registerState in interface ActivityStateManager
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

public void registerState(Activity<? extends ProcessContext> activity,
                          ProcessContext processContext,
                          String region,
                          RollbackHandler rollbackHandler,
                          Map<String,Object> stateItems)
Description copied from interface: ActivityStateManager
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.

Specified by:
registerState in interface ActivityStateManager
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

public void rollbackAllState()
                      throws RollbackFailureException
Description copied from interface: ActivityStateManager
Cause the StateManager to call all registered RollbackHandlers

Specified by:
rollbackAllState in interface ActivityStateManager
Throws:
RollbackFailureException - if the rollback fails for some reason

rollbackRegionState

public void rollbackRegionState(String region)
                         throws RollbackFailureException
Description copied from interface: ActivityStateManager
Cause the StateManager to call all registered RollbackHandlers in the specified region.

Specified by:
rollbackRegionState in interface ActivityStateManager
Throws:
RollbackFailureException - if the rollback fails for some reason

getRollbackStateLocal

protected RollbackStateLocal getRollbackStateLocal()


Copyright © 2013. All Rights Reserved.