FlowHandler is the main entry point that enables the runtime to
interact with the faces flows feature. jakarta.faces.application.NavigationHandler uses this class when it
needs to make navigational decisions related to flows. The faces flow feature entirely depends on the
jakarta.faces.lifecycle.ClientWindow feature and also on CDI.
Defining Flows
The implementation must support defining faces flows using the <flow-definition> element as
specified in the Application Configuration Resources XML Schema Definition, or by using the
jakarta.faces.flow.builder.FlowBuilder API. Additional means of defining flows may be provided by decorating
the FlowHandlerFactory.
Managing Flows
The singleton instance of this class must be thread safe, and therefore must not store any per-user state. Flows are, however, traversed in a per-user manner, and must be associated with the current
jakarta.faces.lifecycle.ClientWindow. Furthermore, Flows may be nested. These requirements strongly suggest managing the flows with a stack-like runtime data structure, stored in a per-user fashion and associated with theClientWindow. Because Flow instances are immutable, yet the flow stack is per-user, implementations must make allowance for flow scoped data (managed beans declared to beFlowScopedand data stored in theMapreturned bygetCurrentFlowScope) to be fully re-entrant. For example, consider an application with two flows, A and B, each with a singleFlowScopedbeanMyBeanAandMyBeanB, respectively. Entry into flow A causesMyBeanAto become active. Calling from A into B causesMyBeanBto become active. Calling back into A causes a new instance ofMyBeanAto become active, rather than reactivating the earlier instance ofMyBeanA.The Flow Graph
Prior versions of the specification defined a flow graph but the only kind of node in the graph was a VDL view. The Faces Flow feature currently defines the following node types.
View
This is the regular Jakarta Faces VDL View that has been in the specification since the beginning.
Switch
This is a list of Jakarta Expression Language expressions. When control is passed to a switch node, each expression in the list is evaluated and the first one that returns
trueis used to define the id of the next node to which control must be passed. If none of the expressions evaluates totrue, control passes to the specified default id.Return
This node type specifies an outcome that is returned to the calling flow.
Method Call
This node type allows invocation of arbitrary application logic at any point in the executiong of the flow. An outcome can be specified that will cause a navigation case to be navigated to after the method has been invoked.
Faces Flow Call
This node type allows one flow to call another flow. The calling flow remains active and is not exited until control returns from the called flow.
Edges in the graph are defined by the existing Jakarta Faces navigation rule system.
Flows and Model Objects
Managed beans annotated with the CDI annotation
FlowScopedare created lazily, when referenced, after a user agent's entry into the named scope, and must be made available for garbage collection when the user agent leaves the flow.The
flowScopeJakarta Expression Language implicit object is also available to store values in the "current" slope. Values stored in this scope must be made available for garbage collection when the user agent leaves the flow.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | FLOW_ID_REQUEST_PARAM_NAME
Components that are rendered by |
| public static final String | NULL_FLOW
Components that are rendered by |
| public static final String | TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME
Components that are rendered by |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | addFlow(FacesContext
the context, Flow FacesContext for the current request.the toAdd)Flow to add.
Add the argument |
| public abstract void | clientWindowTransition(FacesContext
the context)FacesContext for the current request.
Allow for flow transitions in the case of components rendered by the renderers from component-family
|
| public abstract Flow | Returns: the currentFlow or null if no flow is activethe context)FacesContext for the current request.
Return the currently active |
| public Flow | Returns: the currentFlow or null if no flow is active
Convenience overload that calls |
| public abstract Map | Returns: theMap for this flow scope.
Return the |
| public abstract Flow | Returns: theFlow for the argument identifiers.the context, String FacesContext for the current request.An application unique identifier for the document in which the returned flow is defined. definingDocumentId, String the id of a id)Flow, unique within the scope of the definingDocument.
Return the |
| public abstract String | Returns: the last displayed viewId.the context)FacesContext for the current request.
Return the last displayed viewId for the current flow, as returned by
|
| public abstract boolean | Returns: true if and only if the referenced flow is activethe context, String FacesContext for the current request.An application unique identifier for the document in which the returned flow is defined. definingDocument, String the id of a id)Flow, unique within the scope of the definingDocument.
Return |
| public abstract void | popReturnMode(FacesContext
the context)FacesContext for the current request.Enable the correct handling of navigation when processing a return node. |
| public abstract void | pushReturnMode(FacesContext
the context)FacesContext for the current request.Enable the correct handling of navigation when processing a return node. |
| public abstract void | transition(FacesContext
the context, Flow FacesContext for the current request.the current sourceFlow, Flow Flow, or null if there is no source flow.the destination targetFlow, FlowCallNode Flow, or null if there is no destination flow.the flow call node causing this transition, or outboundCallNode, String null if this transition is not caused
by a flow call.the viewId of the view being displayed as a result of this transition. This parameter makes it
possible to implement toViewId)getLastDisplayedViewId.
Perform a transition in the flow graph for the current user's |
| FLOW_ID_REQUEST_PARAM_NAME | back to summary |
|---|---|
| public static final String FLOW_ID_REQUEST_PARAM_NAME
Components that are rendered by
| |
| NULL_FLOW | back to summary |
|---|---|
| public static final String NULL_FLOW
Components that are rendered by
| |
| TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME | back to summary |
|---|---|
| public static final String TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME
Components that are rendered by
| |
| FlowHandler | back to summary |
|---|---|
| public FlowHandler() | |
| addFlow | back to summary |
|---|---|
| public abstract void addFlow(FacesContext context, Flow toAdd)
Add the argument
| |
| clientWindowTransition | back to summary |
|---|---|
| public abstract void clientWindowTransition(FacesContext context)
Allow for flow transitions in the case of components rendered by the renderers from component-family
Let flowId be the value in the request parameter map for the parameter whose name is given by the value of
Call,
| |
| getCurrentFlow | back to summary |
|---|---|
| public abstract Flow getCurrentFlow(FacesContext context)
Return the currently active
If
| |
| getCurrentFlow | back to summary |
|---|---|
| public Flow getCurrentFlow()
Convenience overload that calls
| |
| getCurrentFlowScope | back to summary |
|---|---|
| public abstract Map
Return the | |
| getFlow | back to summary |
|---|---|
| public abstract Flow getFlow(FacesContext context, String definingDocumentId, String id)
Return the
| |
| getLastDisplayedViewId | back to summary |
|---|---|
| public abstract String getLastDisplayedViewId(FacesContext context)
Return the last displayed viewId for the current flow, as returned by
| |
| isActive | back to summary |
|---|---|
| public abstract boolean isActive(FacesContext context, String definingDocument, String id)
Return
| |
| popReturnMode | back to summary |
|---|---|
| public abstract void popReturnMode(FacesContext context)
Enable the correct handling of navigation when processing a return node. The default
| |
| pushReturnMode | back to summary |
|---|---|
| public abstract void pushReturnMode(FacesContext context)
Enable the correct handling of navigation when processing a return node. The default
| |
| transition | back to summary |
|---|---|
| public abstract void transition(FacesContext context, Flow sourceFlow, Flow targetFlow, FlowCallNode outboundCallNode, String toViewId)
Perform a transition in the flow graph for the current user's
If the
| |