Merge "Device heartbeat listener"
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / inventory / InventoryPersistence.java
index bfc3a9a..cbd30a8 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation
+ *  Copyright (C) 2022-2023 Nordix Foundation
+ *  Modifications Copyright (C) 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.
@@ -23,7 +24,7 @@ package org.onap.cps.ncmp.api.inventory;
 import java.util.Collection;
 import java.util.Map;
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle;
-import org.onap.cps.spi.model.Anchor;
+import org.onap.cps.spi.FetchDescendantsOption;
 import org.onap.cps.spi.model.DataNode;
 import org.onap.cps.spi.model.ModuleDefinition;
 import org.onap.cps.spi.model.ModuleReference;
@@ -61,6 +62,14 @@ public interface InventoryPersistence {
      */
     YangModelCmHandle getYangModelCmHandle(String cmHandleId);
 
+    /**
+     * This method retrieves DMI service name, DMI properties and the state for a given cm handle.
+     *
+     * @param cmHandleIds a list of the ids of the cm handles
+     * @return collection of yang model cm handles
+     */
+    Collection<YangModelCmHandle> getYangModelCmHandles(Collection<String> cmHandleIds);
+
     /**
      * Method to return module definitions by cmHandleId.
      *
@@ -105,13 +114,46 @@ public interface InventoryPersistence {
      */
     void deleteSchemaSetWithCascade(String schemaSetName);
 
+    /**
+     * Method to delete multiple schema sets.
+     *
+     * @param schemaSetNames schema set names
+     */
+    void deleteSchemaSetsWithCascade(Collection<String> schemaSetNames);
+
+    /**
+     * Get data node via xpath.
+     *
+     * @param xpath xpath
+     * @return data node
+     */
+    Collection<DataNode> getDataNode(String xpath);
+
     /**
      * Get data node via xpath.
      *
      * @param xpath xpath
+     * @param fetchDescendantsOption fetch descendants option
      * @return data node
      */
-    DataNode getDataNode(String xpath);
+    Collection<DataNode> getDataNode(String xpath, FetchDescendantsOption fetchDescendantsOption);
+
+    /**
+     * Get collection of data nodes via xpaths.
+     *
+     * @param xpaths collection of xpaths
+     * @return collection of data nodes
+     */
+    Collection<DataNode> getDataNodes(Collection<String> xpaths);
+
+    /**
+     * Get collection of data nodes via xpaths.
+     *
+     * @param xpaths collection of xpaths
+     * @param fetchDescendantsOption fetch descendants option
+     * @return collection of data nodes
+     */
+    Collection<DataNode> getDataNodes(Collection<String> xpaths, FetchDescendantsOption fetchDescendantsOption);
 
     /**
      * Get data node of given cm handle.
@@ -119,22 +161,23 @@ public interface InventoryPersistence {
      * @param cmHandleId cmHandle ID
      * @return data node
      */
-    DataNode getCmHandleDataNode(String cmHandleId);
+    Collection<DataNode> getCmHandleDataNode(String cmHandleId);
 
     /**
-     * Query anchors via module names.
+     * Get collection of data nodes of given cm handles.
      *
-     * @param moduleNamesForQuery module names
-     * @return Collection of anchors
+     * @param cmHandleIds collection of cmHandle IDs
+     * @return collection of data nodes
      */
-    Collection<Anchor> queryAnchors(Collection<String> moduleNamesForQuery);
+    Collection<DataNode> getCmHandleDataNodes(Collection<String> cmHandleIds);
 
     /**
-     * Method to get all anchors.
+     * get CM handles that has given module names.
      *
-     * @return Collection of anchors
+     * @param moduleNamesForQuery module names
+     * @return Collection of CM handle Ids
      */
-    Collection<Anchor> getAnchors();
+    Collection<String> getCmHandleIdsWithGivenModules(Collection<String> moduleNamesForQuery);
 
     /**
      * Replaces list content by removing all existing elements and inserting the given new elements as data nodes.
@@ -145,9 +188,16 @@ public interface InventoryPersistence {
     void replaceListContent(String parentNodeXpath, Collection<DataNode> dataNodes);
 
     /**
-     * Deletes data node for given anchor and dataspace.
+     * Deletes data node.
      *
      * @param dataNodeXpath data node xpath
      */
     void deleteDataNode(String dataNodeXpath);
+
+    /**
+     * Deletes multiple data nodes.
+     *
+     * @param dataNodeXpaths data node xpaths
+     */
+    void deleteDataNodes(Collection<String> dataNodeXpaths);
 }