org.broadleafcommerce.core.workflow
Class BaseProcessor

java.lang.Object
  extended by org.broadleafcommerce.core.workflow.BaseProcessor
All Implemented Interfaces:
Processor, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
SequenceProcessor

public abstract class BaseProcessor
extends Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.BeanFactoryAware, Processor

Base class for all Workflow Processors. Responsible of keeping track of an ordered collection of Activities

Since:
March 1, 2005
See Also:
Activity

Field Summary
protected  List<Activity<ProcessContext>> activities
           
protected  boolean allowEmptyActivities
          If set to true, this will allow an empty set of activities, thus creating a 'do-nothing' workflow
protected  org.springframework.beans.factory.BeanFactory beanFactory
           
protected  String beanName
           
protected  ErrorHandler defaultErrorHandler
           
protected  List<ModuleActivity> moduleActivities
           
protected  SupportLogger supportLogger
           
 
Constructor Summary
BaseProcessor()
           
 
Method Summary
 void afterPropertiesSet()
          Called after the properties have been set, Ensures the list of activities is not empty and each activity is supported by this Workflow Processor
 List<Activity<ProcessContext>> getActivities()
           
 boolean getAutoRollbackOnError()
          Whether or not the ActivityStateManager should automatically attempt to rollback any RollbackHandlers registered.
protected  String getBeanDesc()
          Returns the bean description if the current bean factory allows it.
 org.springframework.beans.factory.BeanFactory getBeanFactory()
           
 String getBeanName()
           
 ErrorHandler getDefaultErrorHandler()
           
 List<ModuleActivity> getModuleActivities()
          Returns a filtered set of getActivities() that have implemented the ModuleActivity interface.
 boolean isAllowEmptyActivities()
          Defaults to 'false'.
 void setActivities(List<Activity<ProcessContext>> activities)
          Sets the collection of Activities to be executed by the Workflow Process
 void setAllowEmptyActivities(boolean allowEmptyActivities)
           
 void setAutoRollbackOnError(boolean autoRollbackOnError)
          Set whether or not the ActivityStateManager should automatically attempt to rollback any RollbackHandlers registered.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
          Sets the spring bean factroy bean that is responsible for this processor.
 void setBeanName(String beanName)
          Sets name of the spring bean in the application context that this processor is configured under
 void setDefaultErrorHandler(ErrorHandler defaultErrorHandler)
           
 
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.Processor
doActivities, doActivities, setProcessContextFactory, supports
 

Field Detail

beanFactory

protected org.springframework.beans.factory.BeanFactory beanFactory

beanName

protected String beanName

activities

protected List<Activity<ProcessContext>> activities

moduleActivities

protected List<ModuleActivity> moduleActivities

defaultErrorHandler

protected ErrorHandler defaultErrorHandler

allowEmptyActivities

protected boolean allowEmptyActivities
If set to true, this will allow an empty set of activities, thus creating a 'do-nothing' workflow


supportLogger

protected SupportLogger supportLogger
Constructor Detail

BaseProcessor

public BaseProcessor()
Method Detail

setBeanName

public void setBeanName(String beanName)
Sets name of the spring bean in the application context that this processor is configured under

Specified by:
setBeanName in interface org.springframework.beans.factory.BeanNameAware
See Also:
BeanNameAware.setBeanName(java.lang.String)

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:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.BeansException
See Also:
BeanFactoryAware.setBeanFactory(org.springframework.beans.factory.BeanFactory)

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

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Called after the properties have been set, Ensures the list of activities is not empty and each activity is supported by this Workflow Processor

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

getBeanDesc

protected String getBeanDesc()
Returns the bean description if the current bean factory allows it.

Returns:
spring bean description configure via the spring description tag

setActivities

public void setActivities(List<Activity<ProcessContext>> activities)
Sets the collection of Activities to be executed by the Workflow Process

Specified by:
setActivities in interface Processor
Parameters:
activities - ordered collection (List) of activities to be executed by the processor

setDefaultErrorHandler

public void setDefaultErrorHandler(ErrorHandler defaultErrorHandler)
Specified by:
setDefaultErrorHandler in interface Processor

getActivities

public List<Activity<ProcessContext>> getActivities()

getModuleActivities

public List<ModuleActivity> getModuleActivities()
Returns a filtered set of getActivities() that have implemented the ModuleActivity interface. This set of module activities is only set once during afterPropertiesSet(), so if you invoke setActivities(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

public String getBeanName()

getDefaultErrorHandler

public ErrorHandler getDefaultErrorHandler()

getBeanFactory

public org.springframework.beans.factory.BeanFactory getBeanFactory()


Copyright © 2013. All Rights Reserved.