summaryrefslogtreecommitdiffstats
path: root/cps-rest/src
diff options
context:
space:
mode:
authorputhuparambil.aditya <aditya.puthuparambil@bell.ca>2020-12-10 16:49:53 +0000
committerputhuparambil.aditya <aditya.puthuparambil@bell.ca>2020-12-10 16:55:54 +0000
commite182a6b6cb4a87b4f461adf83fe60a65948fc230 (patch)
tree1a8dbc71794cf742e5f9dd2ce6346c308cc1afc4 /cps-rest/src
parenta66dd4e82e8ef5b2cfe956a9a88a90154889635a (diff)
Retrieve All anchors for a given Dataspace
Issue-ID: CPS-8 Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca> Change-Id: Idb2e4f83d390f078345e556d89781e0bf4a9a41f
Diffstat (limited to 'cps-rest/src')
-rwxr-xr-xcps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java5
-rw-r--r--cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java3
2 files changed, 6 insertions, 2 deletions
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<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 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<Object> handleBadRequestExceptions(final CpsException exception) {
return buildErrorResponse(HttpStatus.BAD_REQUEST, exception.getMessage(), extractDetails(exception));
}