From: JvD_Ericsson Date: Mon, 27 Mar 2023 10:11:41 +0000 (+0100) Subject: Add rollback on import fail X-Git-Tag: 1.12.4~6 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F60%2F133860%2F2;p=sdc.git Add rollback on import fail Issue-ID: SDC-4451 Signed-off-by: JvD_Ericsson Change-Id: I745c15b88135145669f9fb347e9ada97472d4779 --- 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 1d0be1f4c1..8442db9bab 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 @@ -3975,11 +3975,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { componentsUtils.auditResource(componentsUtils.getResponseFormat(ActionStatus.CREATED), user, createdResource, actionEnum); ASDCKpiApi.countCreatedResourcesKPI(); } catch (ComponentException e) { + janusGraphDao.rollback(); ResponseFormat responseFormat = e.getResponseFormat() == null ? componentsUtils.getResponseFormat(e.getActionStatus(), e.getParams()) : e.getResponseFormat(); componentsUtils.auditResource(responseFormat, user, resource, actionEnum); throw e; } catch (StorageException e) { + janusGraphDao.rollback(); ResponseFormat responseFormat = componentsUtils .getResponseFormat(componentsUtils.convertFromStorageResponse(e.getStorageOperationStatus())); componentsUtils.auditResource(responseFormat, user, resource, actionEnum); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index 187d7b8491..9b095cc062 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -720,6 +720,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { ASDCKpiApi.countCreatedServicesKPI(); return Either.left(dataModelResponse.left().value()); } + janusGraphDao.rollback(); ResponseFormat responseFormat = componentsUtils .getResponseFormatByComponent(componentsUtils.convertFromStorageResponse(dataModelResponse.right().value()), service, ComponentTypeEnum.SERVICE); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java index ca8a13dba3..60cc6fc7fd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java @@ -753,7 +753,7 @@ public class ServiceImportBusinessLogic { } } if (shouldLock) { - graphLockOperation.unlockComponentByName(service.getSystemName(), service.getUniqueId(), NodeTypeEnum.Resource); + graphLockOperation.unlockComponentByName(service.getSystemName(), service.getUniqueId(), NodeTypeEnum.Service); } } }