aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main/java
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2024-11-20 08:21:23 +0000
committerToineSiebelink <toine.siebelink@est.tech>2024-11-20 08:21:23 +0000
commitd8af6808847b8fbd044077e7c4688ca869b70169 (patch)
tree38ab780483dfc14535c50077535dc70d67c6b8cb /cps-ncmp-service/src/main/java
parent2e2ed18c1575e7787e067e02d8488d751c00d90d (diff)
Revert "Update error response for ncmp endpoints"
This reverts commit 7e6fee9321e4f13cc4a0d81f83fc3693309cb5d7. Reason for revert: This patch is causing blocking issues at ESH see CPS-2509 Issue-ID: CPS-2509 Change-Id: Ie1bd26ccca4abcac09faf35e2b97491dab32b14d Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main/java')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java4
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java38
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java6
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java4
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java6
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java8
6 files changed, 14 insertions, 52 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java
index be22752882..8cfad7dbf6 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java
@@ -27,14 +27,14 @@ public enum NcmpResponseStatus {
SUCCESS("0", "Successfully applied changes"),
CM_DATA_SUBSCRIPTION_ACCEPTED("1", "ACCEPTED"),
- CM_HANDLES_NOT_FOUND("100", "cm handle reference(s) not found"),
+ CM_HANDLES_NOT_FOUND("100", "cm handle id(s) not found"),
CM_HANDLES_NOT_READY("101", "cm handle(s) not ready"),
DMI_SERVICE_NOT_RESPONDING("102", "dmi plugin service is not responding"),
UNABLE_TO_READ_RESOURCE_DATA("103", "dmi plugin service is not able to read resource data"),
CM_DATA_SUBSCRIPTION_REJECTED("104", "REJECTED"),
UNKNOWN_ERROR("108", "Unknown error"),
CM_HANDLE_ALREADY_EXIST("109", "cm-handle already exists"),
- CM_HANDLE_INVALID_ID("110", "cm handle reference has an invalid character(s) in id"),
+ CM_HANDLE_INVALID_ID("110", "cm-handle has an invalid character(s) in id"),
ALTERNATE_ID_ALREADY_ASSOCIATED("111", "alternate id already associated"),
MESSAGE_TOO_LARGE("112", "message too large");
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java
deleted file mode 100644
index 715e1a00db..0000000000
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2024 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.ncmp.api.exceptions;
-
-public class CmHandleNotFoundException extends NcmpException {
-
- private static final String CM_HANDLE_NOT_FOUND_DETAILS_FORMAT =
- "No cm handles found with reference %s";
-
- /**
- * Constructor.
- *
- * @param cmHandleReference cm handle reference either cm handle id or alternate id
- */
- public CmHandleNotFoundException(final String cmHandleReference) {
- super("Cm handle not found", String.format(CM_HANDLE_NOT_FOUND_DETAILS_FORMAT,
- cmHandleReference));
- }
-
-}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java
index f0547d3d24..a8996874ff 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java
@@ -78,7 +78,7 @@ public class NetworkCmProxyInventoryFacade {
* Get all cm handle references by DMI plugin identifier.
*
* @param dmiPluginIdentifier DMI plugin identifier
- * @param outputAlternateId boolean for cm handle reference type either
+ * @param outputAlternateId Boolean for cm handle reference type either
* cm handle id (false) or alternate id (true)
* @return collection of cm handle references
*/
@@ -91,7 +91,7 @@ public class NetworkCmProxyInventoryFacade {
* Get all cm handle IDs by various properties.
*
* @param cmHandleQueryServiceParameters cm handle query parameters
- * @param outputAlternateId boolean for cm handle reference type either
+ * @param outputAlternateId Boolean for cm handle reference type either
* cm handle id (false) or alternate id (true)
* @return collection of cm handle references
*/
@@ -162,7 +162,7 @@ public class NetworkCmProxyInventoryFacade {
* Retrieve cm handle ids for the given query parameters.
*
* @param cmHandleQueryApiParameters cm handle query parameters
- * @param outputAlternateId boolean for cm handle reference type either cmHandleId (false) or AlternateId (true)
+ * @param outputAlternateId Boolean for cm handle reference type either cmHandleId (false) or AlternateId (true)
* @return cm handle ids
*/
public Collection<String> executeCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java
index 415153ddf7..74c04928ed 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java
@@ -103,8 +103,8 @@ public interface CmHandleQueryService {
* Get collection of all cm handles references by DMI plugin identifier and alternate id output option.
*
* @param dmiPluginIdentifier DMI plugin identifier
- * @param outputAlternateId boolean for cm handle reference type either cmHandleId (false) or AlternateId (true)
- * @return collection of cm handle references
+ * @param outputAlternateId Boolean for cm handle reference type either cmHandleId (false) or AlternateId (true)
+ * @return collection of cm handle ids
*/
Collection<String> getCmHandleReferencesByDmiPluginIdentifier(String dmiPluginIdentifier,
boolean outputAlternateId);
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java
index 562cb6e0de..61d7df923e 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java
@@ -157,12 +157,12 @@ public interface InventoryPersistence extends NcmpPersistence {
* get CM handles that has given module names.
*
* @param moduleNamesForQuery module names
- * @param outputAlternateId boolean for cm handle reference type either
+ * @param outputAlternateIds Boolean for cm handle reference type either
* cm handle id (false or null) or alternate id (true)
- * @return Collection of CM handle references
+ * @return Collection of CM handle Ids
*/
Collection<String> getCmHandleReferencesWithGivenModules(Collection<String> moduleNamesForQuery,
- boolean outputAlternateId);
+ boolean outputAlternateIds);
/**
* Check database if cm handle id exists if not return false.
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java
index e468ed100a..c4765ff53d 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java
@@ -40,7 +40,6 @@ import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsModuleService;
import org.onap.cps.impl.utils.CpsValidator;
-import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException;
import org.onap.cps.ncmp.api.inventory.models.CompositeState;
import org.onap.cps.ncmp.api.inventory.models.CompositeStateBuilder;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
@@ -194,7 +193,8 @@ public class InventoryPersistenceImpl extends NcmpPersistenceImpl implements Inv
final Collection<DataNode> dataNodes = cmHandleQueryService
.queryNcmpRegistryByCpsPath(cpsPathForCmHandleByAlternateId, OMIT_DESCENDANTS);
if (dataNodes.isEmpty()) {
- throw new CmHandleNotFoundException(alternateId);
+ throw new DataNodeNotFoundException(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR,
+ cpsPathForCmHandleByAlternateId);
}
return dataNodes.iterator().next();
}
@@ -218,8 +218,8 @@ public class InventoryPersistenceImpl extends NcmpPersistenceImpl implements Inv
@Override
public Collection<String> getCmHandleReferencesWithGivenModules(final Collection<String> moduleNamesForQuery,
- final boolean outputAlternateId) {
- if (outputAlternateId) {
+ final boolean outputAlternateIds) {
+ if (outputAlternateIds) {
final Collection<String> cmHandleIds =
cpsAnchorService.queryAnchorNames(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, moduleNamesForQuery);
return getAlternateIdsFromDataNodes(getCmHandleDataNodes(cmHandleIds));