]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java
Change the way parameterRef is implemented
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / DefaultExecutionFlowDescriptorConverter.java
index 8f13609dc8054fc88f26e3969594cb58a888b679..968debcb7ca25f7a992dcc0d15ae2e81a2c76755 100644 (file)
@@ -27,6 +27,9 @@ public class DefaultExecutionFlowDescriptorConverter implements
                ExecutionFlowDescriptorConverter, ApplicationContextAware {
        public final static String REF_VALUE_TYPE_BEAN_NAME = "beanName";
 
+       /** Workaround for https://www.spartadn.com/bugzilla/show_bug.cgi?id=206 */
+       private final static String REF_VALUE_IS_FROZEN = "__frozen";
+
        private final static Log log = LogFactory
                        .getLog(DefaultExecutionFlowDescriptorConverter.class);
 
@@ -36,9 +39,20 @@ public class DefaultExecutionFlowDescriptorConverter implements
                        ExecutionFlowDescriptor executionFlowDescriptor) {
                Map<String, Object> values = executionFlowDescriptor.getValues();
                Map<String, Object> convertedValues = new HashMap<String, Object>();
+               ExecutionSpec executionSpec = executionFlowDescriptor
+                               .getExecutionSpec();
+
+               if (executionSpec == null)
+                       log.warn("Execution spec is null for " + executionFlowDescriptor);
+
+               if (values != null && executionSpec != null) {
+                       values: for (String key : values.keySet()) {
+                               ExecutionSpecAttribute attribute = executionSpec
+                                               .getAttributes().get(key);
+
+                               if (attribute.getIsFrozen())
+                                       continue values;
 
-               if (values != null) {
-                       for (String key : values.keySet()) {
                                Object value = values.get(key);
                                if (value instanceof PrimitiveValue) {
                                        PrimitiveValue primitiveValue = (PrimitiveValue) value;
@@ -95,8 +109,12 @@ public class DefaultExecutionFlowDescriptorConverter implements
                                                // all necessary information is in the spec
                                        }
                                } else if (attribute instanceof RefSpecAttribute) {
-                                       values.put(key, buildRefValue((RefSpecAttribute) attribute,
-                                                       executionFlow, key));
+                                       if (attribute.getIsFrozen()) {
+                                               values.put(key, new RefValue(REF_VALUE_IS_FROZEN));
+                                       } else
+                                               values.put(key, buildRefValue(
+                                                               (RefSpecAttribute) attribute, executionFlow,
+                                                               key));
                                } else {
                                        throw new SlcException("Unkown spec attribute type "
                                                        + attribute.getClass());