Merge "Fix security hotspots n Regex"
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / NetworkCmProxyDataService.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2021 highstreet technologies GmbH
4  *  Copyright (C) 2021 Nordix Foundation
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
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;
22
23 import java.util.Collection;
24 import org.checkerframework.checker.nullness.qual.NonNull;
25 import org.onap.cps.spi.FetchDescendantsOption;
26 import org.onap.cps.spi.model.DataNode;
27
28 /*
29  * Datastore interface for handling CPS data.
30  */
31 public interface NetworkCmProxyDataService {
32
33     /**
34      * Retrieves datanode by XPath for a given cm handle.
35      *
36      * @param cmHandle               The identifier for a network function, network element, subnetwork or any other cm
37      *                               object by managed Network CM Proxy
38      * @param xpath                  xpath
39      * @param fetchDescendantsOption defines the scope of data to fetch: either single node or all the descendant nodes
40      *                               (recursively) as well
41      * @return data node object
42      */
43     DataNode getDataNode(@NonNull String cmHandle, @NonNull String xpath,
44         @NonNull FetchDescendantsOption fetchDescendantsOption);
45
46     /**
47      * Get datanodes for the given cm handle by cps path.
48      *
49      * @param cmHandle               The identifier for a network function, network element, subnetwork or any other cm
50      *                               object by managed Network CM Proxy
51      * @param cpsPath                cps path
52      * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
53      *                               included in the output
54      * @return a collection of datanodes
55      */
56     Collection<DataNode> queryDataNodes(@NonNull String cmHandle, @NonNull String cpsPath,
57         @NonNull FetchDescendantsOption fetchDescendantsOption);
58
59     /**
60      * Updates data node for given cm handle using xpath to parent node.
61      *
62      * @param cmHandle        The identifier for a network function, network element, subnetwork or any other cm object
63      *                        by managed Network CM Proxy
64      * @param parentNodeXpath xpath to parent node
65      * @param jsonData        json data
66      */
67     void updateNodeLeaves(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
68
69     /**
70      * Replaces existing data node content including descendants.
71      *
72      * @param cmHandle        The identifier for a network function, network element, subnetwork or any other cm object
73      *                        by managed Network CM Proxy
74      * @param parentNodeXpath xpath to parent node
75      * @param jsonData        json data
76      */
77     void replaceNodeTree(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
78
79 }