summaryrefslogtreecommitdiffstats
path: root/cps-path-parser/src/main/java/org
diff options
context:
space:
mode:
authorRudrangi Anupriya <ra00745022@techmahindra.com>2023-04-17 14:19:46 +0530
committerRudrangi Anupriya <ra00745022@techmahindra.com>2023-04-21 13:44:18 +0530
commitd7bc158cd274b3d6cd01bcad86aef258e6880c1c (patch)
treec94fa03528b6ed4fbb2672267482542dd59f7b73 /cps-path-parser/src/main/java/org
parentc4621cbcb1f9aad97ba3389468546444d1e9f3dc (diff)
Add contains condition support to cps-path
Issue-ID: CPS-1272 Change-Id: Ic81d1322cacc64a8752916324b801d02be47d34f Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
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.java6
-rw-r--r--cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java11
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