public abstract class State extends AnnotatedObject implements StateDefinition
Each state is associated with exactly one owning flow definition. Specializations of this class capture all the configuration information needed for a specific kind of state.
Subclasses should implement the doEnter
method to execute the processing that should occur when this
state is entered, acting on its configuration information. The ability to plug-in custom state types that execute
different behaviors is the classic GoF state pattern.
Equality: Two states are equal if they have the same id and are part of the same flow.
TransitionableState
,
ActionState
,
ViewState
,
SubflowState
,
EndState
,
DecisionState
CAPTION_PROPERTY, DESCRIPTION_PROPERTY
Modifier and Type | Method and Description |
---|---|
void |
enter(RequestControlContext context)
Enter this state in the provided flow control context.
|
boolean |
equals(Object o) |
ActionList |
getEntryActionList()
Returns the list of actions executed by this state when it is entered.
|
FlowExecutionExceptionHandlerSet |
getExceptionHandlerSet()
Returns a mutable set of exception handlers, allowing manipulation of how exceptions are handled when thrown
within this state.
|
Flow |
getFlow()
Returns the owning flow.
|
String |
getId()
Returns this state's identifier, locally unique to is containing flow definition.
|
FlowDefinition |
getOwner()
Returns the flow definition this state belongs to.
|
boolean |
handleException(FlowExecutionException exception,
RequestControlContext context)
Handle an exception that occurred in this state during the context of the current flow execution request.
|
int |
hashCode() |
boolean |
isStartState()
Returns a flag indicating if this state is the start state of its owning flow.
|
boolean |
isViewState()
Returns true if this state is a view state.
|
String |
toString() |
getAttributes, getCaption, getDescription, setCaption, setDescription
getAttributes, getCaption, getDescription
public FlowDefinition getOwner()
StateDefinition
getOwner
in interface StateDefinition
public String getId()
StateDefinition
getId
in interface StateDefinition
public boolean isViewState()
StateDefinition
isViewState
in interface StateDefinition
public Flow getFlow()
public ActionList getEntryActionList()
public FlowExecutionExceptionHandlerSet getExceptionHandlerSet()
Exception handlers are invoked when an exception occurs when this state is entered, and can execute custom exception handling logic as well as select an error view to display.
public boolean isStartState()
public final void enter(RequestControlContext context) throws FlowExecutionException
doEnter(RequestControlContext)
hook method, which should be implemented by subclasses, after executing
the entry actions.context
- the control context for the currently executing flow, used by this state to manipulate the flow
executionFlowExecutionException
- if an exception occurs in this statepublic boolean handleException(FlowExecutionException exception, RequestControlContext context)
exception
- the exception that occurredcontext
- the flow execution control context