Class BaseProcessor<U,T>
java.lang.Object
org.broadleafcommerce.core.workflow.BaseProcessor<U,T>
- All Implemented Interfaces:
EventListener,Processor<U,,T> org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
- Direct Known Subclasses:
SequenceProcessor
public abstract class BaseProcessor<U,T>
extends Object
implements org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.BeanFactoryAware, Processor<U,T>, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
Base class for all Workflow Processors. Responsible of keeping track of an ordered collection
of
Activities- Since:
- March 1, 2005
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<Activity<ProcessContext<U>>>protected booleanIf set to true, this will allow an empty set of activities, thus creating a 'do-nothing' workflowprotected org.springframework.beans.factory.BeanFactoryprotected Stringprotected ErrorHandlerprotected List<ModuleActivity>protected SupportLogger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether or not the ActivityStateManager should automatically attempt to rollback any RollbackHandlers registered.protected StringReturns the bean description if the current bean factory allows it.org.springframework.beans.factory.BeanFactoryReturns a filtered set ofgetActivities()that have implemented theModuleActivityinterface.booleanDefaults to 'false'.voidonApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) Ensures the the list of activities is properly merged and sorted after all activities have been initializedvoidsetActivities(List<Activity<ProcessContext<U>>> activities) Sets the collection of Activities to be executed by the Workflow ProcessvoidsetAllowEmptyActivities(boolean allowEmptyActivities) voidsetAutoRollbackOnError(boolean autoRollbackOnError) Set whether or not the ActivityStateManager should automatically attempt to rollback any RollbackHandlers registered.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) Sets the spring bean factroy bean that is responsible for this processor.voidsetBeanName(String beanName) Sets name of the spring bean in the application context that this processor is configured undervoidsetDefaultErrorHandler(ErrorHandler defaultErrorHandler) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.broadleafcommerce.core.workflow.Processor
doActivities, doActivities, setProcessContextFactory, supports
-
Field Details
-
beanFactory
protected org.springframework.beans.factory.BeanFactory beanFactory -
beanName
-
activities
-
moduleActivities
-
defaultErrorHandler
-
allowEmptyActivities
protected boolean allowEmptyActivitiesIf set to true, this will allow an empty set of activities, thus creating a 'do-nothing' workflow -
supportLogger
-
-
Constructor Details
-
BaseProcessor
public BaseProcessor()
-
-
Method Details
-
getAutoRollbackOnError
public boolean getAutoRollbackOnError()Whether or not the ActivityStateManager should automatically attempt to rollback any RollbackHandlers registered. If false, rolling back will require an explicit call to ActivityStateManagerImpl.getStateManager().rollbackAllState(). The default value is true.- Returns:
- Whether or not the ActivityStateManager should automatically attempt to rollback
-
setAutoRollbackOnError
public void setAutoRollbackOnError(boolean autoRollbackOnError) Set whether or not the ActivityStateManager should automatically attempt to rollback any RollbackHandlers registered. If false, rolling back will require an explicit call to ActivityStateManagerImpl.getStateManager().rollbackAllState(). The default value is true.- Parameters:
autoRollbackOnError- Whether or not the ActivityStateManager should automatically attempt to rollback
-
isAllowEmptyActivities
public boolean isAllowEmptyActivities()Defaults to 'false'. This will prevent an exception from being thrown when no activities have been configured for a processor, and thus will create a 'do-nothing' workflow.- Returns:
- the allowEmptyActivities
-
setAllowEmptyActivities
public void setAllowEmptyActivities(boolean allowEmptyActivities) - Parameters:
allowEmptyActivities- the allowEmptyActivities to set
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) Ensures the the list of activities is properly merged and sorted after all activities have been initialized- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<U>
-
getBeanDesc
Returns the bean description if the current bean factory allows it.- Returns:
- spring bean description configure via the spring description tag
-
getActivities
-
setActivities
Sets the collection of Activities to be executed by the Workflow Process- Specified by:
setActivitiesin interfaceProcessor<U,T> - Parameters:
activities- ordered collection (List) of activities to be executed by the processor
-
getModuleActivities
Returns a filtered set ofgetActivities()that have implemented theModuleActivityinterface. This set of module activities is only set once during#afterPropertiesSet(), so if you invokesetActivities(List)after the bean has been initialized you will need to manually reset the list of module activities as well (which could be achieved by manually invoking#afterPropertiesSet()).- Returns:
-
getBeanName
-
setBeanName
Sets name of the spring bean in the application context that this processor is configured under- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware- See Also:
-
BeanNameAware.setBeanName(java.lang.String)
-
getDefaultErrorHandler
-
setDefaultErrorHandler
- Specified by:
setDefaultErrorHandlerin interfaceProcessor<U,T>
-
getBeanFactory
public org.springframework.beans.factory.BeanFactory getBeanFactory() -
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException Sets the spring bean factroy bean that is responsible for this processor.- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Throws:
org.springframework.beans.BeansException- See Also:
-
BeanFactoryAware.setBeanFactory(org.springframework.beans.factory.BeanFactory)
-