From a1c6e6ac56f9e53f08b329ce7f5069514c62fc77 Mon Sep 17 00:00:00 2001 From: niamhcore Date: Thu, 21 Oct 2021 15:19:04 +0100 Subject: Add get cm handles by modules names - persistence layer - Add sql query to anchor repository - Add sql query to yang resource repository Issue-ID: CPS-644 Signed-off-by: niamhcore Change-Id: I85ab1fcb343e6be77628695153d8d9f303dc3112 --- .../onap/cps/spi/CpsAdminPersistenceService.java | 9 +++++ .../exceptions/ModuleNamesNotFoundException.java | 41 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 cps-service/src/main/java/org/onap/cps/spi/exceptions/ModuleNamesNotFoundException.java (limited to 'cps-service') diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java index b05385fbf..f29735fa0 100755 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java @@ -58,6 +58,15 @@ public interface CpsAdminPersistenceService { @NonNull Collection getAnchors(@NonNull String dataspaceName); + /** + * Get anchors for the given dataspace name and collection of module names. + * + * @param dataspaceName dataspace name + * @param moduleNames a collection of module names + * @return a collection of anchors + */ + Collection getAnchors(String dataspaceName, Collection moduleNames); + /** * Get an anchor in the given dataspace using the anchor name. * diff --git a/cps-service/src/main/java/org/onap/cps/spi/exceptions/ModuleNamesNotFoundException.java b/cps-service/src/main/java/org/onap/cps/spi/exceptions/ModuleNamesNotFoundException.java new file mode 100644 index 000000000..ee4295ea7 --- /dev/null +++ b/cps-service/src/main/java/org/onap/cps/spi/exceptions/ModuleNamesNotFoundException.java @@ -0,0 +1,41 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.spi.exceptions; + +import java.util.Collection; + +@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions +public class ModuleNamesNotFoundException extends CpsAdminException { + + private static final long serialVersionUID = 3105694256583924137L; + + /** + * Constructor. + * + * @param dataspaceName dataspace name + * @param moduleNames module names + */ + public ModuleNamesNotFoundException(final String dataspaceName, final Collection moduleNames) { + super("Yang resource not found", + String.format("No yang resources found for %s in dataspace %s.", + moduleNames, dataspaceName)); + } +} -- cgit 1.2.3-korg