Class DefaultWorkflowService<P extends Workflow>
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.workflow.service.DefaultWorkflowService<P>
- Type Parameters:
P- The possibly extended type of Workflow
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>,WorkflowService<P>
public class DefaultWorkflowService<P extends Workflow>
extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
implements WorkflowService<P>
See
WorkflowService-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWorkflowService(WorkflowRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.orchestration.spring.SimpleWorkflowFactory factory, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender sender, WorkflowRunner workflowRunner, SideEffectRepository<com.broadleafcommerce.data.tracking.core.Trackable> sideEffectRepository, com.broadleafcommerce.orchestration.internal.LogHandler logHandler) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendLogs(String id, com.broadleafcommerce.orchestration.client.History history) voidcancel(String id, boolean fail, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Cancel a PROCESSING or QUEUED workflow.protected com.broadleafcommerce.orchestration.client.HistorycompressHistory(com.broadleafcommerce.orchestration.client.History history) protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node>voidgoToStep(String id, String stepName, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transition activity execution to a targeted step (backward or forward).voidPause 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 page, 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.HistoryreadHistoryElements(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.SimpleOrchestrationMapreadOrchestrationMap(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the ordered list of information items related to theSimpleActivitymembers of the current workflow.voidResume a PAUSED workflow.voidsetParser(com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser) 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 class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService
getRsqlHelper, readAll, readAll, readAllMethods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService
convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getRepository, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll
-
Constructor Details
-
DefaultWorkflowService
public DefaultWorkflowService(WorkflowRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.orchestration.spring.SimpleWorkflowFactory factory, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.common.messaging.notification.DetachedDurableMessageSender sender, WorkflowRunner workflowRunner, SideEffectRepository<com.broadleafcommerce.data.tracking.core.Trackable> sideEffectRepository, com.broadleafcommerce.orchestration.internal.LogHandler logHandler)
-
-
Method Details
-
start
public P start(String workflowName, @Nullable String reference, Map<String, String> workflowContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceStart a new workflow execution- Specified by:
startin interfaceWorkflowService<P extends Workflow>- Parameters:
workflowName- The name of the workflow. Must match a bean name for aSimpleWorkflowprototype 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
public P update(String id, @Nullable Map<String, String> workflowContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceUpdate theWorkflow.setContextValues(Set)information only.- Specified by:
updatein interfaceWorkflowService<P extends Workflow>- 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
public void cancel(String id, boolean fail, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceCancel a PROCESSING or QUEUED workflow. Cancel will occur upon completion of the current activity. Wait activities will short circuit with an interrupt.SimpleActivityimplementations may also short circuit (if applicable) by overridingInterruptAware.interrupt().- Specified by:
cancelin interfaceWorkflowService<P extends Workflow>- 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
public void pause(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServicePause 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.SimpleActivityimplementations may also short circuit (if applicable) by overridingInterruptAware.interrupt().- Specified by:
pausein interfaceWorkflowService<P extends Workflow>- Parameters:
id- The primary keycontextInfo- The data tracking context information
-
resume
public void resume(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceResume a PAUSED workflow.- Specified by:
resumein interfaceWorkflowService<P extends Workflow>- Parameters:
id- The primary keycontextInfo- The data tracking context information
-
goToStep
@Transactional(transactionManager="workflowTransactionManager") public void goToStep(String id, String stepName, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceTransition 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.SimpleActivityimplementations may also short circuit (if applicable) by overridingInterruptAware.interrupt().- Specified by:
goToStepin interfaceWorkflowService<P extends Workflow>- Parameters:
id- The primary keystepName- The name of the activity to transition to. SeeSimpleActivity.getName(). The name must match the bean name of theSimpleActivitysingleton bean in Spring.contextInfo- The data tracking context information.
-
readHistoryElements
public com.broadleafcommerce.orchestration.client.History readHistoryElements(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceFind the step-by-step history of execution (including timing and result status) for a workflow.- Specified by:
readHistoryElementsin interfaceWorkflowService<P extends Workflow>- Parameters:
id- The primary keycontextInfo- The data tracking context information- Returns:
- The step-by-step history of execution
-
readOrchestrationMap
public com.broadleafcommerce.orchestration.client.SimpleOrchestrationMap readOrchestrationMap(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceFind the ordered list of information items related to theSimpleActivitymembers 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.- Specified by:
readOrchestrationMapin interfaceWorkflowService<P extends Workflow>- Parameters:
id- The primary keycontextInfo- The data tracking context information- Returns:
- The ordered list of information items
-
readAll
public 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) Description copied from interface:WorkflowServiceRetrieve all matching the RSQL filters.- Specified by:
readAllin interfacecom.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P extends Workflow>- Specified by:
readAllin interfaceWorkflowService<P extends Workflow>- Overrides:
readAllin classcom.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<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
public org.springframework.data.domain.Page<P> readAllByDescription(@Nullable String description, @Nullable cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:WorkflowServiceRetrieve all matching the RSQL filters, with an option to explicitly filter on the Workflow's description.- Specified by:
readAllByDescriptionin interfaceWorkflowService<P extends Workflow>- 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.page- Paging configurationcontext- Data tracking context information- Returns:
- A page of matching data for the Workflow description provided
-
readByReference
public P readByReference(String reference, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:WorkflowServiceFind a workflow by its reference value.- Specified by:
readByReferencein interfaceWorkflowService<P extends Workflow>- Parameters:
reference- The reference valuecontextInfo- The data tracking context information- Returns:
- The workflow, if available
-
appendLogs
-
compressHistory
protected com.broadleafcommerce.orchestration.client.History compressHistory(com.broadleafcommerce.orchestration.client.History history) -
getParser
protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> getParser() -
setParser
@Autowired public void setParser(com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser)
-