Package org.amplafi.flow.flowproperty

Examples of org.amplafi.flow.flowproperty.FlowPropertyDefinitionImpl


        replay(templateParser);
    }

    private FlowImplementor createFlowWithProperties(String componentName) {
        FlowImplementor flow = createFlow2(componentName, 1);
        FlowPropertyDefinitionImpl globalDef = new FlowPropertyDefinitionImpl("globaldef1");
        globalDef.setUiComponentParameterName("componentGlobaldef1");
        flow.addPropertyDefinitions(globalDef);
        FlowPropertyDefinitionImpl globalOverlap = new FlowPropertyDefinitionImpl("overlap");
        globalOverlap.setUiComponentParameterName("globalOverlapParameter");
        flow.addPropertyDefinitions(globalOverlap);
        FlowPropertyDefinitionImpl overlap  = new FlowPropertyDefinitionImpl("overlap");
        overlap.setUiComponentParameterName("componentOverlapParameter");
        ((FlowActivityImplementor)flow.getActivity(0)).addPropertyDefinitions(overlap);
        return flow;
    }
View Full Code Here


    public void testPropertyPriority() {
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        {
            FlowActivityImpl flowActivity0 = new FlowActivityImpl();
            flowActivity0.setFlowPropertyProviderName("fs0");
            flowActivity0.addPropertyDefinitions(new FlowPropertyDefinitionImpl("key").initPropertyScope(activityLocal));
            FlowActivityImpl flowActivity1 = new FlowActivityImpl();
            flowActivity1.setFlowPropertyProviderName("fs1");
            FlowImpl flow = new FlowImpl(FLOW_TYPE, flowActivity0, flowActivity1);
            flowTestingUtils.getFlowTranslatorResolver().resolveFlow(flow);
            flowTestingUtils.getFlowDefinitionsManager().addDefinition(FLOW_TYPE, flow);
View Full Code Here

    }

    @Test(enabled=TEST_ENABLED)
    public void testInitialValuesOnFlow() {
        FlowImplementor flow = new FlowImpl(FLOW_TYPE);
        FlowPropertyDefinitionImpl globalDef = new FlowPropertyDefinitionImpl(PROPERTY1);
        globalDef.setInitial(INITIAL_VALUE);
        flow.addPropertyDefinitions(globalDef);
        FlowPropertyDefinitionImpl globalDef1 = new FlowPropertyDefinitionImpl(PROPERTY2);
        globalDef1.setInitial(INITIAL_VALUE);
        flow.addPropertyDefinitions(globalDef1);
        // activity #0
        FlowActivityImpl activity = new FlowActivityImpl();
        flow.addActivity(activity);
        // activity #1
        activity = new FlowActivityImpl();
        flow.addActivity(activity);
        // activity #2
        activity = new FlowActivityImpl();
        FlowPropertyDefinitionImpl localDef1 = new FlowPropertyDefinitionImpl(PROPERTY1);
        activity.addPropertyDefinitions(localDef1);
        flow.addActivity(activity);
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.getFlowTranslatorResolver().resolveFlow(flow);
View Full Code Here

    @Test(enabled=TEST_ENABLED)
    public void testConversion() {
        String returnToFlowLookupKey = null;
        Map<String, String> initialFlowState = new HashMap<String, String>();
        FlowImplementor flow = new FlowImpl(FLOW_TYPE);
        FlowPropertyDefinitionImpl definition = new FlowPropertyDefinitionImpl("foo", Long.class);
        flow.addPropertyDefinitions(definition);
        FlowActivityImpl fa1 = new FlowActivityImpl();
        flow.addActivity(fa1);
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.getFlowTranslatorResolver().resolve(fa1);
View Full Code Here

        String defaultAfterPage1 = "default-after-page-for-"+FLOW_TYPE_1;
        String defaultPage1 = "page-of-"+FLOW_TYPE_1;
        mainFlow.setPageName(defaultPage1);
        mainFlow.setDefaultAfterPage(defaultAfterPage1);
        FlowActivityImpl fa1 = new FlowActivityImpl().initInvisible(false);
        FlowPropertyDefinitionImpl copiedBackProperty = new FlowPropertyDefinitionImpl("copiedBackProperty").initAccess(PropertyScope.flowLocal, PropertyUsage.io);
        fa1.addPropertyDefinition(copiedBackProperty);
        mainFlow.addActivity(fa1);

        FlowImpl subFlow = new FlowImpl(FLOW_TYPE_2);
        String defaultAfterPage2 = "default-after-page-for-"+FLOW_TYPE_2;
        String defaultPage2 = "page-of-"+FLOW_TYPE_2;
        subFlow.setPageName(defaultPage2);
        subFlow.setDefaultAfterPage(defaultAfterPage2);
        FlowActivityImpl fa2_1 = new FlowActivityImpl().initInvisible(false);
        fa2_1.addPropertyDefinition(copiedBackProperty.clone());
        subFlow.addActivity(fa2_1);
        subFlow.addActivity(new TransitionFlowActivity());

        FlowImpl continuedFlow = new FlowImpl(FLOW_TYPE_3);
        String defaultAfterPage3 = "default-after-page-for-"+FLOW_TYPE_3;
        String defaultPage3 = "page-of-"+FLOW_TYPE_3;
        continuedFlow.setPageName(defaultPage3);
        continuedFlow.setDefaultAfterPage(defaultAfterPage3);
        FlowActivityImpl fa3_1 = new FlowActivityImpl().initInvisible(false);
        continuedFlow.addActivity(fa3_1);

        Object returnToFlowLookupKey = true;
        FlowManagement baseFlowManagement = getFlowManagement(mainFlow, subFlow, continuedFlow);
        FlowState flowState1 = baseFlowManagement.startFlowState(FLOW_TYPE_1, true, null, returnToFlowLookupKey);
        assertEquals(flowState1.getCurrentPage(), defaultPage1);
        FlowState flowState2 = baseFlowManagement.startFlowState(FLOW_TYPE_2, true, null, true);
        flowState2.setProperty(copiedBackProperty.getName(), A_VALUE_THAT_IS_COPIED_BACK);
        assertEquals(flowState2.getCurrentPage(), defaultPage2);
        String lookupKey1 = flowState2.getProperty(FSRETURN_TO_FLOW);
        assertEquals(flowState1.getLookupKey(), lookupKey1, "the child flow does not have the parent flow as the return-to-flow ");
        flowState2.setProperty(FSNEXT_FLOW, FLOW_TYPE_3);
        String pageName = flowState2.finishFlow();

        FlowState flowState3 = baseFlowManagement.getCurrentFlowState();
        assertEquals(flowState3.getFlowTypeName(), FLOW_TYPE_3);
        assertEquals(flowState3.getProperty(copiedBackProperty.getName()), A_VALUE_THAT_IS_COPIED_BACK);
        assertEquals(pageName, defaultPage3, "the child flow when it completed did not redirect to the parent flow's page. flowState2="+flowState2);
        lookupKey1 = flowState3.getProperty(FSRETURN_TO_FLOW);
        assertEquals(flowState1.getLookupKey(), lookupKey1, "the child flow does not have the parent flow as the return-to-flow ");
        pageName = flowState3.finishFlow();

        assertEquals(pageName, defaultPage1, "the child flow when it completed did not redirect to the parent flow's page. flowState2="+flowState2);
        FlowState flowState1_again = baseFlowManagement.getCurrentFlowState();
        assertEquals(flowState1_again.getLookupKey(), flowState1.getLookupKey());
        assertEquals(flowState1_again.getProperty(copiedBackProperty.getName()), A_VALUE_THAT_IS_COPIED_BACK);
        flowState1_again.finishFlow();
        FlowState nothing = baseFlowManagement.getCurrentFlowState();
        assertNull(nothing);
    }
View Full Code Here

    @Test(enabled=TEST_ENABLED)
    public void testAvoidConflictsOnFlowTransitions() {
        FlowActivityImpl flowActivity1 = new FlowActivityImpl().initInvisible(false);
        // initialized by "first" flow ignored by second flow.
        final String initializedByFirst = "initializedByFirst";
        flowActivity1.addPropertyDefinitions(new FlowPropertyDefinitionImpl(initializedByFirst).initPropertyUsage(PropertyUsage.initialize));

        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.addFlowDefinition("first", flowActivity1,
            new TransitionFlowActivity(null, "second", TransitionType.normal));

        FlowActivityImpl flowActivity2 = new FlowActivityImpl().initInvisible(false);
        // this property name is unknown to "first" flow so "first" flow should not affect this property value at all.
        // for second flow, the property is flowLocal/ internalState so the setting should only affect the flowLocal copy.
        String privatePropertyForSecondFlow = "privateForSecond";
        String globalSettingForSecondFlowPrivateProperty = "global_for_privateForSecond";
        FlowPropertyDefinitionImpl flowPropertyDefinition_secondflow_prop0 = new FlowPropertyDefinitionImpl(privatePropertyForSecondFlow, Boolean.class).initAccess(flowLocal, PropertyUsage.internalState);
        // first flow doesn't understand this property but it sets it for the second flow to use.
        String opaqueSecondFlowProperty = "secondFlowProperty";
        flowActivity2.addPropertyDefinitions(
            flowPropertyDefinition_secondflow_prop0,
            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,
View Full Code Here

    public void testTransitionActivate() {
        FlowActivityImpl obj = new FlowActivityImpl();
        FlowImplementor flow = EasyMock.createMock(FlowImplementor.class);
        FlowState flowState = EasyMock.createNiceMock(FlowStateImplementor.class);
        expect(flow.getFlowState()).andReturn(flowState).anyTimes();
        expect(flow.getFlowPropertyDefinition(FlowConstants.FAINVISIBLE)).andReturn(new FlowPropertyDefinitionImpl(FlowConstants.FAINVISIBLE, boolean.class)).anyTimes();
        expect(flow.getFlowPropertyDefinition(FlowConstants.FSAUTO_COMPLETE)).andReturn(new FlowPropertyDefinitionImpl(FlowConstants.FSAUTO_COMPLETE, boolean.class)).anyTimes();
        obj.setFlow(flow);
        EasyMock.replay(flow, flowState);
        assertTrue(obj.activate(FlowStepDirection.inPlace));
        obj.setPageName("foo");
        assertFalse(obj.activate(FlowStepDirection.inPlace));
View Full Code Here

        dataClassDefinition.setFlowTranslator(flowTranslator);
        return dataClassDefinition;
    }

    protected FlowPropertyDefinitionImpl createFlowPropertyDefinition() {
        return new FlowPropertyDefinitionImpl("foo", createDataClassDefinition());
    }
View Full Code Here

     * subclasses should override to add their standard definitions.
     */
    protected void addStandardFlowPropertyDefinitions() {
        // see #2179 #2192
        this.addPropertyDefinitions(
            new FlowPropertyDefinitionImpl(FATITLE_TEXT).initAccess(activityLocal, use),
            new FlowPropertyDefinitionImpl(FAUPDATE_TEXT).initAccess(activityLocal, use),
            new FlowPropertyDefinitionImpl(FANEXT_TEXT).initAccess(activityLocal, use),
            new FlowPropertyDefinitionImpl(FAPREV_TEXT).initAccess(activityLocal, use),
            new FlowPropertyDefinitionImpl(FAINVISIBLE, boolean.class).initAccess(activityLocal, consume)
        );
    }
View Full Code Here

//        assertEquals(definition.getValidators(), "required,email");
//    }

    @Test(enabled=TEST_ENABLED)
    public void testUriProperty() {
        FlowPropertyDefinitionImpl definition = new FlowPropertyDefinitionImpl("uri", URI.class, FlowActivityPhase.advance);
        new FlowTestingUtils().resolveAndInit(definition);
        assertNull(definition.getDefaultObject(new Dummy()));
    }
View Full Code Here

TOP

Related Classes of org.amplafi.flow.flowproperty.FlowPropertyDefinitionImpl

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.