]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/SlcJcrUtils.java
Work in progress - work on modular distributions.
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.jcr / src / main / java / org / argeo / slc / jcr / SlcJcrUtils.java
index 3473827cdd7a2e921cd12f9905689c8442fefdc7..5c00bcffb1be2b49f0f28f01353cb6917ef93ae4 100644 (file)
@@ -28,6 +28,8 @@ import javax.jcr.nodetype.NodeType;
 
 import org.argeo.jcr.JcrUtils;
 import org.argeo.jcr.UserJcrUtils;
+import org.argeo.slc.BasicNameVersion;
+import org.argeo.slc.NameVersion;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.core.execution.PrimitiveAccessor;
 import org.argeo.slc.core.execution.PrimitiveUtils;
@@ -70,6 +72,15 @@ public class SlcJcrUtils implements SlcNames {
                return moduleName;
        }
 
+       /** Extracts the module name and version from a flow path */
+       public static NameVersion moduleNameVersion(String fullFlowPath) {
+               String[] tokens = fullFlowPath.split("/");
+               String module = tokens[AGENT_FACTORY_DEPTH + 2];
+               String moduleName = module.substring(0, module.indexOf('_'));
+               String moduleVersion = module.substring(module.indexOf('_') + 1);
+               return new BasicNameVersion(moduleName, moduleVersion);
+       }
+
        /** Module node name based on module name and version */
        public static String getModuleNodeName(ModuleDescriptor moduleDescriptor) {
                return moduleDescriptor.getName() + "_" + moduleDescriptor.getVersion();
@@ -196,9 +207,14 @@ public class SlcJcrUtils implements SlcNames {
 
                        NodeIterator it = node.getNodes();
                        while (it.hasNext()) {
-                               Integer childStatus = aggregateTestStatus(it.nextNode());
-                               if (childStatus > status)
-                                       status = childStatus;
+                               Node curr = it.nextNode();
+
+                               // Manually skip aggregated status
+                               if (!SlcNames.SLC_AGGREGATED_STATUS.equals(curr.getName())) {
+                                       Integer childStatus = aggregateTestStatus(curr);
+                                       if (childStatus > status)
+                                               status = childStatus;
+                               }
                        }
                        return status;
                } catch (Exception e) {
@@ -232,7 +248,10 @@ public class SlcJcrUtils implements SlcNames {
                        NodeIterator it = node.getNodes();
                        while (it.hasNext()) {
                                Node child = it.nextNode();
-                               aggregateTestMessages(child, messages);
+                               // Manually skip aggregated status
+                               if (!SlcNames.SLC_AGGREGATED_STATUS.equals(child.getName())) {
+                                       aggregateTestMessages(child, messages);
+                               }
                        }
                        return messages;
                } catch (Exception e) {
@@ -243,6 +262,5 @@ public class SlcJcrUtils implements SlcNames {
 
        /** Prevents instantiation */
        private SlcJcrUtils() {
-
        }
-}
+}
\ No newline at end of file