diff options
Diffstat (limited to 'cps-rest/src/main/java/org/onap')
-rw-r--r-- | cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java | 7 | ||||
-rw-r--r-- | cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java index 4237846ee7..08020eca2a 100644 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java @@ -21,6 +21,7 @@ package org.onap.cps.rest.controller; import static org.onap.cps.rest.utils.MultipartFileUtil.extractYangResourcesMap; +import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED; import java.util.Collection; import org.modelmapper.ModelMapper; @@ -66,6 +67,12 @@ public class AdminRestController implements CpsAdminApi { return new ResponseEntity<>(schemaSet, HttpStatus.OK); } + @Override + public ResponseEntity<Void> deleteSchemaSet(final String dataspaceName, final String schemaSetName) { + cpsModuleService.deleteSchemaSet(dataspaceName, schemaSetName, CASCADE_DELETE_PROHIBITED); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + /** * Create a new anchor. * 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 2b096240bd..2f636630c4 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 @@ -26,6 +26,7 @@ import org.onap.cps.rest.controller.DataRestController; import org.onap.cps.rest.model.ErrorMessage; import org.onap.cps.spi.exceptions.CpsAdminException; import org.onap.cps.spi.exceptions.CpsException; +import org.onap.cps.spi.exceptions.DataInUseException; import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.spi.exceptions.ModelValidationException; import org.onap.cps.spi.exceptions.NotFoundInDataspaceException; @@ -62,6 +63,11 @@ public class CpsRestExceptionHandler { return buildErrorResponse(HttpStatus.NOT_FOUND, exception.getMessage(), extractDetails(exception)); } + @ExceptionHandler({DataInUseException.class}) + public static ResponseEntity<Object> handleDataInUseException(final CpsException exception) { + return buildErrorResponse(HttpStatus.CONFLICT, exception.getMessage(), extractDetails(exception)); + } + @ExceptionHandler({CpsException.class}) public static ResponseEntity<Object> handleAnyOtherCpsExceptions(final CpsException exception) { return buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, exception.getMessage(), extractDetails(exception)); |