Package org.amplafi.flow.impl

Examples of org.amplafi.flow.impl.FlowStateImplementor


            new FlowPropertyDefinitionImpl(opaqueSecondFlowProperty, String.class).initPropertyScope(flowLocal).initPropertyUsage(PropertyUsage.io)
            );
        flowTestingUtils.addFlowDefinition("second", flowActivity2);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();

        FlowStateImplementor flowState = flowManagement.startFlowState("first", true, FlowUtils.INSTANCE.createState(privatePropertyForSecondFlow, globalSettingForSecondFlowPrivateProperty,
            initializedByFirst, "ShouldBeIgnored"), false);
        String opaqueValuePassedFromFirstToSecond = "opaque";
        flowState.setRawProperty(opaqueSecondFlowProperty, opaqueValuePassedFromFirstToSecond);
        assertEquals(flowState.getProperty(initializedByFirst, String.class), null, "flowState="+flowState);
        String propertyValueInitializedByFirst = "realvalue";
        flowState.setProperty(initializedByFirst, propertyValueInitializedByFirst);
        flowTestingUtils.advanceToEnd(flowState);
        FlowStateImplementor nextFlowState = flowManagement.getCurrentFlowState();
        assertNotNull(nextFlowState);
        // flowLocal namespace ignored the passed setting
        assertNull(nextFlowState.getProperty(privatePropertyForSecondFlow, Boolean.class), "nextFlowState="+nextFlowState);
        String privatePropertyValueInSecondFlow = "true";
        nextFlowState.setProperty(privatePropertyForSecondFlow, privatePropertyValueInSecondFlow);
        assertEquals(nextFlowState.getFlowTypeName(), "second");
        // but it is still there for others.
        assertEquals(nextFlowState.getRawProperty((String)null, privatePropertyForSecondFlow), globalSettingForSecondFlowPrivateProperty, "nextFlowState="+nextFlowState);
        assertEquals(nextFlowState.getProperty(opaqueSecondFlowProperty, String.class), opaqueValuePassedFromFirstToSecond, "looking at="+opaqueSecondFlowProperty+"  nextFlowState="+nextFlowState);
        assertEquals(nextFlowState.getProperty(privatePropertyForSecondFlow), Boolean.parseBoolean(privatePropertyValueInSecondFlow), "looking at="+privatePropertyForSecondFlow+ "  nextFlowState="+nextFlowState);
        assertEquals(nextFlowState.getRawProperty((String)null, initializedByFirst), propertyValueInitializedByFirst, "nextFlowState="+nextFlowState);
        flowTestingUtils.advanceToEnd(flowState);

    }
View Full Code Here


        }
    }
    @Override
    public void pageValidate(PageEvent event) {
        /* the broadcastProvider is not initialized yet -- has security run yet? */
        FlowStateImplementor flow = (FlowStateImplementor) getFlowState();
        if ( flow != null ) {
            // Check to see if the current page is the page that the flow things should be displayed
            // while a flow is running the page ( not just the active component ) may change.
            // this happens in autostart situations, when a FlowActivity has a different page than the flow's default pages
            // or if a flow is morphed into another flow.

            String flowPageName = flow.getCurrentPage();
            String pageName = this.getPage().getPageName();
            if( flowPageName != null && !pageName.equals(flowPageName)) {
                if (!(this.getPage() instanceof FlowAwarePage) || isEmpty(((FlowAwarePage)this.getPage()).getExpectedFlowDefinitions())
                    || !((FlowAwarePage)this.getPage()).getExpectedFlowDefinitions().contains(flow.getFlowTypeName())) {
                    throw new PageRedirectException(flowPageName);
                } else {
                    flow.setCurrentPage(pageName);
                }
            }
        }
    }
View Full Code Here

        FlowActivityImpl fa3 = createFA("FA-3");
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.getFlowDefinitionsManager().addDefinitions(new FlowImpl(FIRST_FLOW, fa1,fa2,fa3));
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();

        FlowStateImplementor flowState = flowManagement.startFlowState(FIRST_FLOW, true, null, false);
        assertEquals(flowState.getFlow().getFlowPropertyProviderName(), FIRST_FLOW);
        assertEquals(flowState.getCurrentActivity().getFlowPropertyProviderName(), "FA-1");
        flowState.next();
        assertEquals(flowState.getCurrentActivity().getFlowPropertyProviderName(), "FA-2");
        flowState.setPropertyWithDefinition(fa1,morphFlowFPD,false);
        flowState.next();
        assertEquals(flowState.getCurrentActivity().getFlowPropertyProviderName(), "FA-3");
        flowState.finishFlow();
        assertNull(flowManagement.getCurrentFlowState(), "there shouldn't be a flow running");
    }
View Full Code Here

        }
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        Map<String, String> initialFlowState = FlowUtils.INSTANCE.createState(
            "key", "fs",
            FlowUtils.INSTANCE.toKey("fs0","key"), "fs0");
        FlowStateImplementor fs = flowManagement.startFlowState(FLOW_TYPE, true, initialFlowState, null);

        FlowActivityImplementor activity0 = fs.getActivity(0);
        assertEquals(activity0.getProperty("key"), "fs0", "flowState="+fs);
        FlowActivityImplementor activity1 = fs.getActivity(1);
        assertEquals(activity1.getProperty("key"), "fs");

        activity0.setProperty("key", "new-fs0");
        activity1.setProperty("key", "new-fs");
View Full Code Here

        flowTestingUtils.getFlowDefinitionsManager().addDefinition(FLOW_TYPE, flow);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        Map<String, String> initialFlowState = new HashMap<String, String>();
        initialFlowState.put(PROPERTY2, SET_BY_MAP);
        String returnToFlowLookupKey = null;
        FlowStateImplementor flowState = flowManagement.startFlowState(FLOW_TYPE, true, initialFlowState, returnToFlowLookupKey);
        assertEquals(flowState.getActivity(0).getProperty(PROPERTY1), INITIAL_VALUE, "flowState="+flowState);
        flowState.clearCache();
        assertEquals(flowState.getActivity(1).getProperty(PROPERTY2), SET_BY_MAP, "flowState="+flowState);
        flowState.clearCache();
        assertEquals(flowState.getActivity(2).getProperty(PROPERTY1), INITIAL_VALUE, "flowState="+flowState);
        flowState.clearCache();
    }
View Full Code Here

        super(FSRETURN_TO_FLOW, FSRETURN_TO_FLOW_TYPE, FSCONTINUE_WITH_FLOW);
    }
    @SuppressWarnings("unchecked")
    @Override
    public <T> T get(FlowPropertyProviderImplementor flowPropertyProvider, FlowPropertyDefinition flowPropertyDefinition) {
        FlowStateImplementor flowStateImplementor = flowPropertyProvider.getFlowState();
        String lookupKey = flowStateImplementor.getRawProperty(flowPropertyProvider, flowPropertyDefinition);
        FlowState flowState = flowStateImplementor.getFlowManagement().getFlowState(lookupKey);
        return (T) flowState;
    }
View Full Code Here

TOP

Related Classes of org.amplafi.flow.impl.FlowStateImplementor

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.