/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
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;
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.
*/
public static boolean isPathToListElement(final String xpathSource) {
final CpsPathQuery cpsPathQuery = getCpsPathBuilder(xpathSource).build();
- return cpsPathQuery.getCpsPathPrefixType() == ABSOLUTE && cpsPathQuery.hasLeafConditions();
+ return cpsPathQuery.isPathToListElement();
}
/**