Class NextAction
- java.lang.Object
-
- io.nflow.engine.model.ModelObject
-
- io.nflow.engine.workflow.definition.NextAction
-
public class NextAction extends ModelObject
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.joda.time.DateTimegetActivation()Return the time after which the workflow should be activated.WorkflowStategetNextState()Return the next state of the workflow.StringgetReason()Return the reason for the next action.booleanisRetry()Return true if this action is a retry of the current state.static NextActionmoveToState(WorkflowState nextState, String reason)Schedule processing of statenextStateimmediately.static NextActionmoveToStateAfter(WorkflowState nextState, org.joda.time.DateTime activation, String reason)Schedule processing of statenextStateat timeactivation.static NextActionretryAfter(org.joda.time.DateTime activation, String reason)Schedule retry for current state at timeactivation.static NextActionstopInState(WorkflowState finalState, String reason)Set next state tofinalStateand do not schedule its processing.-
Methods inherited from class io.nflow.engine.model.ModelObject
equals, hashCode, toString
-
-
-
-
Method Detail
-
getActivation
public org.joda.time.DateTime getActivation()
Return the time after which the workflow should be activated. There is no guarantee that the workflow will be activated exactly at the given time.- Returns:
- The activation time.
-
getNextState
public WorkflowState getNextState()
Return the next state of the workflow.- Returns:
- The workflow state.
-
getReason
public String getReason()
Return the reason for the next action.- Returns:
- The reason.
-
retryAfter
public static NextAction retryAfter(org.joda.time.DateTime activation, String reason)
Schedule retry for current state at timeactivation.- Parameters:
activation- The time after which the workflow can be activated.reason- The reason for the action.- Returns:
- A valid
NextActionvalue.
-
moveToStateAfter
public static NextAction moveToStateAfter(WorkflowState nextState, org.joda.time.DateTime activation, String reason)
Schedule processing of statenextStateat timeactivation.- Parameters:
nextState- The next workflow state.activation- The time after which the workflow can be activated.reason- The reason for the action.- Returns:
- A valid
NextActionvalue.
-
moveToState
public static NextAction moveToState(WorkflowState nextState, String reason)
Schedule processing of statenextStateimmediately.- Parameters:
nextState- The next workflow state.reason- The reason for the action.- Returns:
- A valid
NextActionvalue.
-
stopInState
public static NextAction stopInState(WorkflowState finalState, String reason)
Set next state tofinalStateand do not schedule its processing. ThefinalStateworkflow state type must be final, e.g. it must be either end state or manual state. The state handler method of the state, even if it exists, is not executed. Additionally, there is no workflow action recorded for thefinalState. If you want to execute the state handler method and record a workflow action, use one of themoveToStatemethods instead.- Parameters:
finalState- Final workflow state (end state or manual state).reason- The reason for the action.- Returns:
- A valid
NextActionvalue.
-
isRetry
public boolean isRetry()
Return true if this action is a retry of the current state.- Returns:
- True if action is a retry, false otherwise.
-
-