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 TypeMethodDescriptionbooleanWhether requesting a previously executed step (prior to the last step) inSimpleWorkflow.goToStep(String)is allowed.booleanWhether requesting the most recently executed step inSimpleWorkflow.goToStep(String)is allowed.voidcancel(boolean fail) Cancel execution once the currently running activity (if any) finishes.voidExecute a list ofSimpleActivitymembers identified by their names at the position identified by the activity whose name matches the name parameters.protected ActivityResponseexecuteActivity(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 allSimpleActivityexecutions that have occurred.getId()getMap()Return the map of metadata defining order and identifying information about all containedSimpleActivitymembers.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.voidSignal the workflow to circumvent normal execution ordering and skip forward or backward to the position where theSimpleActivity.getName()matches the supplied name.voidinitialize(String name, String id, WorkflowConfiguration workflowConfiguration) voidpause(boolean autoRestart) Stop execution once the currently running activity (if any) finishes.voidvoidshutdown()Stop a running workflow.voidStart execution of the list ofSimpleActivityitems 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:SimpleWorkflowWhether 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:
allowHistoricalResetin interfaceSimpleWorkflow- Returns:
- Whether requesting a previously executed step (prior to the last step) is allowed
-
allowRetry
public boolean allowRetry()Description copied from interface:SimpleWorkflowWhether requesting the most recently executed step inSimpleWorkflow.goToStep(String)is allowed.- Specified by:
allowRetryin interfaceSimpleWorkflow- Returns:
- Whether requesting the most recent executed step is allowed
-
getName
Description copied from interface:SimpleWorkflowThe unique name for this workflow. Should match the Spring bean name for the workflow bean.- Specified by:
getNamein interfaceSimpleWorkflow- Returns:
- The unique name for this workflow.
-
getDescription
Description copied from interface:SimpleWorkflowA human-readable description for this workflow. Generally also unique like the name to ensure clarity in the admin UI.- Specified by:
getDescriptionin interfaceSimpleWorkflow- Returns:
- A human-readable description for this workflow.
-
shutdown
public void shutdown()Description copied from interface:SimpleWorkflowStop 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:
shutdownin interfaceSimpleWorkflow
-
start
Description copied from interface:SimpleWorkflowStart execution of the list ofSimpleActivityitems at the first position.- Specified by:
startin interfaceSimpleWorkflow- Parameters:
context- Any information that needs to be supplied to one or more activities
-
getHistory
Description copied from interface:SimpleWorkflowReturn the list of start and end times, status, and possible failure information for allSimpleActivityexecutions that have occurred.- Specified by:
getHistoryin interfaceSimpleWorkflow- Returns:
- The list of start and end times, status, and possible failure information
- See Also:
-
goToStep
Description copied from interface:SimpleWorkflowSignal 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:
goToStepin 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:SimpleWorkflowCancel execution once the currently running activity (if any) finishes.- Specified by:
cancelin 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:SimpleWorkflowStop execution once the currently running activity (if any) finishes.- Specified by:
pausein 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:SimpleWorkflowReturn the map of metadata defining order and identifying information about all containedSimpleActivitymembers.- Specified by:
getMapin interfaceSimpleWorkflow- Returns:
- The map of metadata defining order and identifying information
- See Also:
-
execute
Description copied from interface:SimpleWorkflowExecute a list ofSimpleActivitymembers 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:
executein interfaceSimpleWorkflow- Parameters:
steps- List ofSimpleActivitymember 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:SimpleWorkflowRetrieve the ordered list of names for all the activities supported by this workflow. The names should match Spring bean names for each, asSimpleActivityimplementations use Spring as the bean factory for retrieval of instances.- Specified by:
getStepsin interfaceSimpleWorkflow- Returns:
- The ordered list of names for all the activities supported by this workflow
-
getNextStep
Description copied from interface:SimpleWorkflowGiven 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:
getNextStepin 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:SimpleWorkflowThe current activity that is running in the workflow.- Specified by:
getCurrentActivityin interfaceSimpleWorkflow- Returns:
- The current activity that is running in the workflow.
-
getSuppliedSetup
-
getId
-
setId
-