X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2FDefaultExecutionFlowDescriptorConverter.java;h=0e51cfeaa9b959b624f9c6e815e73c3334d9d7b2;hb=72a75c0006cf13df358e9329df937b8d31f8e931;hp=baa9b86a1d9a1daec12d0a44fa9884206ff87800;hpb=b2531c398b51dde19d6ceb4952fc5bdcc4c9e1e2;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java index baa9b86a1..0e51cfeaa 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java @@ -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 = "[internal]"; + private final static Log log = LogFactory .getLog(DefaultExecutionFlowDescriptorConverter.class); @@ -36,9 +39,20 @@ public class DefaultExecutionFlowDescriptorConverter implements ExecutionFlowDescriptor executionFlowDescriptor) { Map values = executionFlowDescriptor.getValues(); Map convertedValues = new HashMap(); + 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()); @@ -158,12 +176,15 @@ public class DefaultExecutionFlowDescriptorConverter implements } } } - if (ref == null) + if (ref == null) { log.warn("Cannot define reference for ref spec attribute " - + key + " in " + executionFlow + " (" + rsa + ")"); - else if (log.isDebugEnabled()) - log.debug(ref + " is the reference for ref spec attribute " - + key + " in " + executionFlow + " (" + rsa + ")"); + + key + " in " + executionFlow + " (" + rsa + ")." + + " If it is an inner bean consider put it frozen."); + } else { + if (log.isDebugEnabled()) + log.debug(ref + " is the reference for ref spec attribute " + + key + " in " + executionFlow + " (" + rsa + ")"); + } refValue.setRef(ref); } return refValue;