From 760e597acc7854a736363a0136343b5a77462cfb Mon Sep 17 00:00:00 2001 From: niamhcore Date: Thu, 11 Feb 2021 14:49:11 +0000 Subject: Persistence layer - Query Datanodes using cpsPath that contains contains a leaf name and a leaf value Issue-ID: CPS-231 Signed-off-by: niamhcore Change-Id: I9bd483a4b76e233ab6c64b3ef8aacb593e4e9da0 --- .../onap/cps/spi/CpsDataPersistenceService.java | 12 ++++++++ .../onap/cps/spi/exceptions/CpsPathException.java | 35 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java (limited to 'cps-service/src/main/java') diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java index 9a0c180a8..d2b6d45d6 100644 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java @@ -21,6 +21,7 @@ package org.onap.cps.spi; +import java.util.Collection; import java.util.Map; import org.checkerframework.checker.nullness.qual.NonNull; import org.onap.cps.spi.model.DataNode; @@ -86,4 +87,15 @@ public interface CpsDataPersistenceService { * @param dataNode data node */ void replaceDataNodeTree(@NonNull String dataspaceName, @NonNull String anchorName, @NonNull DataNode dataNode); + + /** + * Get a datanode by cps path. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @param cpsPath cps path + * @return the data nodes found i.e. 0 or more data nodes + */ + Collection queryDataNodes(@NonNull String dataspaceName, @NonNull String anchorName, + @NonNull String cpsPath); } diff --git a/cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java b/cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java new file mode 100644 index 000000000..fde5566b1 --- /dev/null +++ b/cps-service/src/main/java/org/onap/cps/spi/exceptions/CpsPathException.java @@ -0,0 +1,35 @@ +/* + * ============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; + +public class CpsPathException extends CpsException { + + private static final long serialVersionUID = 1006899957127327791L; + + /** + * Constructor. + * + * @param message the error message + * @param details the error details + */ + public CpsPathException(final String message, final String details) { + super(message, details); + } +} -- cgit 1.2.3-korg