Examples of FlowManagement


Examples of org.amplafi.flow.FlowManagement

    }

    private FlowStateImpl newFlowState() {
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        String flowTypeName = flowTestingUtils.addFlowDefinition(new FlowActivityImpl());
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        FlowStateImpl flowState = flowManagement.startFlowState(flowTypeName, true, null, null);
        flowState.finishFlow();
        return flowState;
    }
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

        // maybe check to see if a new flow already exists?
        if (this.getFlowState().getFlowStateLifecycle() == FlowStateLifecycle.successful) {
            String finishType = getFlowState().getFinishKey();
            if (getTransitionType() == TransitionType.normal && finishType == null
                    || getFinishKey().equalsIgnoreCase(finishType)) {
                FlowManagement fm = getFlowManagement();
                if (isNotBlank(getNextFlowId())) {
                    FlowState possibleFlowState = fm.getFlowState(resolveIndirectReference(getNextFlowId()));
                    if ( possibleFlowState != null) {
                        nextFlowState = possibleFlowState;
                        fm.makeAfter(this.getFlowState(), possibleFlowState);
                    }
                } else {
                    String flowType = resolveIndirectReference(getNextFlowType());
                    if (isBlank(flowType)) {
                        // why clear the FSNEXT_FLOW ?
                        flowType = getResolvedIndirectReferenceProperty(FSNEXT_FLOW);
                        setProperty(FSNEXT_FLOW, null);
                    }
                    if (isNotBlank(flowType)) {
                        nextFlowState = this.createNewFlow(flowType);
                        fm.makeAfter(this.getFlowState(), nextFlowState);
                    }
                }
            }
        }
        return nextFlowState;
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

            }
            flowTestingUtils.addFlowDefinition(flowTypeName, flowActivity);
        }


        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        FlowState flowState = flowManagement.startFlowState(flowTypeName, true, initialFlowState, null);

        // now make sure that only the properties allowed to be set externally are set.
        for (PropertyScope propertyScope: PropertyScope.values()) {
            for(PropertyUsage propertyUsage: PropertyUsage.values()) {
                String name= propertyScope+"_"+propertyUsage;
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

                // expected
            }
        }

        // now as part of a running flow
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        FlowStateImpl flowStateImpl = flowManagement.startFlowState(flowTypeName, true, null, null);
        FlowActivityImpl flowActivity = flowStateImpl.getCurrentActivity();
        for(FlowPropertyProvider flowPropertyProvider: new FlowPropertyProvider[] {flowActivity, flowStateImpl.getFlow()}) {
            namespace = flowLocalProperty.getNamespaceKey(flowStateImpl, flowPropertyProvider);
            assertEquals(namespace, flowStateImpl.getLookupKey());
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

        flowActivity2.setFlowPropertyProviderName("activity2");
        FlowPropertyDefinitionImpl globalProperty = new FlowPropertyDefinitionImpl(propertyName, Boolean.class).initAccess(flowLocal,io);
        flowActivity2.addPropertyDefinitions(globalProperty);

        String flowTypeName = flowTestingUtils.addFlowDefinition(flowActivity0, flowActivity1, flowActivity2);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        Map<String, String> initialFlowState = FlowUtils.INSTANCE.createState(propertyName, "true");
        FlowState flowState = flowManagement.startFlowState(flowTypeName, false, initialFlowState , null);
        assertNotNull(flowState);
        // expect null because
        Boolean propertyValue = flowState.getProperty(propertyName, Boolean.class);
        assertNull(propertyValue, "flowState="+flowState+" propertyValue="+propertyValue);
        flowState.next();
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

        flowActivity2.setFlowPropertyProviderName("activity2");
        FlowPropertyDefinitionImpl globalProperty = new FlowPropertyDefinitionImpl(propertyName, String.class).initAccess(flowLocal,io);
        flowActivity2.addPropertyDefinitions(globalProperty);

        String flowTypeName = flowTestingUtils.addFlowDefinition(flowActivity0, flowActivity1, flowActivity2);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        Map<String, String> initialFlowState = FlowUtils.INSTANCE.createState(propertyName, "maybe");
        FlowState flowState = flowManagement.startFlowState(flowTypeName, false, initialFlowState , null);
        assertNotNull(flowState);
        String propertyValue = flowState.getProperty(propertyName, String.class);
        assertEquals("true",propertyValue, "flowState="+flowState+" propertyValue="+propertyValue);
        flowState.next();
        propertyValue = flowState.getProperty(propertyName, String.class);
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

        fa1.addPropertyDefinitions(definition);
        flow.addActivity(fa1);
        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        flowTestingUtils.getFlowTranslatorResolver().resolveFlow(flow);
        flowTestingUtils.getFlowDefinitionsManager().addDefinition(FLOW_TYPE, flow);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        String returnToFlowLookupKey = null;
        FlowState flowState = flowManagement.startFlowState(FLOW_TYPE, true, initialFlowState, returnToFlowLookupKey);
        SampleEnum type =flowState.getCurrentActivity().getProperty("foo");
        assertEquals(type, SampleEnum.EXTERNAL, "(looking for property 'foo') FlowState="+flowState);
        type =flowState.getProperty("fa1fp", SampleEnum.class);
        assertEquals(type, SampleEnum.EMAIL);
    }
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

        });
        FlowActivityImpl flowActivity0 = newFlowActivity();
        flowActivity0.setFlowPropertyProviderName("activity0");
        flowActivity0.addPropertyDefinitions(flowLocalProperty);
        String flowTypeName = flowTestingUtils.addFlowDefinition(flowActivity0);
        FlowManagement flowManagement = flowTestingUtils.getFlowManagement();
        Map<String, String> initialFlowState = FlowUtils.INSTANCE.createState(propertyName, "maybe");
        FlowState flowState = flowManagement.startFlowState(flowTypeName, false, initialFlowState , null);
        assertNotNull(flowState);
        Boolean propertyValue = flowState.getProperty(propertyName, Boolean.class);
        assertEquals(Boolean.TRUE,propertyValue, "flowState="+flowState+" propertyValue="+propertyValue);
    }
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

        String nextFlowType = flowTestingUtils.addFlowDefinition(newFlowActivity());
        TransitionFlowActivity transitionFlowActivity = new TransitionFlowActivity();
        transitionFlowActivity.setTransitionType(TransitionType.alternate);
        transitionFlowActivity.setNextFlowType(nextFlowType);
        String flowTypeName = flowTestingUtils.addFlowDefinition(newFlowActivity(), transitionFlowActivity);
        FlowManagement flowManagement = flowTestingUtils.getFlowManager().getFlowManagement();
        FlowStateImplementor flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowTestingUtils.advanceToEnd(flowState);
        FlowState nextFlowState = flowManagement.getCurrentFlowState();
        // the alternate condition was not met.
        assertNull(nextFlowState);

        flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowState.setFinishKey(TransitionType.alternate.toString());
        // make sure cache can't help 'cheat'
        flowState.clearCache();
        flowTestingUtils.advanceToEnd(flowState);
        nextFlowState = flowManagement.getCurrentFlowState();
        assertNotNull(nextFlowState);
        assertEquals(nextFlowState.getFlowTypeName(), nextFlowType);
        assertNull(nextFlowState.getFinishKey(), "nextFlowState="+nextFlowState);
    }
View Full Code Here

Examples of org.amplafi.flow.FlowManagement

        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        String nextFlowType = flowTestingUtils.addFlowDefinition(newFlowActivity());
        TransitionFlowActivity transitionFlowActivity = new TransitionFlowActivity();
        transitionFlowActivity.setNextFlowType(nextFlowType);
        String flowTypeName = flowTestingUtils.addFlowDefinition(newFlowActivity(), transitionFlowActivity);
        FlowManagement flowManagement = flowTestingUtils.getFlowManager().getFlowManagement();
        FlowState flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowTestingUtils.advanceToEnd(flowState);
        FlowState nextFlowState = flowManagement.getCurrentFlowState();
        assertNotNull(nextFlowState);
        assertEquals(nextFlowState.getFlowTypeName(), nextFlowType);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.