summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src/main/java/org/onap
diff options
context:
space:
mode:
authorBruno Sakoto <bruno.sakoto@bell.ca>2022-03-11 22:32:13 +0000
committerGerrit Code Review <gerrit@onap.org>2022-03-11 22:32:13 +0000
commit697caa85dd35d5996d604935987e43b61b5811c2 (patch)
treea32a4f73555786fc87bcf5a9a9675255bf85d4f3 /cps-ncmp-rest/src/main/java/org/onap
parentee1ca9a51fb57c33814e21785ce98f8b563f44f8 (diff)
parent1f2e66e720678f00682e6429aab7fa62251baf29 (diff)
Merge "Async: NCMP Rest impl. including Request ID generation"
Diffstat (limited to 'cps-ncmp-rest/src/main/java/org/onap')
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java14
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java6
2 files changed, 16 insertions, 4 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index 2a336d52b9..b5c8d14a9c 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -76,17 +76,20 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
* @param resourceIdentifier resource identifier
* @param acceptParamInHeader accept header parameter
* @param optionsParamInQuery options query parameter
+ * @param topicParamInQuery topic query parameter
* @return {@code ResponseEntity} response from dmi plugin
*/
@Override
public ResponseEntity<Object> getResourceDataOperationalForCmHandle(final String cmHandle,
final @NotNull @Valid String resourceIdentifier,
final String acceptParamInHeader,
- final @Valid String optionsParamInQuery) {
+ final @Valid String optionsParamInQuery,
+ final @Valid String topicParamInQuery) {
final Object responseObject = networkCmProxyDataService.getResourceDataOperationalForCmHandle(cmHandle,
resourceIdentifier,
acceptParamInHeader,
- optionsParamInQuery);
+ optionsParamInQuery,
+ topicParamInQuery);
return ResponseEntity.ok(responseObject);
}
@@ -97,17 +100,20 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
* @param resourceIdentifier resource identifier
* @param acceptParamInHeader accept header parameter
* @param optionsParamInQuery options query parameter
+ * @param topicParamInQuery topic query parameter
* @return {@code ResponseEntity} response from dmi plugin
*/
@Override
public ResponseEntity<Object> getResourceDataRunningForCmHandle(final String cmHandle,
final @NotNull @Valid String resourceIdentifier,
final String acceptParamInHeader,
- final @Valid String optionsParamInQuery) {
+ final @Valid String optionsParamInQuery,
+ final @Valid String topicParamInQuery) {
final Object responseObject = networkCmProxyDataService.getResourceDataPassThroughRunningForCmHandle(cmHandle,
resourceIdentifier,
acceptParamInHeader,
- optionsParamInQuery);
+ optionsParamInQuery,
+ topicParamInQuery);
return ResponseEntity.ok(responseObject);
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java
index 5aaf1c31f0..2495f36426 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java
@@ -30,6 +30,7 @@ import org.onap.cps.ncmp.rest.controller.NetworkCmProxyController;
import org.onap.cps.ncmp.rest.controller.NetworkCmProxyInventoryController;
import org.onap.cps.ncmp.rest.model.ErrorMessage;
import org.onap.cps.spi.exceptions.CpsException;
+import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
import org.onap.cps.spi.exceptions.DataValidationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -69,6 +70,11 @@ public class NetworkCmProxyRestExceptionHandler {
return buildErrorResponse(HttpStatus.BAD_REQUEST, exception);
}
+ @ExceptionHandler({DataNodeNotFoundException.class})
+ public static ResponseEntity<Object> handleNotFoundExceptions(final CpsException exception) {
+ return buildErrorResponse(HttpStatus.NOT_FOUND, exception);
+ }
+
private static ResponseEntity<Object> buildErrorResponse(final HttpStatus status, final Exception exception) {
if (exception.getCause() != null || !(exception instanceof CpsException)) {
log.error("Exception occurred", exception);