Retrieve All anchors for a given Dataspace

Issue-ID: CPS-8
Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca>
Change-Id: Idb2e4f83d390f078345e556d89781e0bf4a9a41f
diff --git a/cps-rest/docs/api/swagger/openapi.yml b/cps-rest/docs/api/swagger/openapi.yml
index 56a012f..441d5e5 100755
--- a/cps-rest/docs/api/swagger/openapi.yml
+++ b/cps-rest/docs/api/swagger/openapi.yml
@@ -61,12 +61,17 @@
         401:
           description: Unauthorized
           content: {}
+        400:
+          description: Bad Request
+          content: {}
         403:
           description: Forbidden
-          content: {}
         404:
           description: Not Found
           content: {}
+        204:
+          description: No Content
+          content: {}
     post:
       tags:
         - cps-rest
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 30d3e24..32ea35c 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.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 @@
     }
 
     @Override
+
     public ResponseEntity<Object> getAnchors(final String dataspaceName) {
-        return null;
+        final Collection<Anchor> 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 fc0164f..00e72a1 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.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 @@
     }
 
     @ExceptionHandler({ModelValidationException.class, DataValidationException.class,
-        SchemaSetAlreadyDefinedException.class, AnchorAlreadyDefinedException.class})
+        SchemaSetAlreadyDefinedException.class, AnchorAlreadyDefinedException.class, CpsAdminException.class})
     public static ResponseEntity<Object> handleBadRequestExceptions(final CpsException exception) {
         return buildErrorResponse(HttpStatus.BAD_REQUEST, exception.getMessage(), extractDetails(exception));
     }