aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src
diff options
context:
space:
mode:
authorayalaben <ayala.benzvi@amdocs.com>2018-02-13 12:44:17 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-02-15 13:37:55 +0000
commitb4c4dbc6bbcd9995387c0716ee57f620c7a701df (patch)
tree8ff9d83fdc62c677bea4943cb328f292694bc27a /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src
parent4e1b18cb2c939993558070c3a963d6fb6dca25db (diff)
Delete Item status Draft - Fix Errors
Change-Id: I2e602a82f70ac77545b70658a35bbeffaf713a9b Issue-ID: SDC-1014 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index 09cb0945b1..ebabda6831 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -285,6 +285,12 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
public Response deleteVsp(String vspId, String user) {
Item vsp = itemManager.get(vspId);
+ if(!vsp.getType().equals(ItemType.vsp.name())){
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()
+ .withMessage(String.format("Vsp with id %s does not exist.",
+ vspId)).build()));
+ }
+
Integer certifiedVersionsCounter = vsp.getVersionStatusCounters().get(VersionStatus.Certified);
if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) {
itemManager.delete(vsp);
@@ -295,7 +301,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
return Response.ok().build();
} else {
- return Response.status(Response.Status.PRECONDITION_FAILED)
+ return Response.status(Response.Status.FORBIDDEN)
.entity(new Exception(Messages.DELETE_VSP_ERROR.getErrorMessage())).build();
}
}