Code to Interface: CmHandleQueries
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / inventory / CmHandleQueries.java
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2022 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.inventory;
22
23 import java.util.List;
24 import java.util.Map;
25 import java.util.Set;
26 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
27 import org.onap.cps.spi.FetchDescendantsOption;
28 import org.onap.cps.spi.model.DataNode;
29
30 public interface CmHandleQueries {
31
32     /**
33      * Query CmHandles based on PublicProperties.
34      *
35      * @param publicPropertyQueryPairs public properties for query
36      * @return CmHandles which have these public properties
37      */
38     Map<String, NcmpServiceCmHandle> queryCmHandlePublicProperties(Map<String, String> publicPropertyQueryPairs);
39
40     /**
41      * Combine Maps of CmHandles.
42      *
43      * @param firstQuery  first CmHandles Map
44      * @param secondQuery second CmHandles Map
45      * @return combined Map of CmHandles
46      */
47     Map<String, NcmpServiceCmHandle> combineCmHandleQueries(Map<String, NcmpServiceCmHandle> firstQuery,
48             Map<String, NcmpServiceCmHandle> secondQuery);
49
50     /**
51      * Method which returns cm handles by the cm handles state.
52      *
53      * @param cmHandleState cm handle state
54      * @return a list of cm handles
55      */
56     List<DataNode> queryCmHandlesByState(CmHandleState cmHandleState);
57
58     /**
59      * Method to return data nodes representing the cm handles.
60      *
61      * @param cpsPath cps path for which the cmHandle is requested
62      * @return a list of data nodes representing the cm handles.
63      */
64     List<DataNode> queryCmHandleDataNodesByCpsPath(String cpsPath, FetchDescendantsOption fetchDescendantsOption);
65
66     /**
67      * Method to check the state of a cm handle with given id.
68      *
69      * @param cmHandleId            cm handle id
70      * @param requiredCmHandleState the required state of the cm handle
71      * @return a boolean, true if the state is equal to the required state
72      */
73     boolean cmHandleHasState(String cmHandleId, CmHandleState requiredCmHandleState);
74
75     /**
76      * Method which returns cm handles by the operational sync state of cm handle.
77      *
78      * @param dataStoreSyncState sync state
79      * @return a list of cm handles
80      */
81     List<DataNode> queryCmHandlesByOperationalSyncState(DataStoreSyncState dataStoreSyncState);
82
83     /**
84      * Get all cm handles by DMI plugin identifier.
85      *
86      * @param dmiPluginIdentifier DMI plugin identifier
87      * @return set of cm handles
88      */
89     Set<NcmpServiceCmHandle> getCmHandlesByDmiPluginIdentifier(String dmiPluginIdentifier);
90 }