From 9c56b3032222b57549aa17dd281e4794fd9e25b6 Mon Sep 17 00:00:00 2001 From: seanbeirne Date: Thu, 15 Dec 2022 16:06:20 +0000 Subject: Fetch CM handles by collection of xpaths - Added FragmentRepositoryMultiPathQuery - Removed Hibernate method for same - Added perf. test - Handle escaping of single qoutes in sql-data - Increased timing for path paser performance test Issue-ID: CPS-1422 Signed-off-by: seanbeirne Change-Id: Ibea12a44bffd29ed43cc1560b507d1fa7e968b8b --- .../src/main/java/org/onap/cps/api/CpsDataService.java | 13 +++++++++++++ .../main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java | 8 ++++++++ .../java/org/onap/cps/spi/CpsDataPersistenceService.java | 13 +++++++++++++ 3 files changed, 34 insertions(+) (limited to 'cps-service') diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java b/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java index 012d7f825..6332f0910 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java @@ -122,6 +122,19 @@ public interface CpsDataService { DataNode getDataNode(String dataspaceName, String anchorName, String xpath, FetchDescendantsOption fetchDescendantsOption); + /** + * Retrieves datanodes by XPath for given dataspace and anchor. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @param xpaths collection of xpath + * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes + * (recursively) as well + * @return data node object + */ + Collection getDataNodes(String dataspaceName, String anchorName, Collection xpaths, + FetchDescendantsOption fetchDescendantsOption); + /** * Updates data node for given dataspace and anchor using xpath to parent node. * diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java index 65dfa7f5c..38fa92a09 100755 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java @@ -129,6 +129,14 @@ public class CpsDataServiceImpl implements CpsDataService { return cpsDataPersistenceService.getDataNode(dataspaceName, anchorName, xpath, fetchDescendantsOption); } + @Override + public Collection getDataNodes(final String dataspaceName, final String anchorName, + final Collection xpaths, + final FetchDescendantsOption fetchDescendantsOption) { + cpsValidator.validateNameCharacters(dataspaceName, anchorName); + return cpsDataPersistenceService.getDataNodes(dataspaceName, anchorName, xpaths, fetchDescendantsOption); + } + @Override public void updateNodeLeaves(final String dataspaceName, final String anchorName, final String parentNodeXpath, final String jsonData, final OffsetDateTime observedTimestamp) { diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java index b9da4af02..0989ccae2 100644 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java @@ -111,6 +111,19 @@ public interface CpsDataPersistenceService { DataNode getDataNode(String dataspaceName, String anchorName, String xpath, FetchDescendantsOption fetchDescendantsOption); + /** + * Retrieves datanode by XPath for given dataspace and anchor. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @param xpaths collection of xpaths + * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes + * (recursively) as well + * @return data node object + */ + Collection getDataNodes(String dataspaceName, String anchorName, Collection xpaths, + FetchDescendantsOption fetchDescendantsOption); + /** * Updates leaves for existing data node. * -- cgit 1.2.3-korg