Package org.apache.myfaces.flow

Examples of org.apache.myfaces.flow.FlowImpl


            FacesConfigurator.enableDefaultWindowMode(facesContext);
        }
       
        for (FacesFlowDefinition flowDefinition : dispenser.getFacesFlowDefinitions())
        {
            FlowImpl flow = new FlowImpl();
           
            // TODO: configure flow object
            flow.setId(flowDefinition.getId());
            flow.setDefiningDocumentId(flowDefinition.getDefiningDocumentId());
           
            flow.setStartNodeId(flowDefinition.getStartNode());
           
            if (!isEmptyString(flowDefinition.getInitializer()))
            {
                flow.setInitializer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getInitializer(), null, NO_PARAMETER_TYPES));
            }
            if (!isEmptyString(flowDefinition.getFinalizer()))
            {
                flow.setFinalizer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getFinalizer(), null, NO_PARAMETER_TYPES));
            }
           
            for (FacesFlowCall call : flowDefinition.getFlowCallList())
            {
                FlowCallNodeImpl node = new FlowCallNodeImpl(call.getId());
                if (call.getFlowReference() != null)
                {
                    node.setCalledFlowId(call.getFlowReference().getFlowId());
                    node.setCalledFlowDocumentId(call.getFlowReference().getFlowDocumentId());
                }

                for (FacesFlowParameter parameter : call.getOutboundParameterList())
                {
                    node.putOutboundParameter( parameter.getName(),
                        new ParameterImpl(parameter.getName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.putFlowCall(node.getId(), node);
            }

            for (FacesFlowMethodCall methodCall : flowDefinition.getMethodCallList())
            {
                MethodCallNodeImpl node = new MethodCallNodeImpl(methodCall.getId());
                if (!isEmptyString(methodCall.getMethod()))
                {
                    node.setMethodExpression(
                        application.getExpressionFactory().createMethodExpression(
                            facesContext.getELContext(), methodCall.getMethod(), null, NO_PARAMETER_TYPES));
                }
                if (!isEmptyString(methodCall.getDefaultOutcome()))
                {
                    node.setOutcome(
                        application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), methodCall.getDefaultOutcome(), Object.class));
                }
                for (FacesFlowMethodParameter parameter : methodCall.getParameterList())
                {
                    node.addParameter(
                        new ParameterImpl(parameter.getClassName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.addMethodCall(node);
            }
           
            for (FacesFlowParameter parameter : flowDefinition.getInboundParameterList())
            {
                flow.putInboundParameter(parameter.getName(),
                    new ParameterImpl(parameter.getName(),
                    application.getExpressionFactory().createValueExpression(
                        facesContext.getELContext(), parameter.getValue(), Object.class)) );
            }
           
            for (NavigationRule rule : flowDefinition.getNavigationRuleList())
            {
                flow.addNavigationCases(rule.getFromViewId(), NavigationUtils.convertNavigationCasesToAPI(rule));
            }
           
            for (FacesFlowSwitch flowSwitch : flowDefinition.getSwitchList())
            {
                SwitchNodeImpl node = new SwitchNodeImpl(flowSwitch.getId());
               
                if (flowSwitch.getDefaultOutcome() != null &&
                    !isEmptyString(flowSwitch.getDefaultOutcome().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowSwitch.getDefaultOutcome().getFromOutcome()))
                    {
                        node.setDefaultOutcome(flowSwitch.getDefaultOutcome().getFromOutcome());
                    }
                    else
                    {
                        node.setDefaultOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowSwitch.getDefaultOutcome().getFromOutcome(),
                                Object.class));
                    }
                }
               
                for (NavigationCase navCase : flowSwitch.getNavigationCaseList())
                {
                    SwitchCaseImpl nodeCase = new SwitchCaseImpl();
                    nodeCase.setFromOutcome(navCase.getFromOutcome());
                    if (!isEmptyString(navCase.getIf()))
                    {
                        nodeCase.setCondition(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), navCase.getIf(),
                                Object.class));
                    }
                    node.addCase(nodeCase);
                }
               
                flow.putSwitch(node.getId(), node);
            }
           
            for (FacesFlowView view : flowDefinition.getViewList())
            {
                ViewNodeImpl node = new ViewNodeImpl(view.getId(), view.getVdlDocument());
                flow.addView(node);
            }

            for (FacesFlowReturn flowReturn : flowDefinition.getReturnList())
            {
                ReturnNodeImpl node = new ReturnNodeImpl(flowReturn.getId());
                if (flowReturn.getNavigationCase() != null &&
                    !isEmptyString(flowReturn.getNavigationCase().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowReturn.getNavigationCase().getFromOutcome()))
                    {
                        node.setFromOutcome(flowReturn.getNavigationCase().getFromOutcome());
                    }
                    else
                    {
                        node.setFromOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowReturn.getNavigationCase().getFromOutcome(),
                                Object.class));
                    }
                }
                flow.putReturn(node.getId(), node);
            }
           
            flow.freeze();
           
            // Add the flow, so the config can be processed by the flow system and the
            // navigation system.
            application.getFlowHandler().addFlow(facesContext, flow);
        }
View Full Code Here


            FacesConfigurator.enableDefaultWindowMode(facesContext);
        }
       
        for (FacesFlowDefinition flowDefinition : dispenser.getFacesFlowDefinitions())
        {
            FlowImpl flow = new FlowImpl();
           
            // TODO: configure flow object
            flow.setId(flowDefinition.getId());
            flow.setDefiningDocumentId(flowDefinition.getDefiningDocumentId());
           
            flow.setStartNodeId(flowDefinition.getStartNode());
           
            if (!isEmptyString(flowDefinition.getInitializer()))
            {
                flow.setInitializer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getInitializer(), null, NO_PARAMETER_TYPES));
            }
            if (!isEmptyString(flowDefinition.getFinalizer()))
            {
                flow.setFinalizer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getFinalizer(), null, NO_PARAMETER_TYPES));
            }
           
            for (FacesFlowCall call : flowDefinition.getFlowCallList())
            {
                FlowCallNodeImpl node = new FlowCallNodeImpl(call.getId());
                if (call.getFlowReference() != null)
                {
                    node.setCalledFlowId(call.getFlowReference().getFlowId());
                    node.setCalledFlowDocumentId(call.getFlowReference().getFlowDocumentId());
                }

                for (FacesFlowParameter parameter : call.getOutboundParameterList())
                {
                    node.putOutboundParameter( parameter.getName(),
                        new ParameterImpl(parameter.getName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.putFlowCall(node.getId(), node);
            }

            for (FacesFlowMethodCall methodCall : flowDefinition.getMethodCallList())
            {
                MethodCallNodeImpl node = new MethodCallNodeImpl(methodCall.getId());
                if (!isEmptyString(methodCall.getMethod()))
                {
                    node.setMethodExpression(
                        application.getExpressionFactory().createMethodExpression(
                            facesContext.getELContext(), methodCall.getMethod(), null, NO_PARAMETER_TYPES));
                }
                if (!isEmptyString(methodCall.getDefaultOutcome()))
                {
                    node.setOutcome(
                        application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), methodCall.getDefaultOutcome(), Object.class));
                }
                for (FacesFlowMethodParameter parameter : methodCall.getParameterList())
                {
                    node.addParameter(
                        new ParameterImpl(parameter.getClassName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.addMethodCall(node);
            }
           
            for (FacesFlowParameter parameter : flowDefinition.getInboundParameterList())
            {
                flow.putInboundParameter(parameter.getName(),
                    new ParameterImpl(parameter.getName(),
                    application.getExpressionFactory().createValueExpression(
                        facesContext.getELContext(), parameter.getValue(), Object.class)) );
            }
           
            for (NavigationRule rule : flowDefinition.getNavigationRuleList())
            {
                flow.addNavigationCases(rule.getFromViewId(), NavigationUtils.convertNavigationCasesToAPI(rule));
            }
           
            for (FacesFlowSwitch flowSwitch : flowDefinition.getSwitchList())
            {
                SwitchNodeImpl node = new SwitchNodeImpl(flowSwitch.getId());
               
                if (flowSwitch.getDefaultOutcome() != null &&
                    !isEmptyString(flowSwitch.getDefaultOutcome().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowSwitch.getDefaultOutcome().getFromOutcome()))
                    {
                        node.setDefaultOutcome(flowSwitch.getDefaultOutcome().getFromOutcome());
                    }
                    else
                    {
                        node.setDefaultOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowSwitch.getDefaultOutcome().getFromOutcome(),
                                Object.class));
                    }
                }
               
                for (NavigationCase navCase : flowSwitch.getNavigationCaseList())
                {
                    SwitchCaseImpl nodeCase = new SwitchCaseImpl();
                    nodeCase.setFromOutcome(navCase.getFromOutcome());
                    if (!isEmptyString(navCase.getIf()))
                    {
                        nodeCase.setCondition(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), navCase.getIf(),
                                Object.class));
                    }
                    node.addCase(nodeCase);
                }
               
                flow.putSwitch(node.getId(), node);
            }
           
            for (FacesFlowView view : flowDefinition.getViewList())
            {
                ViewNodeImpl node = new ViewNodeImpl(view.getId(), view.getVdlDocument());
                flow.addView(node);
            }

            for (FacesFlowReturn flowReturn : flowDefinition.getReturnList())
            {
                ReturnNodeImpl node = new ReturnNodeImpl(flowReturn.getId());
                if (flowReturn.getNavigationCase() != null &&
                    !isEmptyString(flowReturn.getNavigationCase().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowReturn.getNavigationCase().getFromOutcome()))
                    {
                        node.setFromOutcome(flowReturn.getNavigationCase().getFromOutcome());
                    }
                    else
                    {
                        node.setFromOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowReturn.getNavigationCase().getFromOutcome(),
                                Object.class));
                    }
                }
                flow.putReturn(node.getId(), node);
            }
           
            flow.freeze();
           
            // Add the flow, so the config can be processed by the flow system and the
            // navigation system.
            application.getFlowHandler().addFlow(facesContext, flow);
        }
View Full Code Here

            FacesConfigurator.enableDefaultWindowMode(facesContext);
        }
       
        for (FacesFlowDefinition flowDefinition : dispenser.getFacesFlowDefinitions())
        {
            FlowImpl flow = new FlowImpl();
           
            // TODO: configure flow object
            flow.setId(flowDefinition.getId());
            flow.setDefiningDocumentId(flowDefinition.getDefiningDocumentId());
           
            flow.setStartNodeId(flowDefinition.getStartNode());
           
            if (!isEmptyString(flowDefinition.getInitializer()))
            {
                flow.setInitializer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getInitializer(), null, NO_PARAMETER_TYPES));
            }
            if (!isEmptyString(flowDefinition.getFinalizer()))
            {
                flow.setFinalizer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getFinalizer(), null, NO_PARAMETER_TYPES));
            }
           
            for (FacesFlowCall call : flowDefinition.getFlowCallList())
            {
                FlowCallNodeImpl node = new FlowCallNodeImpl(call.getId());
                if (call.getFlowReference() != null)
                {
                    node.setCalledFlowId(call.getFlowReference().getFlowId());
                    node.setCalledFlowDocumentId(call.getFlowReference().getFlowDocumentId());
                }

                for (FacesFlowParameter parameter : call.getOutboundParameterList())
                {
                    node.putOutboundParameter( parameter.getName(),
                        new ParameterImpl(parameter.getName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.putFlowCall(node.getId(), node);
            }

            for (FacesFlowMethodCall methodCall : flowDefinition.getMethodCallList())
            {
                MethodCallNodeImpl node = new MethodCallNodeImpl(methodCall.getId());
                if (!isEmptyString(methodCall.getMethod()))
                {
                    node.setMethodExpression(
                        application.getExpressionFactory().createMethodExpression(
                            facesContext.getELContext(), methodCall.getMethod(), null, NO_PARAMETER_TYPES));
                }
                if (!isEmptyString(methodCall.getDefaultOutcome()))
                {
                    node.setOutcome(
                        application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), methodCall.getDefaultOutcome(), Object.class));
                }
                for (FacesFlowMethodParameter parameter : methodCall.getParameterList())
                {
                    node.addParameter(
                        new ParameterImpl(parameter.getClassName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.addMethodCall(node);
            }
           
            for (FacesFlowParameter parameter : flowDefinition.getInboundParameterList())
            {
                flow.putInboundParameter(parameter.getName(),
                    new ParameterImpl(parameter.getName(),
                    application.getExpressionFactory().createValueExpression(
                        facesContext.getELContext(), parameter.getValue(), Object.class)) );
            }
           
            for (NavigationRule rule : flowDefinition.getNavigationRuleList())
            {
                flow.addNavigationCases(rule.getFromViewId(), NavigationUtils.convertNavigationCasesToAPI(rule));
            }
           
            for (FacesFlowSwitch flowSwitch : flowDefinition.getSwitchList())
            {
                SwitchNodeImpl node = new SwitchNodeImpl(flowSwitch.getId());
               
                if (flowSwitch.getDefaultOutcome() != null &&
                    !isEmptyString(flowSwitch.getDefaultOutcome().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowSwitch.getDefaultOutcome().getFromOutcome()))
                    {
                        node.setDefaultOutcome(flowSwitch.getDefaultOutcome().getFromOutcome());
                    }
                    else
                    {
                        node.setDefaultOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowSwitch.getDefaultOutcome().getFromOutcome(),
                                Object.class));
                    }
                }
               
                for (NavigationCase navCase : flowSwitch.getNavigationCaseList())
                {
                    SwitchCaseImpl nodeCase = new SwitchCaseImpl();
                    nodeCase.setFromOutcome(navCase.getFromOutcome());
                    if (!isEmptyString(navCase.getIf()))
                    {
                        nodeCase.setCondition(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), navCase.getIf(),
                                Object.class));
                    }
                    node.addCase(nodeCase);
                }
               
                flow.putSwitch(node.getId(), node);
            }
           
            for (FacesFlowView view : flowDefinition.getViewList())
            {
                ViewNodeImpl node = new ViewNodeImpl(view.getId(), view.getVdlDocument());
                flow.addView(node);
            }

            for (FacesFlowReturn flowReturn : flowDefinition.getReturnList())
            {
                ReturnNodeImpl node = new ReturnNodeImpl(flowReturn.getId());
                if (flowReturn.getNavigationCase() != null &&
                    !isEmptyString(flowReturn.getNavigationCase().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowReturn.getNavigationCase().getFromOutcome()))
                    {
                        node.setFromOutcome(flowReturn.getNavigationCase().getFromOutcome());
                    }
                    else
                    {
                        node.setFromOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowReturn.getNavigationCase().getFromOutcome(),
                                Object.class));
                    }
                }
                flow.putReturn(node.getId(), node);
            }
           
            flow.freeze();
           
            // Add the flow, so the config can be processed by the flow system and the
            // navigation system.
            application.getFlowHandler().addFlow(facesContext, flow);
        }
View Full Code Here

    private FlowImpl _facesFlow;
    private FacesContext _facesContext;

    public FlowBuilderImpl()
    {
        _facesFlow = new FlowImpl();
    }
View Full Code Here

            FacesConfigurator.enableDefaultWindowMode(facesContext);
        }
       
        for (FacesFlowDefinition flowDefinition : dispenser.getFacesFlowDefinitions())
        {
            FlowImpl flow = new FlowImpl();
           
            // TODO: configure flow object
            flow.setId(flowDefinition.getId());
            flow.setDefiningDocumentId(flowDefinition.getDefiningDocumentId());
           
            flow.setStartNodeId(flowDefinition.getStartNode());
           
            if (!isEmptyString(flowDefinition.getInitializer()))
            {
                flow.setInitializer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getInitializer(), null, NO_PARAMETER_TYPES));
            }
            if (!isEmptyString(flowDefinition.getFinalizer()))
            {
                flow.setFinalizer(application.getExpressionFactory().createMethodExpression(
                    facesContext.getELContext(), flowDefinition.getFinalizer(), null, NO_PARAMETER_TYPES));
            }
           
            for (FacesFlowCall call : flowDefinition.getFlowCallList())
            {
                FlowCallNodeImpl node = new FlowCallNodeImpl(call.getId());
                if (call.getFlowReference() != null)
                {
                    node.setCalledFlowId(call.getFlowReference().getFlowId());
                    node.setCalledFlowDocumentId(call.getFlowReference().getFlowDocumentId());
                }

                for (FacesFlowParameter parameter : call.getOutboundParameterList())
                {
                    node.putOutboundParameter( parameter.getName(),
                        new ParameterImpl(parameter.getName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.putFlowCall(node.getId(), node);
            }

            for (FacesFlowMethodCall methodCall : flowDefinition.getMethodCallList())
            {
                MethodCallNodeImpl node = new MethodCallNodeImpl(methodCall.getId());
                if (!isEmptyString(methodCall.getMethod()))
                {
                    node.setMethodExpression(
                        application.getExpressionFactory().createMethodExpression(
                            facesContext.getELContext(), methodCall.getMethod(), null, NO_PARAMETER_TYPES));
                }
                if (!isEmptyString(methodCall.getDefaultOutcome()))
                {
                    node.setOutcome(
                        application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), methodCall.getDefaultOutcome(), Object.class));
                }
                for (FacesFlowMethodParameter parameter : methodCall.getParameterList())
                {
                    node.addParameter(
                        new ParameterImpl(parameter.getClassName(),
                        application.getExpressionFactory().createValueExpression(
                            facesContext.getELContext(), parameter.getValue(), Object.class)) );
                }
                flow.addMethodCall(node);
            }
           
            for (FacesFlowParameter parameter : flowDefinition.getInboundParameterList())
            {
                flow.putInboundParameter(parameter.getName(),
                    new ParameterImpl(parameter.getName(),
                    application.getExpressionFactory().createValueExpression(
                        facesContext.getELContext(), parameter.getValue(), Object.class)) );
            }
           
            for (NavigationRule rule : flowDefinition.getNavigationRuleList())
            {
                flow.addNavigationCases(rule.getFromViewId(), NavigationUtils.convertNavigationCasesToAPI(rule));
            }
           
            for (FacesFlowSwitch flowSwitch : flowDefinition.getSwitchList())
            {
                SwitchNodeImpl node = new SwitchNodeImpl(flowSwitch.getId());
               
                if (flowSwitch.getDefaultOutcome() != null &&
                    !isEmptyString(flowSwitch.getDefaultOutcome().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowSwitch.getDefaultOutcome().getFromOutcome()))
                    {
                        node.setDefaultOutcome(flowSwitch.getDefaultOutcome().getFromOutcome());
                    }
                    else
                    {
                        node.setDefaultOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowSwitch.getDefaultOutcome().getFromOutcome(),
                                Object.class));
                    }
                }
               
                for (NavigationCase navCase : flowSwitch.getNavigationCaseList())
                {
                    SwitchCaseImpl nodeCase = new SwitchCaseImpl();
                    nodeCase.setFromOutcome(navCase.getFromOutcome());
                    if (!isEmptyString(navCase.getIf()))
                    {
                        nodeCase.setCondition(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), navCase.getIf(),
                                Object.class));
                    }
                    node.addCase(nodeCase);
                }
               
                flow.putSwitch(node.getId(), node);
            }
           
            for (FacesFlowView view : flowDefinition.getViewList())
            {
                ViewNodeImpl node = new ViewNodeImpl(view.getId(), view.getVdlDocument());
                flow.addView(node);
            }

            for (FacesFlowReturn flowReturn : flowDefinition.getReturnList())
            {
                ReturnNodeImpl node = new ReturnNodeImpl(flowReturn.getId());
                if (flowReturn.getNavigationCase() != null &&
                    !isEmptyString(flowReturn.getNavigationCase().getFromOutcome()))
                {
                    if (ELText.isLiteral(flowReturn.getNavigationCase().getFromOutcome()))
                    {
                        node.setFromOutcome(flowReturn.getNavigationCase().getFromOutcome());
                    }
                    else
                    {
                        node.setFromOutcome(
                            application.getExpressionFactory().createValueExpression(
                                facesContext.getELContext(), flowReturn.getNavigationCase().getFromOutcome(),
                                Object.class));
                    }
                }
                flow.putReturn(node.getId(), node);
            }
           
            flow.freeze();
           
            // Add the flow, so the config can be processed by the flow system and the
            // navigation system.
            application.getFlowHandler().addFlow(facesContext, flow);
        }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.flow.FlowImpl

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.