Class DecisionState

All Implemented Interfaces:
Annotated, StateDefinition, TransitionableStateDefinition

public class DecisionState extends TransitionableState
A simple transitionable state that when entered will execute the first transition whose matching criteria evaluates to true in the context of the current request.

A decision state is a convenient, simple way to encapsulate reusable state transition logic in one place.

Author:
Keith Donald
  • Constructor Details

    • DecisionState

      public DecisionState(Flow flow, String stateId) throws IllegalArgumentException
      Creates a new decision state.
      Parameters:
      flow - the owning flow
      stateId - the state identifier (must be unique to the flow)
      Throws:
      IllegalArgumentException - when this state cannot be added to given flow, e.g. because the id is not unique
  • Method Details

    • doEnter

      protected void doEnter(RequestControlContext context) throws FlowExecutionException
      Specialization of State's doEnter template method that executes behavior specific to this state type in polymorphic fashion.

      Simply looks up the first transition that matches the state of the context and executes it.

      Specified by:
      doEnter in class State
      Parameters:
      context - the control context for the currently executing flow, used by this state to manipulate the flow execution
      Throws:
      FlowExecutionException - if an exception occurs in this state