Class SimpleFlow

  • All Implemented Interfaces:
    Flow, org.springframework.beans.factory.InitializingBean
    Direct Known Subclasses:
    JsrFlow

    public class SimpleFlow
    extends java.lang.Object
    implements Flow, org.springframework.beans.factory.InitializingBean
    A 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.
    Since:
    2.0
    Author:
    Dave Syer, Michael Minella
    • Constructor Detail

      • SimpleFlow

        public SimpleFlow​(java.lang.String name)
        Create a flow with the given name.
        Parameters:
        name - the name of the flow
    • Method Detail

      • setStateTransitionComparator

        public void setStateTransitionComparator​(java.util.Comparator<StateTransition> stateTransitionComparator)
      • getStartState

        public State getStartState()
      • getName

        public java.lang.String getName()
        Get the name for this flow.
        Specified by:
        getName in interface Flow
        Returns:
        the name of the flow
        See Also:
        Flow.getName()
      • setStateTransitions

        public void setStateTransitions​(java.util.List<StateTransition> stateTransitions)
        Public setter for the stateTransitions.
        Parameters:
        stateTransitions - the stateTransitions to set
      • getState

        public State getState​(java.lang.String stateName)
        Retrieve the State with the given name. If there is no State with the given name, then return null.
        Specified by:
        getState in interface Flow
        Parameters:
        stateName - the name of the state to retrieve
        Returns:
        the State
      • getStates

        public java.util.Collection<State> getStates()
        Convenient accessor for clients needing to explore the states of this flow.
        Specified by:
        getStates in interface Flow
        Returns:
        the states
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Locate start state and pre-populate data structures needed for execution.
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception
        See Also:
        InitializingBean.afterPropertiesSet()
      • getTransitionMap

        protected java.util.Map<java.lang.String,​java.util.Set<StateTransition>> getTransitionMap()
      • getStateMap

        protected java.util.Map<java.lang.String,​State> getStateMap()