From fed417ad58c84e4cbfe2f6df685ba869ba1e5cc7 Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Fri, 30 Jul 2021 11:02:06 +0100 Subject: Fix init upgrade fail for polictyTypes Issue-ID: SDC-3658 Signed-off-by: KrupaNagabhushan Change-Id: I13a0d97c543213bda289157f602b019c74811cbc --- .../be/components/impl/CommonImportManager.java | 3 +++ .../org/openecomp/sdc/be/impl/ComponentsUtils.java | 27 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'catalog-be/src/main/java') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java index 8c309bd835..b4e1594a41 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java @@ -180,6 +180,9 @@ public class CommonImportManager { case GROUP_TYPE: ret = componentsUtils.convertFromStorageResponseForGroupType(status); break; + case POLICY_TYPE: + ret = componentsUtils.convertFromStorageResponseForPolicyType(status); + break; case DATA_TYPE: ret = componentsUtils.convertFromStorageResponseForDataType(status); break; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java index 8451caba27..607497ca26 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java @@ -1311,6 +1311,33 @@ public class ComponentsUtils { return responseEnum; } + public ActionStatus convertFromStorageResponseForPolicyType(StorageOperationStatus storageResponse) { + ActionStatus responseEnum; + switch (storageResponse) { + case OK: + responseEnum = ActionStatus.OK; + break; + case CONNECTION_FAILURE: + case GRAPH_IS_LOCK: + responseEnum = ActionStatus.GENERAL_ERROR; + break; + case BAD_REQUEST: + responseEnum = ActionStatus.INVALID_CONTENT; + break; + case ENTITY_ALREADY_EXISTS: + responseEnum = ActionStatus.POLICY_TYPE_ALREADY_EXIST; + break; + case SCHEMA_VIOLATION: + responseEnum = ActionStatus.POLICY_TYPE_ALREADY_EXIST; + break; + default: + responseEnum = ActionStatus.GENERAL_ERROR; + break; + } + log.debug(CONVERT_STORAGE_RESPONSE_TO_ACTION_RESPONSE, storageResponse, responseEnum); + return responseEnum; + } + public ActionStatus convertFromStorageResponseForDataType(StorageOperationStatus storageResponse) { ActionStatus responseEnum; switch (storageResponse) { -- cgit 1.2.3-korg