diff options
author | 2024-12-03 13:26:09 +0000 | |
---|---|---|
committer | 2024-12-03 13:26:09 +0000 | |
commit | 902d17332d3e5cebe545991e01a5e55f739f0f80 (patch) | |
tree | c319db49944ee804c1d73947708391b3220d40f0 /cps-path-parser/src/main/java/org | |
parent | d6b552017a60769de4ec5e01274c0c1794c90f15 (diff) | |
parent | d262e1c3f4671673a02ea402366a8c9b93fe4e53 (diff) |
Merge "[Cps Path Parser] Introduce Attribute axis"
Diffstat (limited to 'cps-path-parser/src/main/java/org')
-rw-r--r-- | cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java | 7 | ||||
-rw-r--r-- | cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java index b67d70847c..d0deb7defc 100644 --- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java +++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java @@ -131,6 +131,13 @@ public class CpsPathBuilder extends CpsPathBaseListener { } @Override + public void exitAttributeAxis(final CpsPathParser.AttributeAxisContext ctx) { + final String attributeName = ctx.leafName().getText(); + normalizedXpathBuilder.append("/@").append(attributeName); + cpsPathQuery.setAttributeAxisAttributeName(attributeName); + } + + @Override public void exitTextFunctionCondition(final TextFunctionConditionContext ctx) { cpsPathQuery.setTextFunctionConditionLeafName(ctx.leafName().getText()); cpsPathQuery.setTextFunctionConditionValue(unwrapQuotedString(ctx.StringLiteral().getText())); diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java index 03602b64f6..3612ec57fb 100644 --- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java +++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java @@ -40,6 +40,7 @@ public class CpsPathQuery { private String descendantName; private List<LeafCondition> leafConditions; private String ancestorSchemaNodeIdentifier = ""; + private String attributeAxisAttributeName = ""; private String textFunctionConditionLeafName; private String textFunctionConditionValue; private List<String> booleanOperators; @@ -66,6 +67,15 @@ public class CpsPathQuery { } /** + * Has attribute axis been included in cpsPath. + * + * @return boolean value. + */ + public boolean hasAttributeAxis() { + return !(attributeAxisAttributeName.isEmpty()); + } + + /** * Have leaf value conditions been included in cpsPath. * * @return boolean value. |