Package javax.faces.flow

Examples of javax.faces.flow.Flow


        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow2");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow1");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        //UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
        //submit(button5);
       
        NavigationCase endCase = handler.getNavigationCase(facesContext, null, "back_flow_1_3");
        Assert.assertNotNull(endCase);

        String toViewId = endCase.getToViewId(facesContext);
        // Check if the dynamic outcome return hack has been correctly resolved.
        Assert.assertEquals(toViewId, "/flow_base.xhtml");
        String fromOutcome = endCase.getFromOutcome();
        String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
       
        tearDownRequest();
        setupRequest(toViewId);
        request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
        request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
        request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        Flow currentFlow3 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow3);
        Assert.assertEquals(currentFlow3.getId(), "flow2");
       
        processRender();
       
        UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
        submit(button6);
       
        processLifecycleExecute();

        Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNull(currentFlow4);
       
        processRender();
    }
View Full Code Here


        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow1");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow2");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
        submit(button5);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        Flow currentFlow3 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow3);
        Assert.assertEquals(currentFlow3.getId(), "flow1");
       
        processRender();
       
        UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
        submit(button6);
       
        processLifecycleExecute();

        Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNull(currentFlow4);
       
        processRender();
    }
View Full Code Here

        context.getAttributes().remove(mapKey);
    }
   
    public Map<Object, Object> getCurrentFlowScope(FacesContext facesContext)
    {
        Flow flow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        if (flow != null)
        {
            String mapKey = CURRENT_FLOW_SCOPE_MAP+SEPARATOR_CHAR+
                flow.getDefiningDocumentId()+SEPARATOR_CHAR+flow.getId();
            Map<Object, Object> map = (Map<Object, Object>) facesContext.getAttributes().get(
                mapKey);
            if (map == null)
            {
                map = new FlowScopeMap(getBeanManager(), flow.getClientWindowFlowId(
                    facesContext.getExternalContext().getClientWindow()));
               
                facesContext.getAttributes().put(mapKey, map);
            }
            return map;
View Full Code Here

        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow1");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow2");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
        submit(button5);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        Flow currentFlow3 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow3);
        Assert.assertEquals(currentFlow3.getId(), "flow2");
       
        processRender();
       
        UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
        submit(button6);
       
        processLifecycleExecute();

        Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNull(currentFlow4);
       
        processRender();
    }
View Full Code Here

        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow3");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow1");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow2");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        //UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_3");
        //submit(button5);
        NavigationCase endCase = handler.getNavigationCase(facesContext, null, "back_flow_1_3");
        Assert.assertNotNull(endCase);

        String toViewId = endCase.getToViewId(facesContext);
        // Check if the dynamic outcome return hack has been correctly resolved.
        Assert.assertEquals(toViewId, "/flow_base.xhtml");
        String fromOutcome = endCase.getFromOutcome();
        String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
       
        tearDownRequest();
        setupRequest(toViewId);
        request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
        request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
        request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        Flow currentFlow3 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow3);
        Assert.assertEquals(currentFlow3.getId(), "flow2");
       
        processRender();
       
        UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
        submit(button6);
       
        processLifecycleExecute();

        Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNull(currentFlow4);
       
        processRender();
    }
View Full Code Here

       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow4/flow4.xhtml", facesContext.getViewRoot().getViewId());
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow4");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow2");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1_4");
        submit(button5);
       
        processLifecycleExecute();
       
        Flow currentFlow3 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow3);
        Assert.assertEquals(currentFlow3.getId(), "flow1");
       
        processRender();
       
        UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button6);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
       
        UICommand button7 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_4");
        submit(button7);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow4);
        Assert.assertEquals(currentFlow4.getId(), "flow2");
       
        processRender();
       
        UICommand button8 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
        submit(button8);
       
        processLifecycleExecute();

        Flow currentFlow5 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNull(currentFlow5);
       
        processRender();

    }
View Full Code Here

       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow4/flow4.xhtml", facesContext.getViewRoot().getViewId());
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals(currentFlow.getId(), "flow4");
       
        processRender();
       
        NavigationCase goFlowBase = handler.getNavigationCase(facesContext, null, "flow_base");
        Assert.assertNotNull(goFlowBase);
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button2);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        processRender();
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow2");
        submit(button3);
       
        processLifecycleExecute();
       
        Flow currentFlow2 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow2);
        Assert.assertEquals(currentFlow2.getId(), "flow2");
       
        processRender();
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button4);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        UICommand button5 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1_4");
        submit(button5);
       
        processLifecycleExecute();
       
        Flow currentFlow3 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow3);
        Assert.assertEquals(currentFlow3.getId(), "flow1");
       
        processRender();
       
        UICommand button6 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:go_flow_base");
        submit(button6);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());
       
        processRender();
       
        //UICommand button7 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow1_4");
        //submit(button7);
       
        NavigationCase endCase = handler.getNavigationCase(facesContext, null, "back_flow_1_4");
        Assert.assertNotNull(endCase);

        String toViewId = endCase.getToViewId(facesContext);
        // Check if the dynamic outcome return hack has been correctly resolved.
        Assert.assertEquals(toViewId, "/flow_base.xhtml");
        String fromOutcome = endCase.getFromOutcome();
        String clientWindowId = facesContext.getExternalContext().getClientWindow().getId();
       
        tearDownRequest();
        setupRequest(toViewId);
        request.addParameter(FlowHandler.TO_FLOW_DOCUMENT_ID_REQUEST_PARAM_NAME, FlowHandler.NULL_FLOW);
        request.addParameter(FlowHandler.FLOW_ID_REQUEST_PARAM_NAME, fromOutcome);
        request.addParameter(ResponseStateManager.CLIENT_WINDOW_URL_PARAM, clientWindowId);
       
        processLifecycleExecute();
       
        Assert.assertEquals("/flow_base.xhtml", facesContext.getViewRoot().getViewId());

        Flow currentFlow4 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow4);
        Assert.assertEquals(currentFlow4.getId(), "flow2");
       
        processRender();
       
        UICommand button8 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:returnFlow2");
        submit(button8);
       
        processLifecycleExecute();

        Flow currentFlow5 = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNull(currentFlow5);
       
        processRender();

    }
View Full Code Here

    {
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1").
            initializer("#{bean.init}").finalizer("#{bean.destroy}");
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("flow1", flow.getId());
        Assert.assertEquals("faces-flow1.xhtml", flow.getDefiningDocumentId());
        Assert.assertEquals("#{bean.init}", flow.getInitializer().getExpressionString());
        Assert.assertEquals("#{bean.destroy}", flow.getFinalizer().getExpressionString());
    }
View Full Code Here

    {
        FlowBuilder flowBuilder = new FlowBuilderImpl();
        flowBuilder.id("faces-flow1.xhtml", "flow1");
        flowBuilder.returnNode("returnNode").markAsStartNode().fromOutcome("mynode");
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("returnNode", flow.getStartNodeId());
       
        ReturnNode returnNode = flow.getReturns().get("returnNode");
        Assert.assertNotNull(returnNode);
        Assert.assertEquals("returnNode", returnNode.getId());
        Assert.assertEquals("mynode", returnNode.getFromOutcome(facesContext));
    }   
View Full Code Here

        switchCaseBuilder
            .switchCase().condition(
                application.getExpressionFactory().createValueExpression(Boolean.TRUE, Boolean.class))
                    .fromOutcome("caseC");
       
        Flow flow = flowBuilder.getFlow();
        Assert.assertNotNull(flow);
        Assert.assertEquals("switch1", flow.getStartNodeId());
       
        SwitchNode switchNode = flow.getSwitches().get("switch1");
        Assert.assertNotNull(switchNode);
        Assert.assertEquals("exit", switchNode.getDefaultOutcome(facesContext));
       
        SwitchCase scn = switchNode.getCases().get(0);
        Assert.assertTrue(scn.getCondition(facesContext));
View Full Code Here

TOP

Related Classes of javax.faces.flow.Flow

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.