Class SimpleWorkflowExecution
java.lang.Object
com.broadleafcommerce.orchestration.client.SimpleWorkflowExecution
- All Implemented Interfaces:
SimpleWorkflow
Support deterministic execution, history, and workflow map metadata (i.e.
SimpleOrchestrationMap
) for SimpleWorkflow
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether requesting a previously executed step (prior to the last step) inSimpleWorkflow.goToStep(String)
is allowed.boolean
Whether requesting the most recently executed step inSimpleWorkflow.goToStep(String)
is allowed.void
cancel
(boolean fail) Cancel execution once the currently running activity (if any) finishes.void
Execute a list ofSimpleActivity
members identified by their names at the position identified by the activity whose name matches the name parameters.protected ActivityResponse
executeActivity
(Step step, Map<String, Object> context) Engage a specific step in the workflow with context.The current activity that is running in the workflow.A human-readable description for this workflow.Return the list of start and end times, status, and possible failure information for allSimpleActivity
executions that have occurred.getId()
getMap()
Return the map of metadata defining order and identifying information about all containedSimpleActivity
members.getName()
The unique name for this workflow.getNextStep
(String lastStep, String lastResponse) Given a previous step and response (seeActivityResponse
), determine what the next step should be in the workflow.getSteps()
Retrieve the ordered list of names for all the activities supported by this workflow.void
Signal the workflow to circumvent normal execution ordering and skip forward or backward to the position where theSimpleActivity.getName()
matches the supplied name.void
initialize
(String name, String id, WorkflowConfiguration workflowConfiguration) void
pause
(boolean autoRestart) Stop execution once the currently running activity (if any) finishes.void
void
shutdown()
Stop a running workflow.void
Start execution of the list ofSimpleActivity
items at the first position.
-
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) inSimpleWorkflow.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 interfaceSimpleWorkflow
- 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 inSimpleWorkflow.goToStep(String)
is allowed.- Specified by:
allowRetry
in interfaceSimpleWorkflow
- Returns:
- Whether requesting the most recent executed step is allowed
-
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 interfaceSimpleWorkflow
- Returns:
- The unique name for this workflow.
-
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 interfaceSimpleWorkflow
- 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 interfaceSimpleWorkflow
-
start
Description copied from interface:SimpleWorkflow
Start execution of the list ofSimpleActivity
items at the first position.- Specified by:
start
in interfaceSimpleWorkflow
- Parameters:
context
- Any information that needs to be supplied to one or more activities
-
getHistory
Description copied from interface:SimpleWorkflow
Return the list of start and end times, status, and possible failure information for allSimpleActivity
executions that have occurred.- Specified by:
getHistory
in interfaceSimpleWorkflow
- Returns:
- The list of start and end times, status, and possible failure information
- See Also:
-
goToStep
Description copied from interface:SimpleWorkflow
Signal the workflow to circumvent normal execution ordering and skip forward or backward to the position where theSimpleActivity.getName()
matches the supplied name. The signal is honored once the currently running activity (if any) finishes.- Specified by:
goToStep
in interfaceSimpleWorkflow
- 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 interfaceSimpleWorkflow
- 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 interfaceSimpleWorkflow
- 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
Description copied from interface:SimpleWorkflow
Return the map of metadata defining order and identifying information about all containedSimpleActivity
members.- Specified by:
getMap
in interfaceSimpleWorkflow
- Returns:
- The map of metadata defining order and identifying information
- See Also:
-
execute
Description copied from interface:SimpleWorkflow
Execute a list ofSimpleActivity
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 interfaceSimpleWorkflow
- Parameters:
steps
- List ofSimpleActivity
member namestarget
- 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
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, asSimpleActivity
implementations use Spring as the bean factory for retrieval of instances.- Specified by:
getSteps
in interfaceSimpleWorkflow
- Returns:
- The ordered list of names for all the activities supported by this workflow
-
getNextStep
Description copied from interface:SimpleWorkflow
Given a previous step and response (seeActivityResponse
), determine what the next step should be in the workflow. Workflow execution is dynamic in this regard based on decision criteria registered as part ofStep.getDecisions()
.- Specified by:
getNextStep
in interfaceSimpleWorkflow
- Parameters:
lastStep
- The name of the previous step to executelastResponse
- The response value from the previous step to execute- Returns:
- The name of the next step that should execute
-
executeActivity
Engage a specific step in the workflow with context.- Parameters:
step
- The Step instance to executecontext
- The context to pass to the execution- Returns:
- The information about the execution outcome
-
getCurrentActivity
Description copied from interface:SimpleWorkflow
The current activity that is running in the workflow.- Specified by:
getCurrentActivity
in interfaceSimpleWorkflow
- Returns:
- The current activity that is running in the workflow.
-
getSuppliedSetup
-
getId
-
setId
-