Class FlowHandlerImpl
- java.lang.Object
-
- jakarta.faces.flow.FlowHandler
-
- com.sun.faces.flow.FlowHandlerImpl
-
public class FlowHandlerImpl extends FlowHandler
-
-
Field Summary
Fields Modifier and Type Field Description static StringABANDONED_FLOWstatic StringFLOW_RETURN_DEPTH_PARAM_NAME-
Fields inherited from class jakarta.faces.flow.FlowHandler
FLOW_ID_REQUEST_PARAM_NAME, NULL_FLOW, TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME
-
-
Constructor Summary
Constructors Constructor Description FlowHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFlow(FacesContext context, Flow toAdd)Add the argumentFlowto the collection ofFlows known to the current application.voidclientWindowTransition(FacesContext context)Allow for flow transitions in the case of components rendered by the renderers from component-familyjakarta.faces.OutcomeTarget.intgetAndClearReturnModeDepth(FacesContext context)FlowgetCurrentFlow(FacesContext context)Map<Object,Object>getCurrentFlowScope()Return theMapthat backs the#{flowScope}Jakarta Expression Language implicit object ornullif no flow is currently active.FlowgetFlow(FacesContext context, String definingDocumentId, String id)Return theFlowwhoseidis equivalent to the argumentid, within the scope of the argumentdefiningDocument.StringgetLastDisplayedViewId(FacesContext context)Return the last displayed viewId for the current flow, as returned byFlowHandler.getCurrentFlow(jakarta.faces.context.FacesContext), ornullif there is no current flow.booleanisActive(FacesContext context, String definingDocumentId, String id)Returntrueif and only if the flow referenced by the argumentdefiningDocumentandidis currently active.voidpopReturnMode(FacesContext context)Enable the correct handling of navigation when processing a return node.voidpushReturnMode(FacesContext context)Enable the correct handling of navigation when processing a return node.voidtransition(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 Detail
-
ABANDONED_FLOW
public static final String ABANDONED_FLOW
- See Also:
- Constant Field Values
-
FLOW_RETURN_DEPTH_PARAM_NAME
public static final String FLOW_RETURN_DEPTH_PARAM_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCurrentFlowScope
public Map<Object,Object> getCurrentFlowScope()
Description copied from class:FlowHandlerReturn the
Mapthat backs the#{flowScope}Jakarta Expression Language implicit object ornullif no flow is currently active.- Specified by:
getCurrentFlowScopein classFlowHandler- Returns:
- the
Mapfor this flow scope.
-
getFlow
public Flow getFlow(FacesContext context, String definingDocumentId, String id)
Description copied from class:FlowHandlerReturn the
Flowwhoseidis equivalent to the argumentid, within the scope of the argumentdefiningDocument.- Specified by:
getFlowin classFlowHandler- Parameters:
context- theFacesContextfor 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
Flowfor the argument identifiers.
-
addFlow
public void addFlow(FacesContext context, Flow toAdd)
Description copied from class:FlowHandlerAdd the argument
Flowto the collection ofFlows known to the current application. The implementation must be thread safe.- Specified by:
addFlowin classFlowHandler- Parameters:
context- theFacesContextfor the current request.toAdd- theFlowto add.
-
isActive
public boolean isActive(FacesContext context, String definingDocumentId, String id)
Description copied from class:FlowHandlerReturn
trueif and only if the flow referenced by the argumentdefiningDocumentandidis currently active.- Specified by:
isActivein classFlowHandler- Parameters:
context- theFacesContextfor 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
public Flow getCurrentFlow(FacesContext context)
Description copied from class:FlowHandlerReturn the currently active
Flowfor the argumentFacesContext, ornullif no flow is active. AFlowmust always be associated with exactly oneClientWindow, but aClientWindowmay have multipleFlows.If
FlowHandler.pushReturnMode(jakarta.faces.context.FacesContext)had been called withtrueas the argument before invoking this method, return the preceding flow on the stack instead of the actual current flow, ornullif there is no preceding flow. Otherwise, return the current flow.- Specified by:
getCurrentFlowin classFlowHandler- Parameters:
context- theFacesContextfor the current request.- Returns:
- the current
Flowornullif no flow is active
-
getLastDisplayedViewId
public String getLastDisplayedViewId(FacesContext context)
Description copied from class:FlowHandlerReturn the last displayed viewId for the current flow, as returned by
FlowHandler.getCurrentFlow(jakarta.faces.context.FacesContext), ornullif there is no current flow.- Specified by:
getLastDisplayedViewIdin classFlowHandler- Parameters:
context- theFacesContextfor the current request.- Returns:
- the last displayed viewId.
-
getAndClearReturnModeDepth
public int getAndClearReturnModeDepth(FacesContext context)
-
pushReturnMode
public void pushReturnMode(FacesContext context)
Description copied from class:FlowHandlerEnable the correct handling of navigation when processing a return node. The default
NavigationHandlerspecification requires calling this method before processing the navigation rules for the flow return, and callingFlowHandler.popReturnMode(jakarta.faces.context.FacesContext), from afinallyblock, immediately afterward.- Specified by:
pushReturnModein classFlowHandler- Parameters:
context- theFacesContextfor the current request.
-
popReturnMode
public void popReturnMode(FacesContext context)
Description copied from class:FlowHandlerEnable the correct handling of navigation when processing a return node. The default
NavigationHandlerspecification requires calling this method from afinallyblock, immediately attempting to process the navigation rules in the context of a flow return.- Specified by:
popReturnModein classFlowHandler- Parameters:
context- theFacesContextfor the current request.
-
transition
public void transition(FacesContext context, Flow sourceFlow, Flow targetFlow, FlowCallNode outboundCallNode, String toViewId)
Description copied from class:FlowHandlerPerform a transition in the flow graph for the current user's
ClientWindow. Obtain references to theFlowinstances corresponding to theoriginanddestinationarguments. If theorigin Flowis equal to thedestination Flow, take no action and returnnull. Otherwise, if theoutboundCallNodeargument is non-nullsave 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
outboundParametersproperty ofoutboundCallNodeis non-nulland not empty, and theinboundParametersproperty of the target flow is non-nulland 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 Flowis a sub-flow of theorigin Flowpush thedestination Flowonto the flow data structure and returnthe destination Flow. Otherwise, pop the currentFlowfrom the flow data structure. If thedestination Flowis non-null, make thedestination Flowthe 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 itssetValuemethod, passing the value from evaluatedParams.- Specified by:
transitionin classFlowHandler- Parameters:
context- theFacesContextfor the current request.sourceFlow- the currentFlow, ornullif there is no source flow.targetFlow- the destinationFlow, ornullif there is no destination flow.outboundCallNode- the flow call node causing this transition, ornullif 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
public void clientWindowTransition(FacesContext context)
Description copied from class:FlowHandlerAllow 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). Anullvalue indicates there is no current flow, which will be the case if this navigation is trying to enter a flow. If flowId is notnulland 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:
clientWindowTransitionin classFlowHandler- Parameters:
context- theFacesContextfor the current request.
-
-