From e182a6b6cb4a87b4f461adf83fe60a65948fc230 Mon Sep 17 00:00:00 2001 From: "puthuparambil.aditya" Date: Thu, 10 Dec 2020 16:49:53 +0000 Subject: Retrieve All anchors for a given Dataspace Issue-ID: CPS-8 Signed-off-by: puthuparambil.aditya Change-Id: Idb2e4f83d390f078345e556d89781e0bf4a9a41f --- .../main/java/org/onap/cps/rest/controller/CpsRestController.java | 5 ++++- .../java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'cps-rest/src/main/java/org') diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java index 30d3e24bb9..32ea35c5e0 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java @@ -26,6 +26,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.util.Collection; import javax.validation.Valid; import org.modelmapper.ModelMapper; import org.onap.cps.api.CpService; @@ -107,8 +108,10 @@ public class CpsRestController implements CpsRestApi { } @Override + public ResponseEntity getAnchors(final String dataspaceName) { - return null; + final Collection anchorDetails = cpsAdminService.getAnchors(dataspaceName); + return new ResponseEntity<>(anchorDetails, HttpStatus.OK); } @Override diff --git a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java index fc0164f5e0..00e72a189e 100644 --- a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java @@ -23,6 +23,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils; import org.onap.cps.rest.controller.CpsRestController; import org.onap.cps.rest.model.ErrorMessage; import org.onap.cps.spi.exceptions.AnchorAlreadyDefinedException; +import org.onap.cps.spi.exceptions.CpsAdminException; import org.onap.cps.spi.exceptions.CpsException; import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.spi.exceptions.ModelValidationException; @@ -48,7 +49,7 @@ public class CpsRestExceptionHandler { } @ExceptionHandler({ModelValidationException.class, DataValidationException.class, - SchemaSetAlreadyDefinedException.class, AnchorAlreadyDefinedException.class}) + SchemaSetAlreadyDefinedException.class, AnchorAlreadyDefinedException.class, CpsAdminException.class}) public static ResponseEntity handleBadRequestExceptions(final CpsException exception) { return buildErrorResponse(HttpStatus.BAD_REQUEST, exception.getMessage(), extractDetails(exception)); } -- cgit 1.2.3-korg