Class SimpleWorkflowExecution

java.lang.Object
com.broadleafcommerce.orchestration.client.SimpleWorkflowExecution
All Implemented Interfaces:
SimpleWorkflow

public class SimpleWorkflowExecution extends Object implements SimpleWorkflow
Support deterministic execution, history, and workflow map metadata (i.e. SimpleOrchestrationMap) for SimpleWorkflow.
  • Constructor Details

    • SimpleWorkflowExecution

      public SimpleWorkflowExecution()
  • Method Details

    • initialize

      public void initialize(String name, @Nullable String id, WorkflowConfiguration workflowConfiguration)
    • allowHistoricalReset

      public boolean allowHistoricalReset()
      Description copied from interface: SimpleWorkflow
      Whether requesting a previously executed step (prior to the last step) in SimpleWorkflow.goToStep(String) is allowed. This is different from retry, which is an attempt to re-execute the most recent historical activity.
      Specified by:
      allowHistoricalReset in interface SimpleWorkflow
      Returns:
      Whether requesting a previously executed step (prior to the last step) is allowed
    • allowRetry

      public boolean allowRetry()
      Description copied from interface: SimpleWorkflow
      Whether requesting the most recently executed step in SimpleWorkflow.goToStep(String) is allowed.
      Specified by:
      allowRetry in interface SimpleWorkflow
      Returns:
      Whether requesting the most recent executed step is allowed
    • getName

      public String getName()
      Description copied from interface: SimpleWorkflow
      The unique name for this workflow. Should match the Spring bean name for the workflow bean.
      Specified by:
      getName in interface SimpleWorkflow
      Returns:
      The unique name for this workflow.
    • getDescription

      public String getDescription()
      Description copied from interface: SimpleWorkflow
      A human-readable description for this workflow. Generally also unique like the name to ensure clarity in the admin UI.
      Specified by:
      getDescription in interface SimpleWorkflow
      Returns:
      A human-readable description for this workflow.
    • shutdown

      public void shutdown()
      Description copied from interface: SimpleWorkflow
      Stop a running workflow. Generally called at JVM shutdown in case the workflow is still running. Gives the workflow a chance to clean up and pause before exit.
      Specified by:
      shutdown in interface SimpleWorkflow
    • start

      public void start(Map<String,Object> context)
      Description copied from interface: SimpleWorkflow
      Start execution of the list of SimpleActivity items at the first position.
      Specified by:
      start in interface SimpleWorkflow
      Parameters:
      context - Any information that needs to be supplied to one or more activities
    • getHistory

      public History getHistory()
      Description copied from interface: SimpleWorkflow
      Return the list of start and end times, status, and possible failure information for all SimpleActivity executions that have occurred.
      Specified by:
      getHistory in interface SimpleWorkflow
      Returns:
      The list of start and end times, status, and possible failure information
      See Also:
    • goToStep

      public void goToStep(String name)
      Description copied from interface: SimpleWorkflow
      Signal the workflow to circumvent normal execution ordering and skip forward or backward to the position where the SimpleActivity.getName() matches the supplied name. The signal is honored once the currently running activity (if any) finishes.
      Specified by:
      goToStep in interface SimpleWorkflow
      Parameters:
      name - The name of the activity to match in order to identify the starting point
    • cancel

      public void cancel(boolean fail)
      Description copied from interface: SimpleWorkflow
      Cancel execution once the currently running activity (if any) finishes.
      Specified by:
      cancel in interface SimpleWorkflow
      Parameters:
      fail - Whether to mark the workflow as failed. If false, the workflow will be marked completed.
    • pause

      public void pause(boolean autoRestart)
      Description copied from interface: SimpleWorkflow
      Stop execution once the currently running activity (if any) finishes.
      Specified by:
      pause in interface SimpleWorkflow
      Parameters:
      autoRestart - Whether to mark the workflow as available for automatic resume. If true, hints to the system infrastructure that it should resume processing of this workflow at the next available processor.
    • getMap

      public SimpleOrchestrationMap getMap()
      Description copied from interface: SimpleWorkflow
      Return the map of metadata defining order and identifying information about all contained SimpleActivity members.
      Specified by:
      getMap in interface SimpleWorkflow
      Returns:
      The map of metadata defining order and identifying information
      See Also:
    • execute

      public void execute(List<Step> steps, @Nullable Step target, Map<String,Object> context)
      Description copied from interface: SimpleWorkflow
      Execute a list of SimpleActivity members identified by their names at the position identified by the activity whose name matches the name parameters. Also, provide the context information to pass to the workflow execution.
      Specified by:
      execute in interface SimpleWorkflow
      Parameters:
      steps - List of SimpleActivity member names
      target - The activity that represents the starting point in the list. Optional. Start at the first position if null.
      context - Any information that needs to be supplied to one or more activities
      See Also:
    • getSteps

      public List<Step> getSteps()
      Description copied from interface: SimpleWorkflow
      Retrieve the ordered list of names for all the activities supported by this workflow. The names should match Spring bean names for each, as SimpleActivity implementations use Spring as the bean factory for retrieval of instances.
      Specified by:
      getSteps in interface SimpleWorkflow
      Returns:
      The ordered list of names for all the activities supported by this workflow
    • getNextStep

      @Nullable public String getNextStep(@Nullable String lastStep, @Nullable String lastResponse)
      Description copied from interface: SimpleWorkflow
      Given a previous step and response (see ActivityResponse), determine what the next step should be in the workflow. Workflow execution is dynamic in this regard based on decision criteria registered as part of Step.getDecisions().
      Specified by:
      getNextStep in interface SimpleWorkflow
      Parameters:
      lastStep - The name of the previous step to execute
      lastResponse - The response value from the previous step to execute
      Returns:
      The name of the next step that should execute
    • executeActivity

      protected ActivityResponse executeActivity(Step step, Map<String,Object> context)
      Engage a specific step in the workflow with context.
      Parameters:
      step - The Step instance to execute
      context - The context to pass to the execution
      Returns:
      The information about the execution outcome
    • getCurrentActivity

      public String getCurrentActivity()
      Description copied from interface: SimpleWorkflow
      The current activity that is running in the workflow.
      Specified by:
      getCurrentActivity in interface SimpleWorkflow
      Returns:
      The current activity that is running in the workflow.
    • getSuppliedSetup

      public Steps getSuppliedSetup()
    • getId

      public String getId()
    • setId

      public void setId(String id)