CPS-1401 Implement V2 of GET Data Node API
[cps.git] / cps-service / src / main / java / org / onap / cps / spi / CpsDataPersistenceService.java
index 3e0b447..0b2cef9 100644 (file)
@@ -3,7 +3,7 @@
  *  Copyright (C) 2020-2023 Nordix Foundation.
  *  Modifications Copyright (C) 2021 Pantheon.tech
  *  Modifications Copyright (C) 2022 Bell Canada
- *  Modifications Copyright (C) 2022 TechMahindra Ltd.
+ *  Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -99,30 +99,33 @@ public interface CpsDataPersistenceService {
             Collection<Collection<DataNode>> newLists);
 
     /**
-     * Retrieves datanode by XPath for given dataspace and anchor.
+     * Retrieves multiple datanodes for a single XPath for given dataspace and anchor.
+     * Multiple data nodes are returned when xPath is set to root '/', otherwise single data node
+     * is returned when a specific xpath is used (Example: /bookstore).
      *
      * @param dataspaceName          dataspace name
      * @param anchorName             anchor name
-     * @param xpath                  xpath
+     * @param xpath                  one 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
+     * @return collection of data node object
      */
-    DataNode getDataNode(String dataspaceName, String anchorName, String xpath,
-        FetchDescendantsOption fetchDescendantsOption);
+    Collection<DataNode> getDataNodes(String dataspaceName, String anchorName, String xpath,
+                                      FetchDescendantsOption fetchDescendantsOption);
 
     /**
-     * Retrieves datanode by XPath for given dataspace and anchor.
+     * Retrieves multiple datanodes for multiple XPaths, given a 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<DataNode> getDataNodes(String dataspaceName, String anchorName, Collection<String> xpaths,
-                         FetchDescendantsOption fetchDescendantsOption);
+     * @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 collection of data node object
+     */
+    Collection<DataNode> getDataNodesForMultipleXpaths(String dataspaceName, String anchorName,
+                                                       Collection<String> xpaths,
+                                                       FetchDescendantsOption fetchDescendantsOption);
 
     /**
      * Updates leaves for existing data node.