Interface WorkflowService<P extends Workflow>
- Type Parameters:
P
- The possibly extended type of Workflow
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultWorkflowService
public interface WorkflowService<P extends Workflow>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Main API for all standard workflow related logic flows
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel
(String id, boolean fail, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Cancel a PROCESSING or QUEUED workflow.void
goToStep
(String id, String stepName, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transition activity execution to a targeted step (backward or forward).void
Pause a PROCESSING workflow.org.springframework.data.domain.Page<P>
readAll
(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all matching the RSQL filters.org.springframework.data.domain.Page<P>
readAllByDescription
(String description, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all matching the RSQL filters, with an option to explicitly filter on the Workflow's description.readByReference
(String reference, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find a workflow by its reference value.com.broadleafcommerce.orchestration.client.History
readHistoryElements
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the step-by-step history of execution (including timing and result status) for a workflow.com.broadleafcommerce.orchestration.client.SimpleOrchestrationMap
readOrchestrationMap
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the ordered list of information items related to theSimpleActivity
members of the current workflow.void
Resume a PAUSED workflow.start
(String workflowName, String reference, Map<String, String> workflowContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Start a new workflow executionupdate
(String id, Map<String, String> workflowContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update theWorkflow.setContextValues(Set)
information only.Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll
-
Method Details
-
start
P start(String workflowName, @Nullable String reference, Map<String, String> workflowContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Start a new workflow execution- Parameters:
workflowName
- The name of the workflow. Must match a bean name for aSimpleWorkflow
prototype bean.reference
- Optional. A reference value to which this workflow is correlated. The system will not start more than one workflow for a given reference value. The value must be less than or equal to 36 chars in length.workflowContext
- The key/value pair information to pass to the workflow execution. Can be used by activities to inform logic execution.contextInfo
- The data tracking context information.- Returns:
- The persisted state of the workflow, queued for execution.
-
update
P update(String id, @Nullable Map<String, String> workflowContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update theWorkflow.setContextValues(Set)
information only.- Parameters:
id
- The primary keyworkflowContext
- he key/value pair information to pass to the workflow execution.contextInfo
- The data tracking context information.- Returns:
- The persisted state of the workflow
-
cancel
void cancel(String id, boolean fail, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Cancel a PROCESSING or QUEUED workflow. Cancel will occur upon completion of the current activity. Wait activities will short circuit with an interrupt.SimpleActivity
implementations may also short circuit (if applicable) by overridingInterruptAware.interrupt()
.- Parameters:
id
- The primary keyfail
- Whether the cancellation should result in a FAIL status (false results in COMPLETED status)contextInfo
- The data tracking context information
-
pause
void pause(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Pause a PROCESSING workflow. Paused workflows may be resumed at the point where they left off. Pause will occur upon completion of the current activity. Wait activities will short circuit with an interrupt.SimpleActivity
implementations may also short circuit (if applicable) by overridingInterruptAware.interrupt()
.- Parameters:
id
- The primary keycontextInfo
- The data tracking context information
-
resume
void resume(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Resume a PAUSED workflow.- Parameters:
id
- The primary keycontextInfo
- The data tracking context information
-
goToStep
void goToStep(String id, String stepName, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transition activity execution to a targeted step (backward or forward). Execution will transition upon completion of the current activity. Wait activities will short circuit with an interrupt.SimpleActivity
implementations may also short circuit (if applicable) by overridingInterruptAware.interrupt()
.- Parameters:
id
- The primary keystepName
- The name of the activity to transition to. SeeSimpleActivity.getName()
. The name must match the bean name of theSimpleActivity
singleton bean in Spring.contextInfo
- The data tracking context information.
-
readHistoryElements
com.broadleafcommerce.orchestration.client.History readHistoryElements(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the step-by-step history of execution (including timing and result status) for a workflow.- Parameters:
id
- The primary keycontextInfo
- The data tracking context information- Returns:
- The step-by-step history of execution
-
readOrchestrationMap
com.broadleafcommerce.orchestration.client.SimpleOrchestrationMap readOrchestrationMap(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the ordered list of information items related to theSimpleActivity
members of the current workflow. This information can be used to drive a visual representation of past and future execution based on a pipeline of available activities. The metadata also indicates what options are available for each step based on configuration and current state.- Parameters:
id
- The primary keycontextInfo
- The data tracking context information- Returns:
- The ordered list of information items
-
readByReference
P readByReference(String reference, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find a workflow by its reference value.- Parameters:
reference
- The reference valuecontextInfo
- The data tracking context information- Returns:
- The workflow, if available
- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- If not found
-
readAll
org.springframework.data.domain.Page<P> readAll(@Nullable cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all matching the RSQL filters.- Specified by:
readAll
in interfacecom.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P extends Workflow>
- Parameters:
filters
- RSQL filters. Special support here for theJpaWorkflow.getContextValues()
collection. A special selector (`contextValue`) may be used to find workflows with specific value matches for context params. For example,status=='PROCESSING';contextValue=='jeff'
would find all processing workflows with an exact context value match for the name jeff. See RSQL spec for different operators supported.pageable
- Paging configurationcontext
- Data tracking context information- Returns:
- A page of matching data
-
readAllByDescription
org.springframework.data.domain.Page<P> readAllByDescription(@Nullable String description, @Nullable cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve all matching the RSQL filters, with an option to explicitly filter on the Workflow's description.- Parameters:
description
- the text query to filter on against the Workflow's descriptionfilters
- RSQL filters. Special support here for theJpaWorkflow.getContextValues()
collection. A special selector (`contextValue`) may be used to find workflows with specific value matches for context params. For example,status=='PROCESSING';contextValue=='jeff'
would find all processing workflows with an exact context value match for the name jeff. See RSQL spec for different operators supported.pageable
- Paging configurationcontext
- Data tracking context information- Returns:
- A page of matching data for the Workflow description provided
-