Merge "Add withTrustLevel condition to CmHandle Query API"
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / impl / inventory / CmHandleQueries.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.inventory;
22
23 import java.util.Collection;
24 import java.util.List;
25 import java.util.Map;
26 import org.onap.cps.spi.FetchDescendantsOption;
27 import org.onap.cps.spi.model.DataNode;
28
29 public interface CmHandleQueries {
30
31     /**
32      * Query CmHandles based on additional (private) properties.
33      *
34      * @param additionalPropertyQueryPairs private properties for query
35      * @return Ids of CmHandles which have these private properties
36      */
37     Collection<String> queryCmHandleAdditionalProperties(Map<String, String> additionalPropertyQueryPairs);
38
39     /**
40      * Query CmHandles based on public properties.
41      *
42      * @param publicPropertyQueryPairs public properties for query
43      * @return CmHandles which have these public properties
44      */
45     Collection<String> queryCmHandlePublicProperties(Map<String, String> publicPropertyQueryPairs);
46
47     /**
48      * Query CmHandles based on Trust Level.
49      *
50      * @param trustLevelPropertyQueryPairs trust level properties for query
51      * @return CmHandles which have desired trust level
52      */
53     Collection<String> queryCmHandlesByTrustLevel(Map<String, String> trustLevelPropertyQueryPairs);
54
55     /**
56      * Method which returns cm handles by the cm handles state.
57      *
58      * @param cmHandleState cm handle state
59      * @return a list of cm handles
60      */
61     List<DataNode> queryCmHandlesByState(CmHandleState cmHandleState);
62
63     /**
64      * Method to return data nodes with ancestor representing the cm handles.
65      *
66      * @param cpsPath cps path for which the cmHandle is requested
67      * @return a list of data nodes representing the cm handles.
68      */
69     List<DataNode> queryCmHandleAncestorsByCpsPath(String cpsPath,
70                                                    FetchDescendantsOption fetchDescendantsOption);
71
72     /**
73      * Method to return data nodes representing the cm handles.
74      *
75      * @param cpsPath cps path for which the cmHandle is requested
76      * @return a list of data nodes representing the cm handles.
77      */
78     List<DataNode> queryNcmpRegistryByCpsPath(String cpsPath, FetchDescendantsOption fetchDescendantsOption);
79
80     /**
81      * Method to check the state of a cm handle with given id.
82      *
83      * @param cmHandleId            cm handle id
84      * @param requiredCmHandleState the required state of the cm handle
85      * @return a boolean, true if the state is equal to the required state
86      */
87     boolean cmHandleHasState(String cmHandleId, CmHandleState requiredCmHandleState);
88
89     /**
90      * Method which returns cm handles by the operational sync state of cm handle.
91      *
92      * @param dataStoreSyncState sync state
93      * @return a list of cm handles
94      */
95     List<DataNode> queryCmHandlesByOperationalSyncState(DataStoreSyncState dataStoreSyncState);
96
97     /**
98      * Get all cm handles ids by DMI plugin identifier.
99      *
100      * @param dmiPluginIdentifier DMI plugin identifier
101      * @return collection of cm handles
102      */
103     Collection<String> getCmHandleIdsByDmiPluginIdentifier(String dmiPluginIdentifier);
104 }