]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlow.java
Add path in execution flow descriptor
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / execution / DefaultExecutionFlow.java
index e2c343de3ff4a15e563bcfbbae3ed1a0c1eaef9e..9d081d3fb8cf2e1405fa3bd67be97e6f547a19c5 100644 (file)
@@ -8,10 +8,14 @@ import java.util.UUID;
 
 import org.apache.commons.lang.math.RandomUtils;
 import org.argeo.slc.SlcException;
+import org.argeo.slc.core.structure.tree.TreeSPath;
+import org.argeo.slc.core.structure.tree.TreeSRegistry;
+import org.argeo.slc.execution.Executable;
 import org.argeo.slc.execution.ExecutionFlow;
 import org.argeo.slc.execution.ExecutionSpec;
 import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.process.Executable;
+import org.argeo.slc.structure.StructureAware;
+import org.argeo.slc.structure.StructureRegistry;
 import org.argeo.slc.test.ExecutableTestRun;
 import org.springframework.beans.factory.BeanNameAware;
 import org.springframework.beans.factory.InitializingBean;
@@ -24,6 +28,9 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
        private Map<String, Object> parameters = new HashMap<String, Object>();
        private List<Executable> executables = new ArrayList<Executable>();
 
+       private String path;
+       private StructureRegistry<TreeSPath> registry = new TreeSRegistry();
+
        public DefaultExecutionFlow() {
 
        }
@@ -82,6 +89,17 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
                if (errors.hasErrors())
                        throw new SlcException("Could not prepare execution flow: "
                                        + errors.toString());
+
+//             if (path == null) {
+//                     path = "/" + executionSpec.getName() + "/" + name;
+//             }
+
+               for (Executable executable : executables) {
+                       if (executable instanceof StructureAware) {
+                               ((StructureAware<TreeSPath>) executable).notifyCurrentPath(
+                                               registry, new TreeSPath(path));
+                       }
+               }
        }
 
        public void setBeanName(String name) {
@@ -140,4 +158,10 @@ public class DefaultExecutionFlow implements ExecutionFlow, InitializingBean,
        public boolean equals(Object obj) {
                return ((ExecutionFlow) obj).getName().equals(name);
        }
+
+       public String getPath() {
+               return path;
+       }
+       
+       
 }