2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2022-2023 Nordix Foundation
4 * Modifications Copyright (C) 2023 TechMahindra Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.cps.ncmp.api.impl.inventory;
24 import java.util.Collection;
26 import org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence;
27 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle;
28 import org.onap.cps.spi.model.DataNode;
29 import org.onap.cps.spi.model.ModuleDefinition;
30 import org.onap.cps.spi.model.ModuleReference;
32 public interface InventoryPersistence extends NcmpPersistence {
35 * Get the Cm Handle Composite State from the data node.
37 * @param cmHandleId cm handle id
38 * @return the cm handle composite state
40 CompositeState getCmHandleState(String cmHandleId);
43 * Save the cm handles state.
45 * @param cmHandleId cm handle id
46 * @param compositeState composite state
48 void saveCmHandleState(String cmHandleId, CompositeState compositeState);
51 * Save all cm handles states in batch.
53 * @param cmHandleStatePerCmHandleId contains cm handle id and updated state
55 void saveCmHandleStateBatch(Map<String, CompositeState> cmHandleStatePerCmHandleId);
58 * This method retrieves DMI service name, DMI properties and the state for a given cm handle.
60 * @param cmHandleId the id of the cm handle
61 * @return yang model cm handle
63 YangModelCmHandle getYangModelCmHandle(String cmHandleId);
66 * This method retrieves DMI service name, DMI properties and the state for a given cm handle.
68 * @param cmHandleIds a list of the ids of the cm handles
69 * @return collection of yang model cm handles
71 Collection<YangModelCmHandle> getYangModelCmHandles(Collection<String> cmHandleIds);
74 * Method to return module definitions by cmHandleId.
76 * @param cmHandleId cm handle ID
77 * @return a collection of module definitions (moduleName, revision and yang resource content)
79 Collection<ModuleDefinition> getModuleDefinitionsByCmHandleId(String cmHandleId);
82 * Method to return module references by cmHandleId.
84 * @param cmHandleId cm handle ID
85 * @return a collection of module references (moduleName and revision)
87 Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandleId);
90 * Method to save cmHandle.
92 * @param yangModelCmHandle cmHandle represented as Yang Model
94 void saveCmHandle(YangModelCmHandle yangModelCmHandle);
97 * Method to save batch of cm handles.
99 * @param yangModelCmHandles cm handle represented as Yang Models
101 void saveCmHandleBatch(Collection<YangModelCmHandle> yangModelCmHandles);
104 * Get data node of given cm handle.
106 * @param cmHandleId cmHandle ID
109 Collection<DataNode> getCmHandleDataNode(String cmHandleId);
112 * Get collection of data nodes of given cm handles.
114 * @param cmHandleIds collection of cmHandle IDs
115 * @return collection of data nodes
117 Collection<DataNode> getCmHandleDataNodes(Collection<String> cmHandleIds);
120 * get CM handles that has given module names.
122 * @param moduleNamesForQuery module names
123 * @return Collection of CM handle Ids
125 Collection<String> getCmHandleIdsWithGivenModules(Collection<String> moduleNamesForQuery);