Fix regression when adding flow nodes
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 22 Mar 2013 16:12:34 +0000 (16:12 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 22 Mar 2013 16:12:34 +0000 (16:12 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@6208 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java

index 9e866dfc79051f37f303cb5239d30bb4f7d3dcb3..ea734a8bbd6da7eed8c427b5321b7e74af6e5832 100644 (file)
@@ -296,16 +296,14 @@ public class JcrExecutionModulesListener implements ExecutionModulesListener,
                        flowNode.setProperty(SLC_SPEC, executionSpecNode);
                }
 
-               // values
+               // flow values
                for (String attr : efd.getValues().keySet()) {
                        ExecutionSpecAttribute esa = executionSpec.getAttributes()
                                        .get(attr);
-                       if (!flowNode.hasNode(attr))
-                               throw new SlcException("No spec node for attribute '" + attr
-                                               + "' in flow " + flowNode.getPath());
                        if (esa instanceof PrimitiveSpecAttribute) {
                                PrimitiveSpecAttribute psa = (PrimitiveSpecAttribute) esa;
-                               Node valueNode = flowNode.getNode(attr);
+                               // if spec reference there will be no node at this stage
+                               Node valueNode = JcrUtils.getOrAdd(flowNode, attr);
                                valueNode.setProperty(SLC_TYPE, psa.getType());
                                SlcJcrUtils.setPrimitiveAsProperty(valueNode, SLC_VALUE,
                                                (PrimitiveValue) efd.getValues().get(attr));