Package org.amplafi.flow.flowproperty

Examples of org.amplafi.flow.flowproperty.FlowPropertyDefinitionImpl


        assertTrue(set34.containsAll(expected34));
        assertTrue(set3.containsAll(expected3));
    }
    @Test
    public void testListCollectionHandling() throws Exception {
        FlowPropertyDefinitionImpl definition = new FlowPropertyDefinitionImpl(URI, URI.class, FlowActivityPhase.advance, List.class);
        getFlowTranslatorResolver().resolve("", definition);
        List<URI> list = Arrays.asList(new URI("http://foo.com"), new URI("http://gg.gov"));
        String strV =definition.serialize(list);
        assertEquals(strV, "[\"http://foo.com\",\"http://gg.gov\"]");

        FlowPropertyProvider flowPropertyProvider = null;
        List<URI> result = definition.parse(flowPropertyProvider, strV);
        assertTrue(list.containsAll(result));
        assertTrue(result.containsAll(list));
    }
View Full Code Here


        assertTrue(result.containsAll(list));
    }
    @Test
    @SuppressWarnings("unchecked")
    public void testSetCollectionHandling() throws Exception {
        FlowPropertyDefinitionImpl definition = new FlowPropertyDefinitionImpl(URI, URI.class, FlowActivityPhase.advance, Set.class);
        getFlowTranslatorResolver().resolve("", definition);
        Set<URI> set = new LinkedHashSet<URI>(Arrays.asList(new URI("http://foo.com"), new URI("http://gg.gov")));
        String strV =definition.serialize(set);
        assertEquals(strV, "[\"http://foo.com\",\"http://gg.gov\"]");
        FlowPropertyProvider flowPropertyProvider = null;
        Set<URI> result =(Set<URI>) definition.parse(flowPropertyProvider, strV);
        assertTrue(set.containsAll(result));
        assertTrue(set.containsAll(set));
    }
View Full Code Here

        assertTrue(set.containsAll(set));
    }
    @Test
    @SuppressWarnings("unchecked")
    public void testMapCollectionHandling() throws Exception {
        FlowPropertyDefinitionImpl definition = new FlowPropertyDefinitionImpl(URI, URI.class, FlowActivityPhase.advance, Map.class);
        getFlowTranslatorResolver().resolve("", definition);
        Map<String, URI> map = new LinkedHashMap<String, URI>();
        map.put("first", new URI("http://foo.com"));
        map.put("second", new URI("http://gg.gov"));
        String strV =definition.serialize(map);
        assertEquals(strV, "{\"first\":\"http://foo.com\",\"second\":\"http://gg.gov\"}");
        FlowPropertyProvider flowPropertyProvider = null;
        Map<String, URI> result = (Map<String,URI>) definition.parse(flowPropertyProvider, strV);
        assertTrue(result.equals(map));
    }
View Full Code Here

     * Test to make sure the merge with the standard definition happens.
     * Make sure that the standard definition does not change.
     */
    @Test(enabled=false) // for now #2179, #2192 forces these to be defined in FlowImpl
    public void testMergingWithStandardFlowPropertyDefinition() {
        FlowPropertyDefinitionImpl flowPropertyDefinition = new FlowPropertyDefinitionImpl(FSHIDE_FLOW_CONTROL);
        assertEquals(flowPropertyDefinition.getDataClass(), String.class);
        FlowPropertyDefinition standardFlowPropertyDefinition =
                this.getFlowTranslatorResolver().getFlowPropertyDefinition(FSHIDE_FLOW_CONTROL);
        assertEquals(standardFlowPropertyDefinition.getDataClass(), boolean.class);
        getFlowTranslatorResolver().resolve("", flowPropertyDefinition);
        assertEquals(flowPropertyDefinition.getDataClass(), boolean.class);
        assertNotSame(standardFlowPropertyDefinition, flowPropertyDefinition);
        standardFlowPropertyDefinition =
                this.getFlowTranslatorResolver().getFlowPropertyDefinition(FSHIDE_FLOW_CONTROL);
        assertNotSame(standardFlowPropertyDefinition, flowPropertyDefinition);
    }
View Full Code Here

        } else {
            expectedClass = expected;
        }
        // something to be said for making it requestFlowLocal - because this would give flash persistence for free.
        // but using global allows a property to be set that is really for the next flow to be run.
        FlowPropertyDefinitionImpl propertyDefinition = new FlowPropertyDefinitionImpl(key).initAccess(PropertyScope.global, PropertyUsage.io);
        if (expectedClass != null && !CharSequence.class.isAssignableFrom(expectedClass) ) {
            // auto define property
            // TODO save the definition when the flowState is persisted.
            propertyDefinition.setDataClass(expectedClass);
            if ( sampleValue != null) {
                // actually going to be setting this property
                flowPropertyProvider.addPropertyDefinitions(propertyDefinition);
            }
        }
View Full Code Here

     * Used to restore an existing definition or create an new definitions from XML
     */
    public FlowImpl() {
        // see #2179 #2192
        this.addPropertyDefinitions(
            new FlowPropertyDefinitionImpl(FSTITLE_TEXT).initAccess(flowLocal, use).initFlowPropertyValueProvider( MessageFlowPropertyValueProvider.INSTANCE ),
            new FlowPropertyDefinitionImpl(FSNO_CANCEL, boolean.class).initAccess(flowLocal, use),
            new FlowPropertyDefinitionImpl(FSFINISH_TEXT).initAccess(flowLocal, use).initFlowPropertyValueProvider( MessageFlowPropertyValueProvider.INSTANCE ),
            new FlowPropertyDefinitionImpl(FSRETURN_TO_TEXT).initAccess(flowLocal, use).initFlowPropertyValueProvider( MessageFlowPropertyValueProvider.INSTANCE ),
            // io -- for now because need to communicate the next page to be displayed
            // TODO think about PropertyScope/PropertyUsage
            new FlowPropertyDefinitionImpl(FSPAGE_NAME).initPropertyUsage(io),
            // TODO think about PropertyScope/PropertyUsage
            new FlowPropertyDefinitionImpl(FSAFTER_PAGE).initPropertyUsage(io),
            new FlowPropertyDefinitionImpl(FSDEFAULT_AFTER_PAGE).initAccess(flowLocal, internalState),
            new FlowPropertyDefinitionImpl(FSDEFAULT_AFTER_CANCEL_PAGE).initAccess(flowLocal, internalState),
            new FlowPropertyDefinitionImpl(FSHIDE_FLOW_CONTROL, boolean.class).initPropertyScope(flowLocal),
            new FlowPropertyDefinitionImpl(FSACTIVATABLE, boolean.class).initAccess(flowLocal, consume),
            new FlowPropertyDefinitionImpl(FSIMMEDIATE_SAVE, boolean.class).initAccess(flowLocal, internalState),

            new FlowPropertyDefinitionImpl(FSAPI_CALL, boolean.class).initAccess(flowLocal, io),
            new FlowPropertyDefinitionImpl(FSAUTO_COMPLETE, boolean.class).initAccess(flowLocal, internalState),
            new FlowPropertyDefinitionImpl(FSALT_FINISHED).initAccess(flowLocal, use),
            new FlowPropertyDefinitionImpl(FSREDIRECT_URL, URI.class).initPropertyUsage(io),
            new FlowPropertyDefinitionImpl(FSREFERRING_URL, URI.class).initPropertyUsage(use),
            new FlowPropertyDefinitionImpl(FSCONTINUE_WITH_FLOW).initPropertyUsage(io),
            new FlowPropertyDefinitionImpl(FSFLOW_TRANSITIONS, FlowTransition.class, Map.class).initAutoCreate().initAccess(flowLocal, use),
            new FlowPropertyDefinitionImpl(FSFLOW_TRANSITION, FlowTransition.class).initAccess(flowLocal, initialize),

            new FlowPropertyDefinitionImpl(FSRETURN_TO_FLOW).initPropertyUsage(io),
            new FlowPropertyDefinitionImpl(FSRETURN_TO_FLOW_TYPE).initPropertyUsage(io),
            new FlowPropertyDefinitionImpl(FSSUGGESTED_NEXT_FLOW_TYPE, FlowTransition.class, Map.class).initAutoCreate().initAccess(flowLocal, use),
            // TODO think about PropertyScope/PropertyUsage
            new FlowPropertyDefinitionImpl(FSNEXT_FLOW).initPropertyUsage(io)

        );
        CancelTextFlowPropertyValueProvider.INSTANCE.defineFlowPropertyDefinitions(this, null);
    }
View Full Code Here

    }

    @Override
    public void addStandardFlowPropertyDefinitions() {
        super.addStandardFlowPropertyDefinitions();
        this.addPropertyDefinitions(new FlowPropertyDefinitionImpl(FS_FLOW_TRANSITION_LABEL).initPropertyScope(activityLocal));
        initTransition();
    }
View Full Code Here

     */
    private static final String FLOWS = "flows";
    @Override
    protected void addStandardFlowPropertyDefinitions() {
        super.addStandardFlowPropertyDefinitions();
        addPropertyDefinitions(new FlowPropertyDefinitionImpl(FLOWS, List.class));
    }
View Full Code Here

    @Test(enabled=TEST_ENABLED)
    @SuppressWarnings("unchecked")
    public void testMapCollectionHandling() throws Exception {
        FlowPropertyProvider flowPropertyProvider = null;
        FlowPropertyDefinitionImpl definition = new FlowPropertyDefinitionImpl(URI, URI.class, FlowActivityPhase.advance, Map.class);
        new FlowTestingUtils().resolveAndInit(definition);
        Map<String, URI> map = new LinkedHashMap<String, URI>();
        map.put("first", new URI("http://foo.com"));
        map.put("second", new URI("http://gg.gov"));
        String strV = definition.serialize(map);
        assertEquals(strV, "{\"first\":\"http://foo.com\",\"second\":\"http://gg.gov\"}");
        Map<String, URI> result = (Map<String, URI>) definition.parse(flowPropertyProvider, strV);
        assertTrue(result.equals(map));
    }
View Full Code Here

            flowActivity.setFlowPropertyProviderName(activityName);
            for (PropertyScope propertyScope: PropertyScope.values()) {
                for(PropertyUsage propertyUsage: PropertyUsage.values()) {
                    String name= propertyScope+"_"+propertyUsage;
                    String externalInitial = "ext_"+name;
                    FlowPropertyDefinition flowPropertyDefinition = new FlowPropertyDefinitionImpl(name).initAccess(propertyScope, propertyUsage);
                    flowActivity.addPropertyDefinitions(flowPropertyDefinition);
                    initialFlowState.put(name, externalInitial);
                }
            }
            flowTestingUtils.addFlowDefinition(flowTypeName, flowActivity);
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.