diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2023-02-26 14:27:06 +0000 |
---|---|---|
committer | danielhanrahan <daniel.hanrahan@est.tech> | 2023-02-28 16:29:20 +0000 |
commit | 373cdf2e88201f4262bdb3c933a0f84a4160bf72 (patch) | |
tree | f92fefdd04367bf58a03d969ef1123e768494dfb /cps-path-parser/src | |
parent | d7aa2fa43e3ffef8ed03c0a8688135cbd0c19f71 (diff) |
Skip deleting list xpaths that are list elements
List elements cannot be lists. Filtering list elements before trying
to delete lists by xpaths doubles performance when deleting list
elements (which doubles performance of CM handle de-registration).
Issue-ID: CPS-1511
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ieb6002212d006396d468f27f853708b5aa1e31f2
Diffstat (limited to 'cps-path-parser/src')
-rw-r--r-- | cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java | 11 | ||||
-rw-r--r-- | cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java | 6 |
2 files changed, 12 insertions, 5 deletions
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 c9df8df904..3985455263 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 @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation + * Copyright (C) 2021-2023 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,4 +80,13 @@ public class CpsPathQuery { return textFunctionConditionLeafName != 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 + */ + public boolean isPathToListElement() { + return cpsPathPrefixType == ABSOLUTE && hasLeafConditions(); + } + } 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 60f0e2efcd..bde9b0638f 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,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation + * Copyright (C) 2022-2023 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,6 @@ package org.onap.cps.cpspath.parser; -import static org.onap.cps.cpspath.parser.CpsPathPrefixType.ABSOLUTE; - import java.util.List; import lombok.AccessLevel; import lombok.Getter; @@ -75,7 +73,7 @@ public class CpsPathUtil { */ public static boolean isPathToListElement(final String xpathSource) { final CpsPathQuery cpsPathQuery = getCpsPathBuilder(xpathSource).build(); - return cpsPathQuery.getCpsPathPrefixType() == ABSOLUTE && cpsPathQuery.hasLeafConditions(); + return cpsPathQuery.isPathToListElement(); } /** |