Class FlowHandlerImpl
-
Field Summary
Fields inherited from class jakarta.faces.flow.FlowHandler
FLOW_ID_REQUEST_PARAM_NAME, NULL_FLOW, TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFlow
(FacesContext context, Flow toAdd) Add the argumentFlow
to the collection ofFlow
s known to the current application.void
clientWindowTransition
(FacesContext context) Allow for flow transitions in the case of components rendered by the renderers from component-familyjakarta.faces.OutcomeTarget
.int
getAndClearReturnModeDepth
(FacesContext context) getCurrentFlow
(FacesContext context) Return theMap
that backs the#{flowScope}
Jakarta Expression Language implicit object ornull
if no flow is currently active.getFlow
(FacesContext context, String definingDocumentId, String id) Return theFlow
whoseid
is equivalent to the argumentid
, within the scope of the argumentdefiningDocument
.getLastDisplayedViewId
(FacesContext context) Return the last displayed viewId for the current flow, as returned byFlowHandler.getCurrentFlow(jakarta.faces.context.FacesContext)
, ornull
if there is no current flow.boolean
isActive
(FacesContext context, String definingDocumentId, String id) Returntrue
if and only if the flow referenced by the argumentdefiningDocument
andid
is currently active.void
popReturnMode
(FacesContext context) Enable the correct handling of navigation when processing a return node.void
pushReturnMode
(FacesContext context) Enable the correct handling of navigation when processing a return node.void
transition
(FacesContext context, Flow sourceFlow, Flow targetFlow, FlowCallNode outboundCallNode, String toViewId) Perform a transition in the flow graph for the current user'sClientWindow
.Methods inherited from class jakarta.faces.flow.FlowHandler
getCurrentFlow
-
Field Details
-
ABANDONED_FLOW
- See Also:
-
FLOW_RETURN_DEPTH_PARAM_NAME
- See Also:
-
-
Constructor Details
-
FlowHandlerImpl
public FlowHandlerImpl()
-
-
Method Details
-
getCurrentFlowScope
Description copied from class:FlowHandler
Return the
Map
that backs the#{flowScope}
Jakarta Expression Language implicit object ornull
if no flow is currently active.- Specified by:
getCurrentFlowScope
in classFlowHandler
- Returns:
- the
Map
for this flow scope.
-
getFlow
Description copied from class:FlowHandler
Return the
Flow
whoseid
is equivalent to the argumentid
, within the scope of the argumentdefiningDocument
.- Specified by:
getFlow
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.definingDocumentId
- An application unique identifier for the document in which the returned flow is defined.id
- the id of aFlow
, unique within the scope of thedefiningDocument
.- Returns:
- the
Flow
for the argument identifiers.
-
addFlow
Description copied from class:FlowHandler
Add the argument
Flow
to the collection ofFlow
s known to the current application. The implementation must be thread safe.- Specified by:
addFlow
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.toAdd
- theFlow
to add.
-
isActive
Description copied from class:FlowHandler
Return
true
if and only if the flow referenced by the argumentdefiningDocument
andid
is currently active.- Specified by:
isActive
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.definingDocumentId
- An application unique identifier for the document in which the returned flow is defined.id
- the id of aFlow
, unique within the scope of thedefiningDocument
.- Returns:
- true if and only if the referenced flow is active
-
getCurrentFlow
Description copied from class:FlowHandler
Return the currently active
Flow
for the argumentFacesContext
, ornull
if no flow is active. AFlow
must always be associated with exactly oneClientWindow
, but aClientWindow
may have multipleFlow
s.If
FlowHandler.pushReturnMode(jakarta.faces.context.FacesContext)
had been called withtrue
as the argument before invoking this method, return the preceding flow on the stack instead of the actual current flow, ornull
if there is no preceding flow. Otherwise, return the current flow.- Specified by:
getCurrentFlow
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.- Returns:
- the current
Flow
ornull
if no flow is active
-
getLastDisplayedViewId
Description copied from class:FlowHandler
Return the last displayed viewId for the current flow, as returned by
FlowHandler.getCurrentFlow(jakarta.faces.context.FacesContext)
, ornull
if there is no current flow.- Specified by:
getLastDisplayedViewId
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.- Returns:
- the last displayed viewId.
-
getAndClearReturnModeDepth
-
pushReturnMode
Description copied from class:FlowHandler
Enable the correct handling of navigation when processing a return node. The default
NavigationHandler
specification requires calling this method before processing the navigation rules for the flow return, and callingFlowHandler.popReturnMode(jakarta.faces.context.FacesContext)
, from afinally
block, immediately afterward.- Specified by:
pushReturnMode
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.
-
popReturnMode
Description copied from class:FlowHandler
Enable the correct handling of navigation when processing a return node. The default
NavigationHandler
specification requires calling this method from afinally
block, immediately attempting to process the navigation rules in the context of a flow return.- Specified by:
popReturnMode
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.
-
transition
public void transition(FacesContext context, Flow sourceFlow, Flow targetFlow, FlowCallNode outboundCallNode, String toViewId) Description copied from class:FlowHandler
Perform a transition in the flow graph for the current user's
ClientWindow
. Obtain references to theFlow
instances corresponding to theorigin
anddestination
arguments. If theorigin Flow
is equal to thedestination Flow
, take no action and returnnull
. Otherwise, if theoutboundCallNode
argument is non-null
save aside the outbound parameters. For discussion evaluatedParams is a data structure that stores the evaluated values of any outbound parameters. It is necessary to evaluate these values before popping any flow scopes because the values may refer to scoped instances that need to be passed to the target flow, but will not be available once the new scope is activated. Save aside the outbound parameters using the following algorithm.If the
outboundParameters
property ofoutboundCallNode
is non-null
and not empty, and theinboundParameters
property of the target flow is non-null
and not empty, for each entry in the outbound parameters whose name matches an entry in the inbound parameters, evaluate the value of the parameter, and put the evaluated value into evaluatedParams under the corresponding name. Otherwise, consider evaluatedParams to be empty.If the
destination Flow
is a sub-flow of theorigin Flow
push thedestination Flow
onto the flow data structure and returnthe destination Flow
. Otherwise, pop the currentFlow
from the flow data structure. If thedestination Flow
is non-null
, make thedestination Flow
the current flow, pushing it onto the data structure. If evaluatedParams is not empty, for each entry, find the corresponding parameter in the target flow's inbound parameters and call itssetValue
method, passing the value from evaluatedParams.- Specified by:
transition
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.sourceFlow
- the currentFlow
, ornull
if there is no source flow.targetFlow
- the destinationFlow
, ornull
if there is no destination flow.outboundCallNode
- the flow call node causing this transition, ornull
if this transition is not caused by a flow call.toViewId
- the viewId of the view being displayed as a result of this transition. This parameter makes it possible to implementFlowHandler.getLastDisplayedViewId(jakarta.faces.context.FacesContext)
.
-
clientWindowTransition
Description copied from class:FlowHandler
Allow for flow transitions in the case of components rendered by the renderers from component-family
jakarta.faces.OutcomeTarget
. These transitions must happen at the front of the request processing lifecycle due to the HTTP GET based nature of such components. Therefore, this method is called from the restore view phase of the lifecycle.Let flowId be the value in the request parameter map for the parameter whose name is given by the value of
FlowHandler.FLOW_ID_REQUEST_PARAM_NAME
. Let toFlowDocumentId be the value in the request parameter map for the paramater whose name is given by the value ofFlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME
. If toFlowDocumentId isnull
, take no action and return. Otherwise, let sourceFlow be the return fromFlowHandler.getCurrentFlow(jakarta.faces.context.FacesContext)
. Anull
value indicates there is no current flow, which will be the case if this navigation is trying to enter a flow. If flowId is notnull
and toFlowDocumentId is not equal to the value ofFlowHandler.NULL_FLOW
, let targetFlow be the result of callingFlowHandler.getFlow(jakarta.faces.context.FacesContext, java.lang.String, java.lang.String)
, passing toFlowDocumentId and flowId as the last two arguments, respectively. If the result is non-null
, let flowCallNode be the return from callingFlow.getFlowCall(jakarta.faces.flow.Flow)
on the sourceFlow, passing targetFlow as the argument. Otherwise, targetFlow and flowCallNode must remainnull
, indicating that this is a flow return. CallFacesContext.getViewRoot()
and let toViewId be the the return from callingUIViewRoot.getViewId()
on it.Call,
FlowHandler.transition(jakarta.faces.context.FacesContext, jakarta.faces.flow.Flow, jakarta.faces.flow.Flow, jakarta.faces.flow.FlowCallNode, java.lang.String)
, passing the arguments gathered in the preceding algorithm.- Specified by:
clientWindowTransition
in classFlowHandler
- Parameters:
context
- theFacesContext
for the current request.
-