Package javax.faces.flow

Examples of javax.faces.flow.FlowHandler


        // 3) elements specifying only from-action
        // 4) elements where both from-action and from-outcome are null
       
        CaseStruct result = determineViewFromActionOutcome(ctx, caseSet, fromAction, outcome, toFlowDocumentId);
        if (null != result) {
            FlowHandler flowHandler = ctx.getApplication().getFlowHandler();
            if (null != flowHandler) {
                result.currentFlow = flowHandler.getCurrentFlow(ctx);
                result.newFlow = result.currentFlow;
            }
        }

        return result;
View Full Code Here


            if (result != null) {
                break;
            }
        }
        if (null != result) {
            FlowHandler flowHandler = ctx.getApplication().getFlowHandler();
            if (null != flowHandler) {
                result.currentFlow = flowHandler.getCurrentFlow(ctx);
                result.newFlow = result.currentFlow;
            }
        }
       
        return result;
View Full Code Here

        // 4) elements where both from-action and from-outcome are null

        CaseStruct result = determineViewFromActionOutcome(ctx, caseSet, fromAction, outcome, toFlowDocumentId);
       
        if (null != result) {
            FlowHandler flowHandler = ctx.getApplication().getFlowHandler();
            if (null != flowHandler) {
                result.currentFlow = flowHandler.getCurrentFlow(ctx);
                result.newFlow = result.currentFlow;
            }
        }
       
        return result;
View Full Code Here

                viewIdToTest = "/" + viewIdToTest;
            }
        }

        ViewHandler viewHandler = Util.getViewHandler(context);
        FlowHandler flowHandler = context.getApplication().getFlowHandler();
        Flow currentFlow = null;
        Flow newFlow = null;

        if (null != flowHandler) {
           
            currentFlow = flowHandler.getCurrentFlow(context);
            newFlow = currentFlow;
            // If we are in a flow, use the implicit rules to ensure the view
            // is within that flow.  This means viewIdToTest must start with
            // the current flow id
            if (null != currentFlow && null != viewIdToTest &&
View Full Code Here

   
    private CaseStruct findSwitchMatch(FacesContext context, String fromAction,
                                       String outcome, String toFlowDocumentId) {
        CaseStruct result = null;
        NavigationInfo info = getNavigationInfo(context, toFlowDocumentId, fromAction);
        FlowHandler flowHandler = context.getApplication().getFlowHandler();
       
        if (null != flowHandler &&
            null != info && null != info.switches && !info.switches.isEmpty()) {
            SwitchNode switchNode = info.switches.get(outcome);
            if (null != switchNode) {
                List<SwitchCase> cases = switchNode.getCases();
                for (SwitchCase cur : cases) {
                    if (cur.getCondition(context)) {
                        outcome = cur.getFromOutcome();
                        Flow newFlow = flowHandler.getFlow(context, toFlowDocumentId,
                                fromAction);
                        // If this outcome corresponds to an existing flow...
                        if (null != newFlow) {
                            result = synthesizeCaseStruct(context, newFlow, fromAction, outcome);
                        } else {
                            newFlow = flowHandler.getCurrentFlow(context);
                            if (null != newFlow) {
                                result = synthesizeCaseStruct(context, newFlow, fromAction, outcome);
                            }
                        }
                        if (null != result) {
                            break;
                        }
                    }
                }
                if (null == result) {
                    outcome = switchNode.getDefaultOutcome(context);
                    if (null != outcome) {
                        Flow currentFlow = flowHandler.getCurrentFlow(context);
                        if (null != currentFlow) {
                            result = synthesizeCaseStruct(context, currentFlow, fromAction, outcome);
                            if (null != result) {
                                result.currentFlow = currentFlow;
                                result.newFlow = currentFlow;
View Full Code Here

                result.navCase = new MutableNavigationCase(fromAction,
                        fromAction, outcome, null, result.viewId,
                        flow.getDefiningDocumentId(), null, false, false);
            } else if (node instanceof ReturnNode) {
                String fromOutcome = ((ReturnNode)node).getFromOutcome(context);
                FlowHandler flowHandler = context.getApplication().getFlowHandler();
                try {
                    flowHandler.pushReturnMode(context);
                    result = getViewId(context, fromAction, fromOutcome, FlowHandler.NULL_FLOW);
                    // We are in a return node, but no result can be found from that
                    // node.  Show the last displayed viewId from the preceding flow.
                    if (null == result) {
                        Flow precedingFlow = flowHandler.getCurrentFlow(context);
                        if (null != precedingFlow) {
                            String toViewId = flowHandler.getLastDisplayedViewId(context);
                            if (null != toViewId) {
                                result = new CaseStruct();
                                result.viewId = toViewId;
                                result.navCase = new MutableNavigationCase(context.getViewRoot().getViewId(),
                                        fromAction,
                                        outcome,
                                        null,
                                        toViewId,
                                        FlowHandler.NULL_FLOW,                           
                                        null,
                                        false,
                                        false);
                               
                            }
                        }
                    } else {
                        result.newFlow = FlowImpl.SYNTHESIZED_RETURN_CASE_FLOW;
                    }
                }
                finally {
                    flowHandler.popReturnMode(context);
                }
               
            }
        } else {
            // See if there is an implicit match within this flow, using outcome
View Full Code Here

        return result;
    }
   
    private CaseStruct findMethodCallMatch(FacesContext context, String fromAction, String outcome) {
        CaseStruct result = null;
        FlowHandler flowHandler = context.getApplication().getFlowHandler();
        if (null == flowHandler) {
            return null;
        }
        Flow currentFlow = flowHandler.getCurrentFlow(context);
        if (null != currentFlow) {
            FlowNode node = currentFlow.getNode(outcome);
            if (node instanceof MethodCallNode) {
                MethodCallNode methodCallNode = (MethodCallNode) node;
                MethodExpression me = methodCallNode.getMethodExpression();
View Full Code Here

   
    private CaseStruct findFacesFlowCallMatch(FacesContext context,
            String fromAction, String outcome, String toFlowDocumentId) {
        CaseStruct result = null;

        FlowHandler flowHandler = context.getApplication().getFlowHandler();
        if (null == flowHandler) {
            return null;
        }
        Flow currentFlow = flowHandler.getCurrentFlow(context);
        Flow newFlow = null;
        FlowCallNode facesFlowCallNode = null;
        if (null != currentFlow) {
            FlowNode node = currentFlow.getNode(outcome);
            if (node instanceof FlowCallNode) {
                facesFlowCallNode = (FlowCallNode) node;
                String flowId = facesFlowCallNode.getCalledFlowId(context);
                String flowDocumentId = facesFlowCallNode.getCalledFlowDocumentId(context);

                if (null != flowId) {
                    newFlow = flowHandler.getFlow(context, flowDocumentId, flowId);
                    if (null != newFlow) {
                        String startNodeId = newFlow.getStartNodeId();
                        result = synthesizeCaseStruct(context, newFlow, fromAction, startNodeId);
                        if (null == result) {
                            assert(null != currentFlow);
                            // If no CaseStruct can be synthesized, we must execute the
                            // navigation handler algorithm to try to find the CaseStruct
                            // for the start node.  However, in order to do that, we
                            // must enter the new flow.  To preserve the intergity
                            // of the state machine, we enter the flow now, and mark
                            // that we must not enter it later.
                            try {
                                setDidTransition(context, true);
                                flowHandler.transition(context, currentFlow, newFlow, null, startNodeId);
                                result = getViewId(context, fromAction, startNodeId, toFlowDocumentId);
                            }
                            finally {
                                if (null == result) {
                                    // If we did not find a CaseStruct, preserve the
                                    // integrity of the state machine by transitioning
                                    // out of the flow.
                                    flowHandler.transition(context, newFlow, currentFlow, null, outcome);
                                    setDidTransition(context, false);
                                }
                            }
                        }
                    }
                }
            }
        } else {
            // See if we are trying to enter a flow.
            newFlow = flowHandler.getFlow(context, toFlowDocumentId, outcome);
            if (null != newFlow) {
                String startNodeId = newFlow.getStartNodeId();
                result = synthesizeCaseStruct(context, newFlow, fromAction, startNodeId);
                if (null == result) {
                    assert(null == currentFlow);
                    // If no CaseStruct can be synthesized, we must execute the
                    // navigation handler algorithm to try to find the CaseStruct
                    // for the start node.  However, in order to do that, we
                    // must enter the new flow.  To preserve the intergity
                    // of the state machine, we enter the flow now, and mark
                    // that we must not enter it later.
                    try {
                        setDidTransition(context, true);
                        flowHandler.transition(context, null, newFlow, null, startNodeId);
                        result = getViewId(context, fromAction, startNodeId, toFlowDocumentId);
                    }
                    finally {
                        if (null == result) {
                            // If we did not find a CaseStruct, preserve the
                            // integrity of the state machine by transitioning
                            // out of the flow.
                            flowHandler.transition(context, newFlow, null, null, outcome);
                            setDidTransition(context, false);
                        }
                    }
                } else if (!outcome.equals(startNodeId) && null != result.navCase) {
                    ((MutableNavigationCase)result.navCase).setFromOutcome(outcome);
View Full Code Here

   
    private CaseStruct findViewNodeMatch(FacesContext context,
            String fromAction, String outcome, String toFlowDocumentId) {
        CaseStruct result = null;

        FlowHandler flowHandler = context.getApplication().getFlowHandler();
        if (null == flowHandler) {
            return null;
        }
        Flow currentFlow = flowHandler.getCurrentFlow(context);
        if (null != currentFlow) {
            FlowNode node = currentFlow.getNode(outcome);
            if (null != node) {
                if (node instanceof ViewNode) {
                    result = synthesizeCaseStruct(context, currentFlow, fromAction, outcome);
View Full Code Here

        }
       
        //JSF 2.2 set FlowHandler from factory.
        FlowHandlerFactory flowHandlerFactory = (FlowHandlerFactory)
            FactoryFinder.getFactory(FactoryFinder.FLOW_HANDLER_FACTORY);
        FlowHandler flowHandler = flowHandlerFactory.createFlowHandler(
            FacesContext.getCurrentInstance());
        application.setFlowHandler(flowHandler);

        if (MyfacesConfig.getCurrentInstance(_externalContext).isSupportJSPAndFacesEL())
        {
View Full Code Here

TOP

Related Classes of javax.faces.flow.FlowHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.