From 1369eb7e001cbfb200dcca36e7c2439121e916e3 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Mon, 27 Mar 2023 11:11:41 +0100 Subject: Add rollback on import fail Issue-ID: SDC-4451 Signed-off-by: JvD_Ericsson Change-Id: I745c15b88135145669f9fb347e9ada97472d4779 --- .../org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java | 2 ++ .../java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java | 1 + .../openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'catalog-be/src') 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); } } } -- cgit 1.2.3-korg