diff options
author | 2023-04-21 14:31:07 +0000 | |
---|---|---|
committer | 2023-04-21 14:31:07 +0000 | |
commit | f5d8051bef715762a31f54d052f7e126e8276fd0 (patch) | |
tree | fe2b973b045f8b1414f9ae0556c09d90dee557f7 /cps-path-parser/src/main/java | |
parent | b3c3d36266493a93cb40a5d76de9fc5b80fec789 (diff) | |
parent | d7bc158cd274b3d6cd01bcad86aef258e6880c1c (diff) |
Merge "Add contains condition support to cps-path"
Diffstat (limited to 'cps-path-parser/src/main/java')
-rw-r--r-- | cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java | 6 | ||||
-rw-r--r-- | cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java | 11 |
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 4299d13081..854450c8bb 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 @@ -150,6 +150,12 @@ public class CpsPathBuilder extends CpsPathBaseListener { } @Override + public void exitContainsFunctionCondition(final CpsPathParser.ContainsFunctionConditionContext ctx) { + cpsPathQuery.setContainsFunctionConditionLeafName(ctx.leafName().getText()); + cpsPathQuery.setContainsFunctionConditionValue(stripFirstAndLastCharacter(ctx.StringLiteral().getText())); + } + + @Override public void enterListElementRef(final CpsPathParser.ListElementRefContext ctx) { normalizedXpathBuilder.append(OPEN_BRACKET); if (processingAncestorAxis) { 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 2c96d91051..418b5ec55b 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 @@ -44,6 +44,8 @@ public class CpsPathQuery { private String textFunctionConditionLeafName; private String textFunctionConditionValue; private List<String> booleanOperatorsType; + private String containsFunctionConditionLeafName; + private String containsFunctionConditionValue; /** * Returns a cps path query. @@ -83,6 +85,15 @@ public class CpsPathQuery { } /** + * Has contains function condition been included in cpsPath. + * + * @return boolean value. + */ + public boolean hasContainsFunctionCondition() { + return containsFunctionConditionLeafName != null; + } + + /** * Returns boolean indicating xpath is an absolute path to a list element. * * @return true if xpath is an absolute path to a list element |