public class SimpleFlow extends java.lang.Object implements Flow, org.springframework.beans.factory.InitializingBean
Flow that branches conditionally depending on the exit status of
the last State. The input parameters are the state transitions (in no
particular order). The start state name can be specified explicitly (and must
exist in the set of transitions), or computed from the existing transitions,
if unambiguous.| Constructor and Description |
|---|
SimpleFlow(java.lang.String name)
Create a flow with the given name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Locate start state and pre-populate data structures needed for execution.
|
java.lang.String |
getName()
Get the name for this flow.
|
State |
getStartState() |
State |
getState(java.lang.String stateName)
Retrieve the State with the given name.
|
protected java.util.Map<java.lang.String,State> |
getStateMap() |
java.util.Collection<State> |
getStates()
Convenient accessor for clients needing to explore the states of this
flow.
|
protected java.util.Map<java.lang.String,java.util.Set<StateTransition>> |
getTransitionMap() |
protected boolean |
isFlowContinued(State state,
FlowExecutionStatus status,
StepExecution stepExecution) |
protected State |
nextState(java.lang.String stateName,
FlowExecutionStatus status,
StepExecution stepExecution) |
FlowExecution |
resume(java.lang.String stateName,
FlowExecutor executor) |
void |
setStateTransitionComparator(java.util.Comparator<StateTransition> stateTransitionComparator) |
void |
setStateTransitions(java.util.List<StateTransition> stateTransitions)
Public setter for the stateTransitions.
|
FlowExecution |
start(FlowExecutor executor) |
public SimpleFlow(java.lang.String name)
name - the name of the flowpublic void setStateTransitionComparator(java.util.Comparator<StateTransition> stateTransitionComparator)
public State getStartState()
public java.lang.String getName()
getName in interface FlowFlow.getName()public void setStateTransitions(java.util.List<StateTransition> stateTransitions)
stateTransitions - the stateTransitions to setpublic State getState(java.lang.String stateName)
public java.util.Collection<State> getStates()
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.ExceptionInitializingBean.afterPropertiesSet()public FlowExecution start(FlowExecutor executor) throws FlowExecutionException
start in interface FlowFlowExecutionExceptionFlow.start(FlowExecutor)public FlowExecution resume(java.lang.String stateName, FlowExecutor executor) throws FlowExecutionException
resume in interface FlowstateName - the name of the state to resume onexecutor - the context to be passed into each state executedFlowExecution containing the exit status of the flowFlowExecutionExceptionFlow.resume(String, FlowExecutor)protected java.util.Map<java.lang.String,java.util.Set<StateTransition>> getTransitionMap()
protected java.util.Map<java.lang.String,State> getStateMap()
protected State nextState(java.lang.String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException
Step (or null if this is the end)FlowExecutionExceptionprotected boolean isFlowContinued(State state, FlowExecutionStatus status, StepExecution stepExecution)