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 Details

    • beanFactory

      protected org.springframework.beans.factory.BeanFactory beanFactory
    • beanName

      protected String beanName
    • activities

      protected List<Activity<ProcessContext<U>>> 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 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:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<U>
    • 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
    • getActivities

      public List<Activity<ProcessContext<U>>> getActivities()
    • setActivities

      public void setActivities(List<Activity<ProcessContext<U>>> activities)
      Sets the collection of Activities to be executed by the Workflow Process
      Specified by:
      setActivities in interface Processor<U,T>
      Parameters:
      activities - ordered collection (List) of activities to be executed by the processor
    • 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()
    • 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)
    • getDefaultErrorHandler

      public ErrorHandler getDefaultErrorHandler()
    • setDefaultErrorHandler

      public void setDefaultErrorHandler(ErrorHandler defaultErrorHandler)
      Specified by:
      setDefaultErrorHandler in interface Processor<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:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
      See Also:
      • BeanFactoryAware.setBeanFactory(org.springframework.beans.factory.BeanFactory)