public class StateExecutionImpl extends ModelObject implements StateExecution
| Constructor and Description |
|---|
StateExecutionImpl(WorkflowInstance instance,
ObjectStringMapper objectMapper,
WorkflowInstanceDao workflowDao,
WorkflowInstancePreProcessor workflowInstancePreProcessor,
WorkflowInstanceService workflowInstanceService) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChildWorkflows(WorkflowInstance... childWorkflows)
Add new child workflows.
|
void |
addWorkflows(WorkflowInstance... workflows)
Add new workflows.
|
boolean |
createAction() |
List<WorkflowInstance> |
getAllChildWorkflows()
Return all child workflows for current workflow.
|
String |
getBusinessKey()
Return the business key associated to the workflow instance.
|
String |
getCurrentStateName() |
List<WorkflowInstance> |
getNewChildWorkflows() |
List<WorkflowInstance> |
getNewWorkflows() |
org.joda.time.DateTime |
getNextActivation() |
String |
getNextState() |
String |
getNextStateReason() |
Optional<Long> |
getParentId()
Return the parent workflow instance id if this is a child workflow, otherwise return empty.
|
int |
getRetries()
Return the number of retry attempts in the current state.
|
Optional<Integer> |
getSignal()
Return the signal value from database if it has been set, otherwise return empty.
|
Throwable |
getThrown() |
String |
getVariable(String name)
Return a string value of the given variable.
|
<T> T |
getVariable(String name,
Class<T> type)
Return the value of the given variable.
|
<T> T |
getVariable(String name,
Class<T> type,
T defaultValue)
Return the value of the given variable, or {code defaultValue} if the variable does not
exist.
|
String |
getVariable(String name,
String defaultValue)
Return the string value of the given variable, or {code defaultValue} if
the variable does not exist.
|
Optional<List<String>> |
getWakeUpParentWorkflowStates() |
String |
getWorkflowInstanceExternalId()
Return the external id of the workflow instance.
|
long |
getWorkflowInstanceId()
Return the id of the workflow instance.
|
void |
handleRetryAfter(org.joda.time.DateTime activation,
AbstractWorkflowDefinition<?> definition)
Handle retries for the state execution.
|
boolean |
isFailed() |
boolean |
isHistoryCleaningForced() |
boolean |
isRetry() |
boolean |
isRetryCountExceeded() |
boolean |
isStateProcessInvoked() |
List<WorkflowInstance> |
queryChildWorkflows(QueryWorkflowInstances query)
Return child workflow instances for current workflow.
|
void |
setCreateAction(boolean createAction)
Control if action is created when workflow instance is updated to the database after state processing.
|
void |
setFailed() |
void |
setFailed(Throwable t) |
void |
setHistoryCleaningForced(boolean historyCleaningForced)
Set to true to force workflow instance history cleaning when workflow instance is updated to the database after state processing.
|
void |
setNextActivation(org.joda.time.DateTime activation) |
void |
setNextState(WorkflowState state) |
void |
setNextStateReason(String reason) |
void |
setRetry(boolean isRetry) |
void |
setSignal(Optional<Integer> signal,
String reason)
Set the signal value to the database.
|
void |
setStateProcessInvoked(boolean isStateProcessInvoked) |
void |
setVariable(String name,
Object value)
Set the value for the given varible.
|
void |
setVariable(String name,
String value)
Set the string value of the given variable.
|
void |
wakeUpParentWorkflow(String... expectedStates)
Notify parent workflow that it may start processing again.
|
WorkflowInstance.Builder |
workflowInstanceBuilder()
Create a builder for creating child workflows.
|
equals, hashCode, toStringpublic StateExecutionImpl(WorkflowInstance instance, ObjectStringMapper objectMapper, WorkflowInstanceDao workflowDao, WorkflowInstancePreProcessor workflowInstancePreProcessor, WorkflowInstanceService workflowInstanceService)
public org.joda.time.DateTime getNextActivation()
public String getNextState()
public String getNextStateReason()
public String getCurrentStateName()
public long getWorkflowInstanceId()
StateExecutiongetWorkflowInstanceId in interface StateExecutionpublic String getWorkflowInstanceExternalId()
StateExecutiongetWorkflowInstanceExternalId in interface StateExecutionpublic String getBusinessKey()
StateExecutiongetBusinessKey in interface StateExecutionpublic int getRetries()
StateExecutiongetRetries in interface StateExecutionpublic String getVariable(String name)
StateExecutiongetVariable in interface StateExecutionname - The name of the variable.public <T> T getVariable(String name, Class<T> type)
StateExecutiongetVariable in interface StateExecutionT - The type of object to be deserialized.name - The name of the variable.type - The class of the variable.public <T> T getVariable(String name, Class<T> type, T defaultValue)
StateExecutiongetVariable in interface StateExecutionT - The type of object to be deserialized.name - The name of the variable.type - The class of the variable.defaultValue - The default value if the variable does not exist.public String getVariable(String name, String defaultValue)
StateExecutiongetVariable in interface StateExecutionname - The name of the variable.defaultValue - The default value if the variable does not exist.public void setVariable(String name, String value)
StateExecutionsetVariable in interface StateExecutionname - The name of the variable.value - The string value for the varible.public void setVariable(String name, Object value)
StateExecutionsetVariable in interface StateExecutionname - The name of the variable.value - The value for the variable.public void setNextActivation(org.joda.time.DateTime activation)
public void setNextState(WorkflowState state)
public void setNextStateReason(String reason)
public boolean isRetry()
public void setRetry(boolean isRetry)
public boolean isFailed()
public Throwable getThrown()
public void setFailed()
public void setFailed(Throwable t)
public boolean isRetryCountExceeded()
public void addChildWorkflows(WorkflowInstance... childWorkflows)
StateExecutionaddChildWorkflows in interface StateExecutionchildWorkflows - Child workflows to create.public void addWorkflows(WorkflowInstance... workflows)
StateExecutionaddWorkflows in interface StateExecutionworkflows - Workflows to create.public List<WorkflowInstance> getNewChildWorkflows()
public List<WorkflowInstance> getNewWorkflows()
public List<WorkflowInstance> queryChildWorkflows(QueryWorkflowInstances query)
StateExecutionqueryChildWorkflows in interface StateExecutionquery - The query criterias.public List<WorkflowInstance> getAllChildWorkflows()
StateExecutiongetAllChildWorkflows in interface StateExecutionpublic void wakeUpParentWorkflow(String... expectedStates)
StateExecutionwakeUpParentWorkflow in interface StateExecutionexpectedStates - If parent state is not one of the expected states, it is not woken up. If no expected states are
given, parent workflow is woken up regardless of the state.public WorkflowInstance.Builder workflowInstanceBuilder()
StateExecutionworkflowInstanceBuilder in interface StateExecutionpublic void setStateProcessInvoked(boolean isStateProcessInvoked)
public boolean isStateProcessInvoked()
public void setCreateAction(boolean createAction)
StateExecutionsetCreateAction in interface StateExecutioncreateAction - Whether action should be created or not.public boolean createAction()
public Optional<Integer> getSignal()
StateExecutiongetSignal in interface StateExecutionpublic void setSignal(Optional<Integer> signal, String reason)
StateExecutionsetSignal in interface StateExecutionsignal - Signal value to be set.reason - The reason for setting the signal.public Optional<Long> getParentId()
StateExecutiongetParentId in interface StateExecutionpublic void setHistoryCleaningForced(boolean historyCleaningForced)
StateExecutionsetHistoryCleaningForced in interface StateExecutionhistoryCleaningForced - Whether history cleaning should be forced or not.public boolean isHistoryCleaningForced()
public void handleRetryAfter(org.joda.time.DateTime activation,
AbstractWorkflowDefinition<?> definition)
activation - Time for next retry attempt.definition - Workflow definitionCopyright © 2014–2020 Nitor Creations. All rights reserved.