diff options
author | 2024-11-07 15:33:39 +0530 | |
---|---|---|
committer | 2025-03-12 09:34:37 +0530 | |
commit | 646caa6ccba0eda7d9a681761ae03df5d2c45f1d (patch) | |
tree | 35e488e6860c6629d32c350b37178859cb8eae24 /cps-path-parser/src/main/java | |
parent | ab96e052a6725ad0cc5e56ae69461c352c83551f (diff) |
Refactor buildDataNodes to a separate service
- Moved the code for buildDataNodes from CpsDataServiceImpl.java to a
separate service named DataNodeBuilderService.java
- Renamed the methods to be clear and in-line with their intended use in
DataNodeBuilderService class
- Moved ROOT_NODE_XPATH and NO_PARENT_PATH to CpsPathUtils
Issue-ID: CPS-2487
Change-Id: I46cf843ab79b1e2547d968fbd30528270b95cc16
Signed-off-by: Arpit Singh <AS00745003@techmahindra.com>
Diffstat (limited to 'cps-path-parser/src/main/java')
-rw-r--r-- | cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java index 4ede0d9c90..2c896dc3cd 100644 --- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java +++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2022-2024 Nordix Foundation + * Modifications Copyright (C) 2025 TechMahindra Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +40,9 @@ import org.onap.cps.cpspath.parser.antlr4.CpsPathParser; @NoArgsConstructor(access = AccessLevel.PACKAGE) public class CpsPathUtil { + public static final String ROOT_NODE_XPATH = "/"; + public static final String NO_PARENT_PATH = ""; + /** * Returns a normalized xpath path query. * @@ -46,6 +50,9 @@ public class CpsPathUtil { * @return a normalized xpath String. */ public static String getNormalizedXpath(final String xpathSource) { + if (ROOT_NODE_XPATH.equals(xpathSource)) { + return NO_PARENT_PATH; + } return getCpsPathBuilder(xpathSource).build().getNormalizedXpath(); } |