Class WorkflowInstance.Builder
java.lang.Object
io.nflow.engine.workflow.instance.WorkflowInstance.Builder
- Enclosing class:
WorkflowInstance
Builder for workflow instance.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Create a workflow instance builder.Builder(ObjectStringMapper objectMapper) Create a workflow instance builder with an object mapper.Builder(WorkflowInstance copy) Create a workflow instance builder based on an existing workflow instance. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create the workflow instance object.putStateVariable(String key, Object value) Put a state variable to the state variables map.putStateVariable(String key, String value) Put a state variable to the state variables map.putStateVariable(String key, Optional<?> optionalValue) Put a state variable to the state variables map if the optional value is present.setActions(List<WorkflowInstanceAction> actions) Set the workflow instance actions.setArchived(boolean isArchived) Set whether the workflow instance is stored in archive or main tables.setBusinessKey(String businessKey) Set the business key.setCreated(org.joda.time.DateTime created) Set the creation timestamp.setExecutorGroup(String executorGroup) Set the executor group name.setExecutorId(Integer executorId) Set the executor instance identifier.setExternalId(String externalId) Set the external identifier.setId(long id) Set the workflow instance identifier.setModified(org.joda.time.DateTime modified) Set the modification timestamp.setNextActivation(org.joda.time.DateTime nextActivation) Set the next activation time.setOriginalStateVariables(Map<String, String> originalStateVariables) Set the original state variables.setParentActionId(Long parentActionId) Set the parent workflow identifier.setParentWorkflowId(Long parentWorkflowId) Set the parent workflow identifier.setPriority(Short priority) Set the priority of the workflow instance.setRetries(int retries) Set the number of retries.Set the signal value.setStartedIfNotSet(org.joda.time.DateTime started) Set the started timestamp if it has not already been set.setState(WorkflowState state) Set the state.Set the state.setStateText(String stateText) Set the state text.setStateVariables(Map<String, String> stateVariables) Set the state variables.Set the status.Set the type of the workflow definition.
-
Constructor Details
-
Builder
public Builder()Create a workflow instance builder. -
Builder
Create a workflow instance builder with an object mapper.- Parameters:
objectMapper- The object mapper.
-
Builder
Create a workflow instance builder based on an existing workflow instance.- Parameters:
copy- The instance to be used as a basis for the new instance.
-
-
Method Details
-
setId
Set the workflow instance identifier.- Parameters:
id- The identifier.- Returns:
- this.
-
setExecutorId
Set the executor instance identifier.- Parameters:
executorId- The identifier.- Returns:
- this.
-
setParentWorkflowId
Set the parent workflow identifier.- Parameters:
parentWorkflowId- The identifier.- Returns:
- this.
-
setParentActionId
Set the parent workflow identifier.- Parameters:
parentActionId- The identifier.- Returns:
- this.
-
setStatus
Set the status.- Parameters:
status- The status.- Returns:
- this.
-
setType
Set the type of the workflow definition.- Parameters:
type- The type.- Returns:
- this.
-
setPriority
Set the priority of the workflow instance. When an executor chooses from many available scheduled workflow instances it primarily (unfairly) schedules the workflow instance with the larger priority value, and for workflows with the same priority, the one scheduled first. Priority defaults to 0 and can also be negative.- Parameters:
priority- The priority.- Returns:
- this.
-
setBusinessKey
Set the business key.- Parameters:
businessKey- The business key.- Returns:
- this.
-
setExternalId
Set the external identifier.- Parameters:
externalId- The external identifier.- Returns:
- this.
-
setState
Set the state.- Parameters:
state- The name of the state.- Returns:
- this.
-
setState
Set the state.- Parameters:
state- The state.- Returns:
- this.
-
setStateText
Set the state text.- Parameters:
stateText- The state text.- Returns:
- this.
-
setNextActivation
Set the next activation time.- Parameters:
nextActivation- The next activation time.- Returns:
- this.
-
setOriginalStateVariables
public WorkflowInstance.Builder setOriginalStateVariables(Map<String, String> originalStateVariables) Set the original state variables.- Parameters:
originalStateVariables- The original state variables.- Returns:
- this.
-
setStateVariables
Set the state variables.- Parameters:
stateVariables- The state variables.- Returns:
- this.
-
putStateVariable
Put a state variable to the state variables map.- Parameters:
key- The name of the variable.value- The string value of the variable.- Returns:
- this.
-
putStateVariable
Put a state variable to the state variables map.- Parameters:
key- The name of the variable.value- The value of the variable, serialized by object mapper.- Returns:
- this.
-
putStateVariable
Put a state variable to the state variables map if the optional value is present. If the optionalValue is empty, existing state variable value is not changed.- Parameters:
key- The name of the variable.optionalValue- The optional value of the variable, serialized by object mapper.- Returns:
- this.
-
setActions
Set the workflow instance actions.- Parameters:
actions- List of actions.- Returns:
- this.
-
setRetries
Set the number of retries.- Parameters:
retries- The number of retries.- Returns:
- this.
-
setCreated
Set the creation timestamp.- Parameters:
created- Creation time.- Returns:
- this.
-
setModified
Set the modification timestamp.- Parameters:
modified- Modification time.- Returns:
- this.
-
setStartedIfNotSet
Set the started timestamp if it has not already been set.- Parameters:
started- Start time.- Returns:
- this.
-
setExecutorGroup
Set the executor group name.- Parameters:
executorGroup- The executor group name.- Returns:
- this.
-
setSignal
Set the signal value.- Parameters:
signal- The signal value.- Returns:
- this.
-
setArchived
Set whether the workflow instance is stored in archive or main tables.- Parameters:
isArchived- True if this workflow is stored in archive tables.- Returns:
- this.
-
build
Create the workflow instance object.- Returns:
- The workflow instance.
-