From b781a6d5303945f23b995b7c24d11fe7d44624a4 Mon Sep 17 00:00:00 2001 From: shrek2000 Date: Mon, 2 Jul 2018 16:59:18 +0300 Subject: Corrupted forwarding paths When a component is deleted from service canvas, the related forwarding paths are not being deleted , and create corrupted data Change-Id: If6a0837572e92e66d31ddf28a30f1ad3893bb8ec Issue-ID: SDC-1449 Signed-off-by: shrek2000 --- .../impl/ComponentInstanceBusinessLogic.java | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'catalog-be/src/main') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index 306fadda1f..81b7c6a9c1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -896,7 +896,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (resultOp.isRight()){ return resultOp; } - Either deleteEither = deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentId, componentInstanceId, + Either deleteEither = deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentId, containerComponentType, resultOp); if (deleteEither.isRight()){ return deleteEither; @@ -911,17 +911,16 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } - public Either deleteForwardingPathsRelatedTobeDeletedComponentInstance(String containerComponentId, - String componentInstanceId, ComponentTypeEnum containerComponentType, - Either resultOp) { + public Either deleteForwardingPathsRelatedTobeDeletedComponentInstance(String containerComponentId, ComponentTypeEnum containerComponentType, + Either resultOp) { if(containerComponentType.equals(ComponentTypeEnum.SERVICE) && resultOp.isLeft() ){ - - List pathIDsToBeDeleted = getForwardingPathsRelatedToComponentInstance(containerComponentId, componentInstanceId); - if (!pathIDsToBeDeleted.isEmpty()) { - Either, ResponseFormat> deleteForwardingPathsEither = deleteForwardingPaths(containerComponentId, - pathIDsToBeDeleted); - if(deleteForwardingPathsEither.isRight()) { - resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); + final ComponentInstance componentInstance = resultOp.left().value(); + List pathIDsToBeDeleted = getForwardingPathsRelatedToComponentInstance(containerComponentId, componentInstance.getName()); + if (!pathIDsToBeDeleted.isEmpty()) { + Either, ResponseFormat> deleteForwardingPathsEither = deleteForwardingPaths(containerComponentId, + pathIDsToBeDeleted); + if(deleteForwardingPathsEither.isRight()) { + resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } } -- cgit 1.2.3-korg