]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionProcess.java
Fix bug 28 (https://www.argeo.org/bugzilla/show_bug.cgi?id=28)
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.jcr / src / main / java / org / argeo / slc / jcr / execution / JcrExecutionProcess.java
index d96abf0972cbf94f3d5540d4328d22f0365591f4..e9a3b6380fd803dcc478b9a7e6375fe3f8eb91d1 100644 (file)
  */
 package org.argeo.slc.jcr.execution;
 
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.List;
 
 import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 
@@ -29,6 +31,7 @@ import org.argeo.jcr.JcrUtils;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.execution.ExecutionProcess;
 import org.argeo.slc.execution.ExecutionStep;
+import org.argeo.slc.execution.RealizedFlow;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
 
@@ -137,6 +140,25 @@ public class JcrExecutionProcess implements ExecutionProcess, SlcNames {
        // return node;
        // }
 
+       public List<RealizedFlow> getRealizedFlows() {
+               try {
+                       List<RealizedFlow> realizedFlows = new ArrayList<RealizedFlow>();
+                       Node rootRealizedFlowNode = node.getNode(SLC_FLOW);
+                       // we just manage one level for the time being
+                       NodeIterator nit = rootRealizedFlowNode.getNodes(SLC_FLOW);
+                       while (nit.hasNext()) {
+                               Node realizedFlowNode = nit.nextNode();
+                               RealizedFlow realizedFlow = new JcrRealizedFlow(
+                                               realizedFlowNode);
+                               if (realizedFlow != null)
+                                       realizedFlows.add(realizedFlow);
+                       }
+                       return realizedFlows;
+               } catch (RepositoryException e) {
+                       throw new SlcException("Cannot get realized flows", e);
+               }
+       }
+
        public String getNodePath() {
                try {
                        return node.getPath();