Package org.amplafi.flow.flowproperty

Examples of org.amplafi.flow.flowproperty.PropertyUsage


        // move values from alternateNames to the true name.
        // or just clear out the alternate names of their values.
        List<String> namespaces = flowPropertyDefinition.getNamespaceKeySearchList(this, flowPropertyProvider);
        String value = null;
        boolean valueSet = false;
        PropertyUsage propertyUsage = flowPropertyDefinition.getPropertyUsage();
        for(String namespace: namespaces) {
            for (String alternateName : flowPropertyDefinition.getAllNames()) {
                if ( getFlowValuesMap().containsKey(namespace, alternateName)) {
                    if ( !valueSet ) {
                        value = getRawProperty(namespace, alternateName);
                        valueSet = true;
                    }
                    if ( propertyUsage.isCleanOnInitialization()) {
                        // if clearing then we need to clear all possible matches - so we continue with loop.
                        remove(namespace, alternateName);
                    } else {
                        break;
                    }
                }
            }
        }
        if ( !valueSet || !propertyUsage.isExternallySettable()) {
            // if property is not set  OR
            // if the property is not allowed to be overridden then
            // initialize it.
            // TODO set valueSet if flowPropertyDefinition.isInitialSet() -- can't check for null because null may be initial value ( see note about PropertyUsage#initialize )
            value = flowPropertyDefinition.getInitial();
            // TODO: what about flowPropertyValueProviders -- but need to handle lazy initialization + and better handling of initializing to null.
            // TODO: should be able to pass FlowState to do a get property operation on a FlowState if there is no FlowActivity.
            if ( value == null && propertyUsage == PropertyUsage.initialize && flowPropertyDefinition.getFlowPropertyValueProvider() != null && flowPropertyProvider != null) {
                // trigger property
                @SuppressWarnings("unused")
                Object v = getPropertyWithDefinition(flowPropertyProvider, flowPropertyDefinition);
                // HACK we should? flow through?
                return;
            }
        }
        String namespace = flowPropertyDefinition.getNamespaceKey(this, flowPropertyProvider);
        String currentValue = getRawProperty(namespace, flowPropertyDefinition.getName());
        if (!StringUtils.equals(value, currentValue)) {
            // This code allows FlowPropertyChangeListeners to be triggered when the flow starts up.
            if (!propertyUsage.isExternallySettable() && currentValue != null) {
                // property cannot be overridden.
                getLog().info(
                    (flowPropertyProvider==null?getFlow().getFlowPropertyProviderName():flowPropertyProvider.getFlowPropertyProviderFullName())
                                + '.'
                                + flowPropertyDefinition.getName()
View Full Code Here

TOP

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

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.