aboutsummaryrefslogtreecommitdiffstats
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
parent4e1b18cb2c939993558070c3a963d6fb6dca25db (diff)
Delete Item status Draft - Fix Errors
Change-Id: I2e602a82f70ac77545b70658a35bbeffaf713a9b Issue-ID: SDC-1014 Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java1
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java4
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java10
-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
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java9
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java6
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java4
7 files changed, 31 insertions, 11 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
index 6158421246..74009f6965 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/TogglzFeatures.java
@@ -30,7 +30,6 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
@Path("/v1.0/togglz")
@Produces(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
index fd1c4dbd0c..657c42833f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/src/main/java/org/openecomp/sdcrests/togglz/rest/services/TogglzFeaturesImpl.java
@@ -45,9 +45,9 @@ public class TogglzFeaturesImpl implements TogglzFeatures {
}
@Override
- public Response setFeatureState(String featureName, boolean state) {
+ public Response setFeatureState(String featureName, boolean active) {
Feature feature = new NamedFeature(featureName);
- FeatureState featureState = new FeatureState(feature,state);
+ FeatureState featureState = new FeatureState(feature,active);
FeatureContext.getFeatureManager().setFeatureState(featureState);
return Response.ok().build();
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
index fd89989987..e5db536deb 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
@@ -22,6 +22,8 @@ import org.openecomp.sdc.activitylog.ActivityLogManager;
import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.activitylog.dao.type.ActivityType;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.datatypes.model.ItemType;
import org.openecomp.sdc.healing.factory.HealingManagerFactory;
@@ -202,6 +204,12 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
public Response deleteLicenseModel(String vlmId, String user) {
Item vlm = itemManager.get(vlmId);
+ if (!vlm.getType().equals(ItemType.vlm.name())){
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()
+ .withMessage(String.format("Vlm with id %s does not exist.",
+ vlmId)).build()));
+ }
+
Integer certifiedVersionsCounter = vlm.getVersionStatusCounters().get(VersionStatus.Certified);
if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) {
itemManager.delete(vlm);
@@ -213,7 +221,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
return Response.ok().build();
} else {
- return Response.status(Response.Status.PRECONDITION_FAILED)
+ return Response.status(Response.Status.FORBIDDEN)
.entity(new Exception(Messages.DELETE_VLM_ERROR.getErrorMessage())).build();
}
}
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();
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
index 5553b784f6..8135efa89a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
@@ -94,7 +94,14 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
@Override
public void updateVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity) {
- String existingVendorName = vendorLicenseModelDao.get(vendorLicenseModelEntity).getVendorName();
+ VendorLicenseModelEntity retrieved = vendorLicenseModelDao.get(vendorLicenseModelEntity);
+ if (retrieved == null){
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()
+ .withMessage(String.format("Vlm with id %s and version %s does not exist.",
+ vendorLicenseModelEntity.getId(), vendorLicenseModelEntity.getVersion().getId()))).build());
+ }
+
+ String existingVendorName = retrieved.getVendorName();
updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName,
vendorLicenseModelEntity.getVendorName());
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index cc24873e92..bf5f19fb2b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -509,10 +509,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
@Override
public void updateVsp(VspDetails vspDetails) {
VspDetails retrieved = vspInfoDao.get(vspDetails);
- // TODO: 6/21/2017 remove this validation when validation will be added in the REST level
if (retrieved == null) {
- throw new RuntimeException(String.format("Vsp with id %s and version %s does not exist.",
- vspDetails.getId(), vspDetails.getVersion().getId()));
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()
+ .withMessage(String.format("Vsp with id %s and version %s does not exist.",
+ vspDetails.getId(), vspDetails.getVersion().getId()))).build());
}
vspDetails.setOnboardingMethod(retrieved.getOnboardingMethod());
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
index 994843839b..af6166bda2 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
@@ -42,8 +42,8 @@ public enum Messages {
PERMISSIONS_ERROR("Permissions Error. The user does not have permission to perform this action."),
PERMISSIONS_OWNER_ERROR("Permissions Error. Only one owner is allowed."),
- DELETE_VSP_ERROR("VSP is in use and cannot be deleted."),
- DELETE_VLM_ERROR("VLM is in use and cannot be deleted."),
+ DELETE_VSP_ERROR("VSP has been certified and cannot be deleted."),
+ DELETE_VLM_ERROR("VLM has been certified and cannot be deleted."),
ZIP_SHOULD_NOT_CONTAIN_FOLDERS("Zip file should not contain folders"),
VES_ZIP_SHOULD_CONTAIN_YML_ONLY(