diff options
author | 2023-05-08 09:57:37 +0000 | |
---|---|---|
committer | 2023-05-08 09:57:37 +0000 | |
commit | 492b6660fb153dd3dbf52c693a0b86bed3bee4f5 (patch) | |
tree | 9b5e3cb5f00cdb99c5541f5092541670a112a1d7 /cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java | |
parent | ee52f4f50281e3e479ddda7cddf29c2362e413d6 (diff) | |
parent | d94dd78ad001d72182133f7681b979d730698d83 (diff) |
Merge "Use recursive SQL to fetch descendants in CpsPath queries (CPS-1664 #4)"
Diffstat (limited to 'cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java')
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java index 515bbd616..76cfaa89f 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java @@ -46,7 +46,6 @@ public class FragmentQueryBuilder { private static final String REGEX_ABSOLUTE_PATH_PREFIX = "^"; private static final String REGEX_DESCENDANT_PATH_PREFIX = "^.*\\/"; private static final String REGEX_OPTIONAL_LIST_INDEX_POSTFIX = "(\\[@(?!.*\\[).*?])?$"; - private static final String REGEX_FOR_QUICK_FIND_WITH_DESCENDANTS = "(\\[@.*?])?(\\/.*)?$"; private static final AnchorEntity ACROSS_ALL_ANCHORS = null; @PersistenceContext @@ -77,31 +76,12 @@ public class FragmentQueryBuilder { return getQueryForDataspaceOrAnchorAndCpsPath(dataspaceEntity, ACROSS_ALL_ANCHORS, cpsPathQuery); } - /** - * Create a regular expression (string) for matching xpaths based on the given cps path query. - * - * @param cpsPathQuery the cps path query to determine the required regular expression - * @return a string representing the required regular expression - */ - public static String getXpathSqlRegex(final CpsPathQuery cpsPathQuery) { + private static String getXpathSqlRegex(final CpsPathQuery cpsPathQuery) { final StringBuilder xpathRegexBuilder = getRegexStringBuilderWithPrefix(cpsPathQuery); xpathRegexBuilder.append(REGEX_OPTIONAL_LIST_INDEX_POSTFIX); return xpathRegexBuilder.toString(); } - /** - * Create a regular expression (string) for matching xpaths with (all) descendants - * based on the given cps path query. - * - * @param cpsPathQuery the cps path query to determine the required regular expression - * @return a string representing the required regular expression - */ - public static String getXpathSqlRegexForQuickFindWithDescendants(final CpsPathQuery cpsPathQuery) { - final StringBuilder xpathRegexBuilder = getRegexStringBuilderWithPrefix(cpsPathQuery); - xpathRegexBuilder.append(REGEX_FOR_QUICK_FIND_WITH_DESCENDANTS); - return xpathRegexBuilder.toString(); - } - private Query getQueryForDataspaceOrAnchorAndCpsPath(final DataspaceEntity dataspaceEntity, final AnchorEntity anchorEntity, final CpsPathQuery cpsPathQuery) { |