summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 86d4e0aea1..f4952b6c0d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -4223,6 +4223,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
return componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(resourceStatus.right().value()), "");
}
Resource resource = resourceStatus.left().value();
+ if (isComponentSystemDeployed(resource)) {
+ throw new ByActionStatusComponentException(ActionStatus.CANNOT_DELETE_SYSTEM_DEPLOYED_RESOURCES, ComponentTypeEnum.RESOURCE.getValue(),
+ resource.getName());
+ }
StorageOperationStatus result = StorageOperationStatus.OK;
lockComponent(resourceId, resource, "Mark resource to delete");
try {
@@ -4244,6 +4248,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
}
+ private boolean isComponentSystemDeployed(Resource resource) {
+ return resource.getComponentMetadataDefinition().getMetadataDataDefinition().isNormative();
+ }
+
public ResponseFormat deleteResourceByNameAndVersion(String resourceName, String version, User user) {
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.NO_CONTENT);
validateUserExists(user);