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
 
   9  *      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.
 
  17  * SPDX-License-Identifier: Apache-2.0
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.so.adapters.etsi.sol003.adapter.packagemanagement.subscriptionmanagement.cache;
 
  24 import java.util.Optional;
 
  25 import org.onap.so.adapters.etsi.sol003.adapter.packagemanagement.model.PkgmSubscriptionRequest;
 
  28  * Interface which provides methods for communicating with the cache
 
  30  * @author Ronan Kenny (ronan.kenny@est.tech)
 
  31  * @author Gareth Roper (gareth.roper@est.tech)
 
  34 public interface PackageManagementCacheServiceProvider {
 
  37      * Checks cache if subscription request Id is already present. If not, it adds the subscription to the cache.
 
  39      * @param subscriptionId
 
  40      * @param pkgmSubscriptionRequest
 
  42     void addSubscription(final String subscriptionId, final PkgmSubscriptionRequest pkgmSubscriptionRequest);
 
  45      * Gets individual subscription from cache
 
  47      * @param subscriptionId
 
  48      * @return <AbstractMap.SimpleImmutableEntry<String, PkgmSubscriptionRequest>>
 
  50     Optional<PkgmSubscriptionRequest> getSubscription(final String subscriptionId);
 
  53      * Gets Map of subscriptions from cache
 
  55      * @return Map<String, PkgmSubscriptionRequest>>
 
  57     Map<String, PkgmSubscriptionRequest> getSubscriptions();
 
  60      * Delete subscription from cache
 
  62      * @param subscriptionId
 
  65     boolean deleteSubscription(final String subscriptionId);
 
  68      * Checks if subscription exists in cache and return its subscriptionId
 
  70      * @param pkgmSubscriptionRequest
 
  71      * @return Subscription Id
 
  73     Optional<String> getSubscriptionId(final PkgmSubscriptionRequest pkgmSubscriptionRequest);