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=27929b4b6fbaff5b34e7a62e8cf6f4ccf398a2a0;hb=32f9566efa0d0ce29b31ee0779faf2b42f46321a;hp=277e4df0c93ab52a892f894343770ab4262a7e74;hpb=827cc6fa4bff1994f89cb8d925808def5600b5dc;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 277e4df0c..27929b4b6 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 @@ -40,7 +40,6 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.util.Assert; import org.springframework.util.StringUtils; /** @@ -59,6 +58,7 @@ public class DefaultExecutionFlowDescriptorConverter implements private ApplicationContext applicationContext; + @SuppressWarnings("unused") public Map convertValues( ExecutionFlowDescriptor executionFlowDescriptor) { Map values = executionFlowDescriptor.getValues(); @@ -74,7 +74,11 @@ public class DefaultExecutionFlowDescriptorConverter implements ExecutionSpecAttribute attribute = executionSpec .getAttributes().get(key); - if (attribute.getIsFrozen()) + if (attribute == null) + throw new SlcException("No spec attribute defined for '" + + key + "'"); + + if (attribute.getIsConstant()) continue values; Object value = values.get(key); @@ -130,6 +134,8 @@ public class DefaultExecutionFlowDescriptorConverter implements throw new UnsupportedException("Ref value type", refValue.getType()); } + } else { + convertedValues.put(key, value); } } } @@ -157,14 +163,19 @@ public class DefaultExecutionFlowDescriptorConverter implements md.getExecutionFlows().addAll(set); } + @SuppressWarnings("deprecation") public ExecutionFlowDescriptor getExecutionFlowDescriptor( ExecutionFlow executionFlow) { - Assert.notNull(executionFlow.getName()); + if (executionFlow.getName() == null) + throw new SlcException("Flow name is null: " + executionFlow); String name = executionFlow.getName(); ExecutionSpec executionSpec = executionFlow.getExecutionSpec(); - Assert.notNull(executionSpec); - Assert.notNull(executionSpec.getName()); + if (executionSpec == null) + throw new SlcException("Execution spec is null: " + executionFlow); + if (executionSpec.getName() == null) + throw new SlcException("Execution spec name is null: " + + executionSpec); Map values = new TreeMap(); for (String key : executionSpec.getAttributes().keySet()) { @@ -184,7 +195,7 @@ public class DefaultExecutionFlowDescriptorConverter implements // all necessary information is in the spec } } else if (attribute instanceof RefSpecAttribute) { - if (attribute.getIsFrozen()) { + if (attribute.getIsConstant()) { values.put(key, new RefValue(REF_VALUE_INTERNAL)); } else values.put( @@ -217,7 +228,7 @@ public class DefaultExecutionFlowDescriptorConverter implements RefValue refValue = new RefValue(); // FIXME: UI should be able to deal with other types refValue.setType(REF_VALUE_TYPE_BEAN_NAME); - Class targetClass = rsa.getTargetClass(); + Class targetClass = rsa.getTargetClass(); String primitiveType = PrimitiveUtils.classAsType(targetClass); if (primitiveType != null) { if (executionFlow.isSetAsParameter(key)) { @@ -288,6 +299,7 @@ public class DefaultExecutionFlowDescriptorConverter implements private static class ExecutionFlowDescriptorComparator implements Comparator { + @SuppressWarnings("deprecation") public int compare(ExecutionFlowDescriptor o1, ExecutionFlowDescriptor o2) { // TODO: write unit tests for this