Interface RequestControlContext
- All Superinterfaces:
RequestContext
- All Known Implementing Classes:
MockRequestControlContext
Mutable control interface used to manipulate an ongoing flow execution in the context of one client request.
Primarily used internally by the various flow artifacts when they are invoked.
This interface acts as a facade for core definition constructs such as the central Flow
and
State
classes, abstracting away details about the runtime execution machine.
Note this type is not the same as the FlowExecutionContext
. Objects of this type are request specific:
they provide a control interface for manipulating exactly one flow execution locally from exactly one request. A
FlowExecutionContext
provides information about a single flow execution (conversation), and it's scope
is not local to a specific request (or thread).
- Author:
- Keith Donald, Erwin Vervaet
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAssign the ongoing flow execution its flow execution key.void
endActiveFlowSession
(String outcome, MutableAttributeMap<Object> output) End the active flow session of the current flow execution.boolean
execute
(Transition transition) Execute this transition out of the current source state.boolean
Returns true if the flow current flow execution was launched in embedded page mode.boolean
Returns the value of the 'redirect in same state' flow execution attribute if set or otherwise it falls back on the value returned bygetRedirectOnPause()
.boolean
Returns true if the 'redirect on pause' flow execution attribute is set to true, false otherwise.boolean
handleEvent
(Event event) Signals the occurrence of an event in the current state of this flow execution request context.void
Remove all flow execution snapshots associated with the ongoing conversation.void
Remove the current flow execution snapshot to invalidate the current state.void
setCurrentState
(State state) Record the current state that has entered in the executing flow.void
setCurrentTransition
(Transition transition) Record the transition executing in the flow.void
setCurrentView
(View view) Sets the current view.void
start
(Flow flow, MutableAttributeMap<?> input) Spawn a new flow session and activate it in the currently executing flow.void
Update the current flow execution snapshot to save the current state.void
viewRendered
(View view) Called when the current view has completed rendering in the current view state.void
viewRendering
(View view) Called when the current view is about to be rendered in the current view state.Methods inherited from interface org.springframework.webflow.execution.RequestContext
getActiveFlow, getAttributes, getConversationScope, getCurrentEvent, getCurrentState, getCurrentTransition, getCurrentView, getExternalContext, getFlashScope, getFlowExecutionContext, getFlowExecutionUrl, getFlowScope, getMatchingTransition, getMessageContext, getRequestParameters, getRequestScope, getViewScope, inViewState
-
Method Details
-
setCurrentState
Record the current state that has entered in the executing flow. This method will be called as part of entering a new state by the State type itself.- Parameters:
state
- the current state- See Also:
-
assignFlowExecutionKey
FlowExecutionKey assignFlowExecutionKey()Assign the ongoing flow execution its flow execution key. This method will be called before a state is about to render a view and pause the flow execution. -
setCurrentView
Sets the current view.- Parameters:
view
- the current view, or null to mark the current view asnull
-
viewRendering
Called when the current view is about to be rendered in the current view state.- Parameters:
view
- the view to be rendered
-
viewRendered
Called when the current view has completed rendering in the current view state.- Parameters:
view
- the view that rendered
-
handleEvent
Signals the occurrence of an event in the current state of this flow execution request context. This method should be called by clients that report internal event occurrences, such as action states. TheonEvent()
method of the flow involved in the flow execution will be called.- Parameters:
event
- the event that occurred- Returns:
- a boolean indicating if handling this event caused the current state to exit and a new state to enter
- Throws:
FlowExecutionException
- if an exception was thrown within a state of the flow during execution of this signalEvent operation- See Also:
-
execute
Execute this transition out of the current source state. Allows for privileged execution of an arbitrary transition.- Parameters:
transition
- the transition- See Also:
-
setCurrentTransition
Record the transition executing in the flow. This method will be called as part of executing a transition from one state to another.- Parameters:
transition
- the transition being executed- See Also:
-
updateCurrentFlowExecutionSnapshot
void updateCurrentFlowExecutionSnapshot()Update the current flow execution snapshot to save the current state. -
removeCurrentFlowExecutionSnapshot
void removeCurrentFlowExecutionSnapshot()Remove the current flow execution snapshot to invalidate the current state. -
removeAllFlowExecutionSnapshots
void removeAllFlowExecutionSnapshots()Remove all flow execution snapshots associated with the ongoing conversation. Invalidates previous states. -
start
Spawn a new flow session and activate it in the currently executing flow. Also transitions the spawned flow to its start state. This method should be called by clients that wish to spawn new flows, such as subflow states.This will start a new flow session in the current flow execution, which is already active.
- Parameters:
flow
- the flow to start, itsstart()
method will be calledinput
- initial contents of the newly created flow session (may benull
, e.g. empty)- Throws:
FlowExecutionException
- if an exception was thrown within a state of the flow during execution of this start operation- See Also:
-
endActiveFlowSession
void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output) throws IllegalStateException End the active flow session of the current flow execution. This method should be called by clients that terminate flows, such as end states. Theend()
method of the flow involved in the flow execution will be called.- Parameters:
outcome
- the logical outcome the ending session should returnoutput
- output the ending session should return- Throws:
IllegalStateException
- when the flow execution is not active- See Also:
-
getRedirectOnPause
boolean getRedirectOnPause()Returns true if the 'redirect on pause' flow execution attribute is set to true, false otherwise.- Returns:
- true or false
-
getRedirectInSameState
boolean getRedirectInSameState()Returns the value of the 'redirect in same state' flow execution attribute if set or otherwise it falls back on the value returned bygetRedirectOnPause()
.- Returns:
- true or false
-
getEmbeddedMode
boolean getEmbeddedMode()Returns true if the flow current flow execution was launched in embedded page mode. When a flow is embedded on a page it can make different assumptions with regards to whether redirect after post is necessary.
-