Package org.amplafi.flow.flowproperty

Examples of org.amplafi.flow.flowproperty.FlowPropertyDefinitionImplementor


        if (isActive()) {
            FlowActivity currentActivity = getCurrentActivity();
            currentActivity.setProperty(key, value);
        } else {
            Class<T> expected = (Class<T>) (value == null?null:value.getClass());
            FlowPropertyDefinitionImplementor flowPropertyDefinition = getFlowPropertyDefinitionWithCreate(key, expected, value);
            setPropertyWithDefinition(null, flowPropertyDefinition, value);
        }
    }
View Full Code Here


    private static final boolean TEST_ENABLED = true;
    @Test(enabled=TEST_ENABLED)
    public void testSimpleFlowTransitionMapChecking() {
        FlowImpl flow = new FlowImpl(FLOW_TYPE_1);
        FlowActivityImpl fa1 = new FlowActivityImpl().initInvisible(false);
        FlowPropertyDefinitionImplementor definition = fa1.getFlowPropertyDefinition(FSFLOW_TRANSITIONS);
        assertNull(definition);
        flow.addActivity(fa1);
        definition = fa1.getFlowPropertyDefinition(FSFLOW_TRANSITIONS);
        assertNotNull(definition);
        String returnToFlowLookupKey = null;
        definition.setFlowPropertyValueProvider(new AddToMapFlowPropertyValueProvider<FlowPropertyProvider, String,FlowTransition>(new FlowTransition("foo", FLOW_TYPE_2, "foo", TransitionType.alternate, null)));
        FlowManagement baseFlowManagement = getFlowManagement(flow);
        FlowState flowState = baseFlowManagement.startFlowState(FLOW_TYPE_1, false, null, returnToFlowLookupKey);

        Map<String, FlowTransition> propValue = flowState.getCurrentActivity().getProperty(FSFLOW_TRANSITIONS);
        assertTrue( propValue.keySet().contains("foo"));
View Full Code Here

    }

    @Test(dataProvider="flowTranslatorExpectations")
    public void serializeDeserializeAndCompare(Object object, String expectedSerialize) throws Exception {

        FlowPropertyDefinitionImplementor flowPropertyDefinition = createFlowPropertyDefinition();
        DataClassDefinition dataClassDefinition = flowPropertyDefinition.getDataClassDefinition();

        String actual = flowPropertyDefinition.serialize(object);

        FlowPropertyProvider flowPropertyProvider = null;
        Object deserialized = createFlowTranslator().deserialize(flowPropertyProvider, flowPropertyDefinition, dataClassDefinition, actual);

        compareResults(object, expectedSerialize, actual, deserialized);
View Full Code Here

        getPropertyDefinitions().put(definition.getName(), definition);
    }

    protected void pushPropertyDefinitionToFlow(FlowPropertyDefinitionImplementor definition) {
        if (getFlow() != null && !definition.isLocal()) {
            FlowPropertyDefinitionImplementor flowProp = this.getFlow().getFlowPropertyDefinition( definition.getName());
            if (flowProp == null ) {
                // push up to flow so that other can see it.
                // seems like flows should handle this issue with properties.
                FlowPropertyDefinitionImplementor cloned = definition.clone();
                // a FPD may be pushed so for an earlier FA may not require the property be set.
                cloned.setPropertyRequired(FlowActivityPhase.optional);
                this.getFlow().addPropertyDefinitions(cloned);
            } else if ( flowProp.isMergeable(definition)) {
                flowProp.merge(definition);
                flowProp.setPropertyRequired(FlowActivityPhase.optional);
            }
View Full Code Here

     *
     * @see org.amplafi.flow.flowproperty.FlowPropertyProviderWithValues#setProperty(java.lang.String, java.lang.Object)
     */
    public <T> void setProperty(String key, T value) {
        if ( getFlowState() != null) { // TODO: why are we ignoring (probably a test that should be fixed )
            FlowPropertyDefinitionImplementor propertyDefinition = getFlowPropertyDefinitionWithCreate(key, null, value);
            setProperty(propertyDefinition, value);
        }
    }
View Full Code Here

     * other wise will affect the definitions.
     * see #2179 / #2192
     */
    @SuppressWarnings("unchecked")
    protected void handleFlowPropertyValueProvider(String key, FlowPropertyValueProvider flowPropertyValueProvider) {
        FlowPropertyDefinitionImplementor flowPropertyDefinition = this.getLocalPropertyDefinition(key);
        if ( flowPropertyDefinition != null) {
            if ( flowPropertyValueProvider instanceof ChainedFlowPropertyValueProvider) {
                ((ChainedFlowPropertyValueProvider)flowPropertyValueProvider).setPrevious(flowPropertyDefinition.getFlowPropertyValueProvider());
            }
            flowPropertyDefinition.setFlowPropertyValueProvider(flowPropertyValueProvider);
        }
        flowPropertyDefinition = this.getFlowPropertyDefinitionDefinedInFlow(key);
        if ( flowPropertyDefinition != null) {
            if ( flowPropertyValueProvider instanceof ChainedFlowPropertyValueProvider) {
                ((ChainedFlowPropertyValueProvider)flowPropertyValueProvider).setPrevious(flowPropertyDefinition.getFlowPropertyValueProvider());
            }
            flowPropertyDefinition.setFlowPropertyValueProvider(flowPropertyValueProvider);
        }
    }
View Full Code Here

TOP

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

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.