Add fix for posting nodes with xPath with '/'
[cps.git] / cps-path-parser / src / main / java / org / onap / cps / cpspath / parser / CpsPathUtil.java
index 283463b..60f0e2e 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.cps.cpspath.parser;
 
 import static org.onap.cps.cpspath.parser.CpsPathPrefixType.ABSOLUTE;
 
+import java.util.List;
 import lombok.AccessLevel;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -60,6 +61,11 @@ public class CpsPathUtil {
         return getCpsPathBuilder(xpathSource).build().getNormalizedParentPath();
     }
 
+    public static String[] getXpathNodeIdSequence(final String xpathSource) {
+        final List<String> containerNames = getCpsPathBuilder(xpathSource).build().getContainerNames();
+        return containerNames.toArray(new String[containerNames.size()]);
+    }
+
 
     /**
      * Returns boolean indicating xpath is an absolute path to a list element.