Class FlowHandlerImpl

java.lang.Object
jakarta.faces.flow.FlowHandler
com.sun.faces.flow.FlowHandlerImpl

public class FlowHandlerImpl extends FlowHandler
  • Field Details

  • Constructor Details

    • FlowHandlerImpl

      public FlowHandlerImpl()
  • Method Details

    • getCurrentFlowScope

      public Map<Object,Object> getCurrentFlowScope()
      Description copied from class: FlowHandler

      Return the Map that backs the #{flowScope} Jakarta Expression Language implicit object or null if no flow is currently active.

      Specified by:
      getCurrentFlowScope in class FlowHandler
      Returns:
      the Map for this flow scope.
    • getFlow

      public Flow getFlow(FacesContext context, String definingDocumentId, String id)
      Description copied from class: FlowHandler

      Return the Flow whose id is equivalent to the argument id, within the scope of the argument definingDocument.

      Specified by:
      getFlow in class FlowHandler
      Parameters:
      context - the FacesContext for the current request.
      definingDocumentId - An application unique identifier for the document in which the returned flow is defined.
      id - the id of a Flow, unique within the scope of the definingDocument.
      Returns:
      the Flow for the argument identifiers.
    • addFlow

      public void addFlow(FacesContext context, Flow toAdd)
      Description copied from class: FlowHandler

      Add the argument Flow to the collection of Flows known to the current application. The implementation must be thread safe.

      Specified by:
      addFlow in class FlowHandler
      Parameters:
      context - the FacesContext for the current request.
      toAdd - the Flow to add.
    • isActive

      public boolean isActive(FacesContext context, String definingDocumentId, String id)
      Description copied from class: FlowHandler

      Return true if and only if the flow referenced by the argument definingDocument and id is currently active.

      Specified by:
      isActive in class FlowHandler
      Parameters:
      context - the FacesContext for the current request.
      definingDocumentId - An application unique identifier for the document in which the returned flow is defined.
      id - the id of a Flow, unique within the scope of the definingDocument.
      Returns:
      true if and only if the referenced flow is active
    • getCurrentFlow

      public Flow getCurrentFlow(FacesContext context)
      Description copied from class: FlowHandler

      Return the currently active Flow for the argument FacesContext, or null if no flow is active. A Flow must always be associated with exactly one ClientWindow, but a ClientWindow may have multiple Flows.

      If FlowHandler.pushReturnMode(jakarta.faces.context.FacesContext) had been called with true as the argument before invoking this method, return the preceding flow on the stack instead of the actual current flow, or null if there is no preceding flow. Otherwise, return the current flow.

      Specified by:
      getCurrentFlow in class FlowHandler
      Parameters:
      context - the FacesContext for the current request.
      Returns:
      the current Flow or null if no flow is active
    • getLastDisplayedViewId

      public String getLastDisplayedViewId(FacesContext context)
      Description copied from class: FlowHandler

      Return the last displayed viewId for the current flow, as returned by FlowHandler.getCurrentFlow(jakarta.faces.context.FacesContext), or null if there is no current flow.

      Specified by:
      getLastDisplayedViewId in class FlowHandler
      Parameters:
      context - the FacesContext for the current request.
      Returns:
      the last displayed viewId.
    • getAndClearReturnModeDepth

      public int getAndClearReturnModeDepth(FacesContext context)
    • pushReturnMode

      public void pushReturnMode(FacesContext context)
      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 calling FlowHandler.popReturnMode(jakarta.faces.context.FacesContext), from a finally block, immediately afterward.

      Specified by:
      pushReturnMode in class FlowHandler
      Parameters:
      context - the FacesContext for the current request.
    • popReturnMode

      public void popReturnMode(FacesContext context)
      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 a finally block, immediately attempting to process the navigation rules in the context of a flow return.

      Specified by:
      popReturnMode in class FlowHandler
      Parameters:
      context - the FacesContext 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 the Flow instances corresponding to the origin and destination arguments. If the origin Flow is equal to the destination Flow, take no action and return null. Otherwise, if the outboundCallNode 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 of outboundCallNode is non-null and not empty, and the inboundParameters 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 the origin Flow push the destination Flow onto the flow data structure and return the destination Flow. Otherwise, pop the current Flow from the flow data structure. If the destination Flow is non-null, make the destination 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 its setValue method, passing the value from evaluatedParams.

      Specified by:
      transition in class FlowHandler
      Parameters:
      context - the FacesContext for the current request.
      sourceFlow - the current Flow, or null if there is no source flow.
      targetFlow - the destination Flow, or null if there is no destination flow.
      outboundCallNode - the flow call node causing this transition, or null 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 implement FlowHandler.getLastDisplayedViewId(jakarta.faces.context.FacesContext).
    • clientWindowTransition

      public void clientWindowTransition(FacesContext context)
      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 of FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME. If toFlowDocumentId is null, take no action and return. Otherwise, let sourceFlow be the return from FlowHandler.getCurrentFlow(jakarta.faces.context.FacesContext). A null value indicates there is no current flow, which will be the case if this navigation is trying to enter a flow. If flowId is not null and toFlowDocumentId is not equal to the value of FlowHandler.NULL_FLOW, let targetFlow be the result of calling FlowHandler.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 calling Flow.getFlowCall(jakarta.faces.flow.Flow) on the sourceFlow, passing targetFlow as the argument. Otherwise, targetFlow and flowCallNode must remain null, indicating that this is a flow return. Call FacesContext.getViewRoot() and let toViewId be the the return from calling UIViewRoot.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 class FlowHandler
      Parameters:
      context - the FacesContext for the current request.