Merge "BB workflow with post instantiation is not working"
[so.git] / adapters / etsi-sol003-adapter / etsi-sol003-package-management / etsi-sol003-package-management-adapter / src / main / java / org / onap / so / adapters / vnfmadapter / packagemanagement / subscriptionmanagement / cache / PackageManagementCacheServiceProvider.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2020 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.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache;
22
23 import java.util.Map;
24 import java.util.Optional;
25 import org.onap.so.adapters.vnfmadapter.packagemanagement.model.PkgmSubscriptionRequest;
26
27 /**
28  * Interface which provides methods for communicating with the cache
29  *
30  * @author Ronan Kenny (ronan.kenny@est.tech)
31  * @author Gareth Roper (gareth.roper@est.tech)
32  *
33  */
34 public interface PackageManagementCacheServiceProvider {
35
36     /**
37      * Checks cache if subscription request Id is already present. If not, it adds the subscription to the cache.
38      * 
39      * @param subscriptionId
40      * @param pkgmSubscriptionRequest
41      */
42     void addSubscription(final String subscriptionId, final PkgmSubscriptionRequest pkgmSubscriptionRequest);
43
44     /**
45      * Gets individual subscription from cache
46      * 
47      * @param subscriptionId
48      * @return <AbstractMap.SimpleImmutableEntry<String, PkgmSubscriptionRequest>>
49      */
50     Optional<PkgmSubscriptionRequest> getSubscription(final String subscriptionId);
51
52     /**
53      * Gets Map of subscriptions from cache
54      * 
55      * @return Map<String, PkgmSubscriptionRequest>>
56      */
57     Map<String, PkgmSubscriptionRequest> getSubscriptions();
58
59     /**
60      * Delete subscription from cache
61      * 
62      * @param subscriptionId
63      * @return Boolean
64      */
65     boolean deleteSubscription(final String subscriptionId);
66
67     /**
68      * Checks if subscription exists in cache and return its subscriptionId
69      * 
70      * @param pkgmSubscriptionRequest
71      * @return Subscription Id
72      */
73     Optional<String> getSubscriptionId(final PkgmSubscriptionRequest pkgmSubscriptionRequest);
74 }