Class TransitionableState

All Implemented Interfaces:
Annotated, StateDefinition, TransitionableStateDefinition
Direct Known Subclasses:
ActionState, DecisionState, SubflowState, ViewState

public abstract class TransitionableState extends State implements TransitionableStateDefinition
Abstract superclass for states that can execute a transition in response to an event.
Author:
Keith Donald, Erwin Vervaet
See Also:
  • Constructor Details

  • Method Details

    • getTransitions

      public TransitionDefinition[] getTransitions()
      Description copied from interface: TransitionableStateDefinition
      Returns the available transitions out of this state.
      Specified by:
      getTransitions in interface TransitionableStateDefinition
      Returns:
      the available state transitions
    • getTransition

      public TransitionDefinition getTransition(String eventId)
      Description copied from interface: TransitionableStateDefinition
      Returns the transition that matches the event with the provided id.
      Specified by:
      getTransition in interface TransitionableStateDefinition
      Parameters:
      eventId - the event id
      Returns:
      the transition that matches, or null if no match is found.
    • getTransitionSet

      public TransitionSet getTransitionSet()
      Returns the set of transitions. The returned set is mutable.
    • getRequiredTransition

      public Transition getRequiredTransition(RequestContext context) throws NoMatchingTransitionException
      Get a transition in this state for given flow execution request context. Throws and exception when there is no corresponding transition.
      Throws:
      NoMatchingTransitionException - when a matching transition cannot be found
    • getExitActionList

      public ActionList getExitActionList()
      Returns the list of actions executed by this state when it is exited. The returned list is mutable.
      Returns:
      the state exit action list
    • handleEvent

      public boolean handleEvent(RequestControlContext context) throws NoMatchingTransitionException
      Inform this state definition that an event was signaled in it. The signaled event is the last event available in given request context (RequestContext.getCurrentEvent()).
      Parameters:
      context - the flow execution control context
      Throws:
      NoMatchingTransitionException - when a matching transition cannot be found
    • exit

      public void exit(RequestControlContext context)
      Exit this state. This is typically called when a transition takes the flow out of this state into another state. By default just executes any registered exit actions.
      Parameters:
      context - the flow control context
    • appendToString

      protected void appendToString(org.springframework.core.style.ToStringCreator creator)
      Description copied from class: State
      Subclasses may override this hook method to print their internal state to a string. This default implementation does nothing.
      Overrides:
      appendToString in class State
      Parameters:
      creator - the toString creator, to print properties to string
      See Also: