diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2023-03-27 11:11:41 +0100 |
---|---|---|
committer | JEFF VAN DAM <jeff.van.dam@est.tech> | 2023-03-27 17:08:12 +0000 |
commit | 1369eb7e001cbfb200dcca36e7c2439121e916e3 (patch) | |
tree | 4384fab8fa2bfeb454b1b8eb9b0ed5e4eee487dd /catalog-be/src/main/java | |
parent | 9118e3141cc4cfa0397a8f2f221c9365e93b95c1 (diff) |
Add rollback on import fail
Issue-ID: SDC-4451
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I745c15b88135145669f9fb347e9ada97472d4779
Diffstat (limited to 'catalog-be/src/main/java')
3 files changed, 4 insertions, 1 deletions
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); } } } |