From 38eaf2ddd678a837e2bfed25d5b4b45d72fce338 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Fri, 12 May 2023 12:37:02 +0100 Subject: Disabling archive functionality for normatives Issue-ID: SDC-4497 Signed-off-by: JvD_Ericsson Change-Id: If7ce7205543682697a2b787aebfd4c8a3da25db7 --- .../sdc-catalog-be/files/default/error-configuration.yaml | 9 +++++++++ .../openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java | 6 +++++- catalog-be/src/main/resources/config/error-configuration.yaml | 9 +++++++++ .../test/resources/config/catalog-be/error-configuration.yaml | 9 +++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) (limited to 'catalog-be') diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml index 05926151ba..0cdcd01a00 100644 --- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml @@ -2886,3 +2886,12 @@ errors: message: "Cannot change substitution node type as properties of the existing type are referenced by properties %1.", messageId: "SVC4017" } + + #---------SVC4018----------------------------- + # %1 - componentType + # %2 - component id + CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES: { + code: 409, + message: "System deployed %1 cannot be archived. Component: '%2'", + messageId: "SVC4018" + } \ No newline at end of file diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java index 19afff0668..3806eed0dc 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java @@ -77,7 +77,11 @@ public class ArchiveBusinessLogic { User user = accessValidations.userIsAdminOrDesigner(userId, containerComponentType + "_ARCHIVE"); Either, ActionStatus> result = this.archiveOperation.archiveComponent(componentId); if (result.isRight()) { - throw new ByActionStatusComponentException(result.right().value(), componentId); + ActionStatus status = result.right().value(); + if (ActionStatus.CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES.equals(status)) { + throw new ByActionStatusComponentException(status, containerComponentType, componentId); + } + throw new ByActionStatusComponentException(status, componentId); } this.auditAction(ArchiveOperation.Action.ARCHIVE, result.left().value(), user, containerComponentType); // Send Archive Notification To Facade diff --git a/catalog-be/src/main/resources/config/error-configuration.yaml b/catalog-be/src/main/resources/config/error-configuration.yaml index a4b56d530c..7589511f54 100644 --- a/catalog-be/src/main/resources/config/error-configuration.yaml +++ b/catalog-be/src/main/resources/config/error-configuration.yaml @@ -2877,4 +2877,13 @@ errors: code: 409, message: "Cannot change substitution node type as properties of the existing type are referenced by properties %1.", messageId: "SVC4017" + } + + #---------SVC4018----------------------------- + # %1 - componentType + # %2 - component id + CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES: { + code: 409, + message: "System deployed %1 cannot be archived. Component: '%2'", + messageId: "SVC4018" } \ No newline at end of file diff --git a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml index e8c5d9a5df..6911570d16 100644 --- a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml +++ b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml @@ -2863,4 +2863,13 @@ errors: code: 409, message: "Cannot change substitution node type as properties of the existing type are referenced by properties %1.", messageId: "SVC4017" + } + + #---------SVC4018----------------------------- + # %1 - componentType + # %2 - component id + CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES: { + code: 409, + message: "System deployed %1 cannot be archived. Component: '%2'", + messageId: "SVC4018" } \ No newline at end of file -- cgit 1.2.3-korg