Merge "RTD change to document migration to Spring Boot 3.0"
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / impl / ncmppersistence / NcmpPersistence.java
1 /*
2  * ============LICENSE_START=======================================================
3  * Copyright (C) 2022-2023 Nordix Foundation
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.ncmp.api.impl.ncmppersistence;
22
23 import java.time.OffsetDateTime;
24 import java.util.Collection;
25 import org.onap.cps.spi.FetchDescendantsOption;
26 import org.onap.cps.spi.model.DataNode;
27
28 /**
29  * DmiRegistryConstants class to be strictly used for DMI Related constants only.
30  */
31 public interface NcmpPersistence {
32
33     String NCMP_DATASPACE_NAME = "NCMP-Admin";
34     String NCMP_DMI_REGISTRY_ANCHOR = "ncmp-dmi-registry";
35     String NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME = "NFP-Operational";
36     String NCMP_DMI_REGISTRY_PARENT = "/dmi-registry";
37     OffsetDateTime NO_TIMESTAMP = null;
38
39     /**
40      * Method to delete a list or a list element.
41      *
42      * @param listElementXpath list element xPath
43      */
44     void deleteListOrListElement(String listElementXpath);
45
46     /**
47      * Method to delete a schema set.
48      *
49      * @param schemaSetName schema set name
50      */
51     void deleteSchemaSetWithCascade(String schemaSetName);
52
53     /**
54      * Method to delete multiple schema sets.
55      *
56      * @param schemaSetNames schema set names
57      */
58     void deleteSchemaSetsWithCascade(Collection<String> schemaSetNames);
59
60     /**
61      * Get data node via xpath.
62      *
63      * @param xpath xpath
64      * @return data node
65      */
66     Collection<DataNode> getDataNode(String xpath);
67
68     /**
69      * Get data node via xpath.
70      *
71      * @param xpath                  xpath
72      * @param fetchDescendantsOption fetch descendants option
73      * @return data node
74      */
75     Collection<DataNode> getDataNode(String xpath, FetchDescendantsOption fetchDescendantsOption);
76
77     /**
78      * Get collection of data nodes via xpaths.
79      *
80      * @param xpaths collection of xpaths
81      * @return collection of data nodes
82      */
83     Collection<DataNode> getDataNodes(Collection<String> xpaths);
84
85     /**
86      * Get collection of data nodes via xpaths.
87      *
88      * @param xpaths                 collection of xpaths
89      * @param fetchDescendantsOption fetch descendants option
90      * @return collection of data nodes
91      */
92     Collection<DataNode> getDataNodes(Collection<String> xpaths,
93                                               FetchDescendantsOption fetchDescendantsOption);
94
95     /**
96      * Replaces list content by removing all existing elements and inserting the given new elements as data nodes.
97      *
98      * @param parentNodeXpath parent node xpath
99      * @param dataNodes       datanodes representing the updated data
100      */
101     void replaceListContent(String parentNodeXpath, Collection<DataNode> dataNodes);
102
103     /**
104      * Deletes data node.
105      *
106      * @param dataNodeXpath data node xpath
107      */
108     void deleteDataNode(String dataNodeXpath);
109
110     /**
111      * Deletes multiple data nodes.
112      *
113      * @param dataNodeXpaths data node xpaths
114      */
115     void deleteDataNodes(Collection<String> dataNodeXpaths);
116 }