Add rollback on import fail 60/133860/2
authorJvD_Ericsson <jeff.van.dam@est.tech>
Mon, 27 Mar 2023 10:11:41 +0000 (11:11 +0100)
committerJEFF VAN DAM <jeff.van.dam@est.tech>
Mon, 27 Mar 2023 17:08:12 +0000 (17:08 +0000)
Issue-ID: SDC-4451
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I745c15b88135145669f9fb347e9ada97472d4779

catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java

index 1d0be1f..8442db9 100644 (file)
@@ -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);
index 187d7b8..9b095cc 100644 (file)
@@ -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);
index ca8a13d..60cc6fc 100644 (file)
@@ -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);
             }
         }
     }