org.broadleafcommerce.core.workflow
Class BaseActivity<T extends ProcessContext>

java.lang.Object
  extended by org.broadleafcommerce.core.workflow.BaseActivity<T>
All Implemented Interfaces:
Activity<T>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.core.Ordered
Direct Known Subclasses:
AddFulfillmentGroupItemActivity, AddOrderItemActivity, AutoBundleActivity, BaseExtensionActivity, CommitTaxActivity, CompleteOrderActivity, CompositeActivity, CompositeActivity, CompositeActivity, ConsolidateFulfillmentFeesActivity, FulfillmentGroupMerchandiseTotalActivity, FulfillmentGroupPricingActivity, FulfillmentItemPricingActivity, OfferActivity, PaymentActivity, PaymentServiceActivity, PriceOrderIfNecessaryActivity, PricingServiceActivity, RecordOfferUsageActivity, RemoveFulfillmentGroupItemActivity, RemoveOrderItemActivity, RemoveOrderMultishipOptionActivity, ShippingActivity, ShippingOfferActivity, TaxActivity, ThirdPartyInteractionLatencySimulationActivity, TotalActivity, UpdateFulfillmentGroupItemActivity, UpdateOrderItemActivity, UpdateOrderMultishipOptionActivity, ValidateAddRequestActivity, ValidateRemoveRequestActivity, ValidateUpdateRequestActivity, VerifyCustomerMaxOfferUsesActivity, VerifyFulfillmentGroupItemsActivity

public abstract class BaseActivity<T extends ProcessContext>
extends Object
implements Activity<T>


Field Summary
protected  boolean automaticallyRegisterRollbackHandler
           
protected  String beanName
           
protected  ErrorHandler errorHandler
           
protected  int order
           
protected  RollbackHandler rollbackHandler
           
protected  String rollbackRegion
           
protected  Map<String,Object> stateConfiguration
           
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
BaseActivity()
           
 
Method Summary
 boolean getAutomaticallyRegisterRollbackHandler()
          Whether or not this activity should automatically register a configured RollbackHandler with the ActivityStateManager.
 String getBeanName()
           
 ErrorHandler getErrorHandler()
          Get the fine-grained error handler wired up for this Activity
 int getOrder()
           
 RollbackHandler getRollbackHandler()
          Retrieve the RollbackHandler instance that should be called by the ActivityStateManager in the event of a workflow execution problem.
 String getRollbackRegion()
          Retrieve the optional region label for the RollbackHandler.
 Map<String,Object> getStateConfiguration()
          Retrieve any user-defined state that should accompany the RollbackHandler.
 void setAutomaticallyRegisterRollbackHandler(boolean automaticallyRegisterRollbackHandler)
          Whether or not this activity should automatically register a configured RollbackHandler with the ActivityStateManager.
 void setBeanName(String beanName)
           
 void setErrorHandler(ErrorHandler errorHandler)
           
 void setOrder(int order)
           
 void setRollbackHandler(RollbackHandler rollbackHandler)
          Set the RollbackHandler instance that should be called by the ActivityStateManager in the event of a workflow execution problem.
 void setRollbackRegion(String rollbackRegion)
          Set the optional region label for the RollbackHandler.
 void setStateConfiguration(Map<String,Object> stateConfiguration)
          Set any user-defined state that should accompany the RollbackHandler.
 boolean shouldExecute(T context)
          Determines if an activity should execute based on the current values in the ProcessContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.broadleafcommerce.core.workflow.Activity
execute
 

Field Detail

errorHandler

protected ErrorHandler errorHandler

beanName

protected String beanName

rollbackHandler

protected RollbackHandler rollbackHandler

rollbackRegion

protected String rollbackRegion

stateConfiguration

protected Map<String,Object> stateConfiguration

automaticallyRegisterRollbackHandler

protected boolean automaticallyRegisterRollbackHandler

order

protected int order
Constructor Detail

BaseActivity

public BaseActivity()
Method Detail

shouldExecute

public boolean shouldExecute(T context)
Description copied from interface: Activity
Determines if an activity should execute based on the current values in the ProcessContext. For example, a context might have both an Order as well as a String 'status' of what the order should be changed to. It is possible that an activity in a workflow could only deal with a particular status change, and thus could return false from this method.

Specified by:
shouldExecute in interface Activity<T extends ProcessContext>
Returns:

getErrorHandler

public ErrorHandler getErrorHandler()
Description copied from interface: Activity
Get the fine-grained error handler wired up for this Activity

Specified by:
getErrorHandler in interface Activity<T extends ProcessContext>
Returns:

setBeanName

public void setBeanName(String beanName)
Specified by:
setBeanName in interface org.springframework.beans.factory.BeanNameAware

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Specified by:
setErrorHandler in interface Activity<T extends ProcessContext>

getBeanName

public String getBeanName()
Specified by:
getBeanName in interface Activity<T extends ProcessContext>

getRollbackHandler

public RollbackHandler getRollbackHandler()
Description copied from interface: Activity
Retrieve the RollbackHandler instance that should be called by the ActivityStateManager in the event of a workflow execution problem. This RollbackHandler will presumably perform some compensating operation to revert state for the activity.

Specified by:
getRollbackHandler in interface Activity<T extends ProcessContext>
Returns:
the handler responsible for reverting state for the activity

setRollbackHandler

public void setRollbackHandler(RollbackHandler rollbackHandler)
Description copied from interface: Activity
Set the RollbackHandler instance that should be called by the ActivityStateManager in the event of a workflow execution problem. This RollbackHandler will presumably perform some compensating operation to revert state for the activity.

Specified by:
setRollbackHandler in interface Activity<T extends ProcessContext>
Parameters:
rollbackHandler - the handler responsible for reverting state for the activity

getRollbackRegion

public String getRollbackRegion()
Description copied from interface: Activity
Retrieve the optional region label for the RollbackHandler. Setting a region allows partitioning of groups of RollbackHandlers for more fine grained control of rollback behavior. Explicit calls to the ActivityStateManager API in an ErrorHandler instance allows explicit rollback of specific rollback handler regions. Note, to disable automatic rollback behavior and enable explicit rollbacks via the API, the workflow.auto.rollback.on.error property should be set to false in your implementation's runtime property configuration.

Specified by:
getRollbackRegion in interface Activity<T extends ProcessContext>
Returns:
the rollback region label for the RollbackHandler instance

setRollbackRegion

public void setRollbackRegion(String rollbackRegion)
Description copied from interface: Activity
Set the optional region label for the RollbackHandler. Setting a region allows partitioning of groups of RollbackHandlers for more fine grained control of rollback behavior. Explicit calls to the ActivityStateManager API in an ErrorHandler instance allows explicit rollback of specific rollback handler regions. Note, to disable automatic rollback behavior and enable explicit rollbacks via the API, the workflow.auto.rollback.on.error property should be set to false in your implementation's runtime property configuration.

Specified by:
setRollbackRegion in interface Activity<T extends ProcessContext>
Parameters:
rollbackRegion - the rollback region label for the RollbackHandler instance

getStateConfiguration

public Map<String,Object> getStateConfiguration()
Description copied from interface: Activity
Retrieve any user-defined state that should accompany the RollbackHandler. This configuration will be passed to the RollbackHandler implementation at runtime.

Specified by:
getStateConfiguration in interface Activity<T extends ProcessContext>
Returns:
any user-defined state configuratio necessary for the execution of the RollbackHandler

setStateConfiguration

public void setStateConfiguration(Map<String,Object> stateConfiguration)
Description copied from interface: Activity
Set any user-defined state that should accompany the RollbackHandler. This configuration will be passed to the RollbackHandler implementation at runtime.

Specified by:
setStateConfiguration in interface Activity<T extends ProcessContext>
Parameters:
stateConfiguration - any user-defined state configuration necessary for the execution of the RollbackHandler

getAutomaticallyRegisterRollbackHandler

public boolean getAutomaticallyRegisterRollbackHandler()
Description copied from interface: Activity
Whether or not this activity should automatically register a configured RollbackHandler with the ActivityStateManager. It is useful to adjust this value if you plan on using the ActivityStateManager API to register RollbackHandlers explicitly in your code. The default value is true.

Specified by:
getAutomaticallyRegisterRollbackHandler in interface Activity<T extends ProcessContext>
Returns:
Whether or not to automatically register a RollbackHandler with the ActivityStateManager

setAutomaticallyRegisterRollbackHandler

public void setAutomaticallyRegisterRollbackHandler(boolean automaticallyRegisterRollbackHandler)
Description copied from interface: Activity
Whether or not this activity should automatically register a configured RollbackHandler with the ActivityStateManager. It is useful to adjust this value if you plan on using the ActivityStateManager API to register RollbackHandlers explicitly in your code. The default value is true.

Specified by:
setAutomaticallyRegisterRollbackHandler in interface Activity<T extends ProcessContext>
Parameters:
automaticallyRegisterRollbackHandler - Whether or not to automatically register a RollbackHandler with the ActivityStateManager

getOrder

public int getOrder()
Specified by:
getOrder in interface org.springframework.core.Ordered

setOrder

public void setOrder(int order)


Copyright © 2013. All Rights Reserved.