org.broadleafcommerce.core.workflow
Interface Activity<T extends ProcessContext>

Type Parameters:
T -
All Superinterfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.core.Ordered
All Known Implementing Classes:
AddFulfillmentGroupItemActivity, AddOrderItemActivity, AutoBundleActivity, BaseActivity, 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 interface Activity<T extends ProcessContext>
extends org.springframework.beans.factory.BeanNameAware, org.springframework.core.Ordered

Interface to be used for workflows in Broadleaf. Usually implementations will subclass BaseActivity.

Important note: if you are writing a 3rd-party integration module or adding a module outside of the Broadleaf core, your activity should implement the ModuleActivity interface as well. This ensures that there is proper logging for users that are using your module so that they know exactly what their final workflow configuration looks like.

Author:
Phillip Verheyden (phillipuniverse)
See Also:
BaseActivity}, ModuleActivity}, BaseProcessor}, SequenceProcessor}

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Method Summary
 T execute(T context)
          Called by the encompassing processor to activate the execution of the Activity
 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
 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 setErrorHandler(ErrorHandler errorHandler)
           
 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 interface org.springframework.beans.factory.BeanNameAware
setBeanName
 
Methods inherited from interface org.springframework.core.Ordered
getOrder
 

Method Detail

execute

T execute(T context)
                                 throws Exception
Called by the encompassing processor to activate the execution of the Activity

Parameters:
context - - process context for this workflow
Returns:
resulting process context
Throws:
Exception

shouldExecute

boolean shouldExecute(T context)
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.

Parameters:
context -
Returns:

getErrorHandler

ErrorHandler getErrorHandler()
Get the fine-grained error handler wired up for this Activity

Returns:

setErrorHandler

void setErrorHandler(ErrorHandler errorHandler)

getBeanName

String getBeanName()

getRollbackHandler

RollbackHandler getRollbackHandler()
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.

Returns:
the handler responsible for reverting state for the activity

setRollbackHandler

void setRollbackHandler(RollbackHandler rollbackHandler)
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.

Parameters:
rollbackHandler - the handler responsible for reverting state for the activity

getRollbackRegion

String getRollbackRegion()
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.

Returns:
the rollback region label for the RollbackHandler instance

setRollbackRegion

void setRollbackRegion(String rollbackRegion)
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.

Parameters:
rollbackRegion - the rollback region label for the RollbackHandler instance

getStateConfiguration

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

Returns:
any user-defined state configuratio necessary for the execution of the RollbackHandler

setStateConfiguration

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

Parameters:
stateConfiguration - any user-defined state configuration necessary for the execution of the RollbackHandler

getAutomaticallyRegisterRollbackHandler

boolean getAutomaticallyRegisterRollbackHandler()
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 false.

Returns:
Whether or not to automatically register a RollbackHandler with the ActivityStateManager

setAutomaticallyRegisterRollbackHandler

void setAutomaticallyRegisterRollbackHandler(boolean automaticallyRegisterRollbackHandler)
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 false.

Parameters:
automaticallyRegisterRollbackHandler - Whether or not to automatically register a RollbackHandler with the ActivityStateManager


Copyright © 2013. All Rights Reserved.