From b123ebd394134c95723fb96cf5c05af3580330a8 Mon Sep 17 00:00:00 2001 From: Oren Kleks Date: Thu, 14 Feb 2019 17:31:35 +0200 Subject: Fix Logger Creation Add dependent child service to service Issue-ID: SDC-1987 Change-Id: Ibfac137cbdc296d4b3fc97937054f879aeeaf46f Signed-off-by: shrek2000 --- .../be/components/impl/ServiceBusinessLogic.java | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'catalog-be') 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 9bf442990b..b426d66598 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 @@ -2355,28 +2355,30 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { Either result; Either lockResult = null; - if (lock) { - lockResult = - lockComponent(storedService.getUniqueId(), storedService, "Add or Update Service Filter on Service"); - if (lockResult.isRight()) { - log.debug("Failed to lock service {}. Response is {}. ", storedService.getName(), - lockResult.right().value().getFormattedMessage()); - return Either.right(lockResult.right().value()); - } else { - log.debug("The service with system name {} locked. ", storedService.getSystemName()); + CINodeFilterDataDefinition serviceFilterResult = null; + try { + if (lock) { + lockResult = + lockComponent(storedService.getUniqueId(), storedService, "Add or Update Service Filter on Service"); + if (lockResult.isRight()) { + log.debug("Failed to lock service {}. Response is {}. ", storedService.getName(), + lockResult.right().value().getFormattedMessage()); + return Either.right(lockResult.right().value()); + } else { + log.debug("The service with system name {} locked. ", storedService.getSystemName()); + } } - } - Optional componentInstanceOptional = storedService.getComponentInstanceById(componentInstanceId); - if (!componentInstanceOptional.isPresent()){ - return Either.right(ResponseFormatManager.getInstance().getResponseFormat(ActionStatus.NODE_FILTER_NOT_FOUND)); - } - CINodeFilterDataDefinition serviceFilter = componentInstanceOptional.get().getNodeFilter(); - if(serviceFilter == null){ - return Either.right(ResponseFormatManager.getInstance().getResponseFormat(ActionStatus.NODE_FILTER_NOT_FOUND)); - } - CINodeFilterDataDefinition serviceFilterResult; - try { + Optional componentInstanceOptional = storedService.getComponentInstanceById(componentInstanceId); + if (!componentInstanceOptional.isPresent()){ + return Either.right(ResponseFormatManager.getInstance().getResponseFormat(ActionStatus.NODE_FILTER_NOT_FOUND)); + } + CINodeFilterDataDefinition serviceFilter = componentInstanceOptional.get().getNodeFilter(); + if(serviceFilter == null){ + return Either.right(ResponseFormatManager.getInstance().getResponseFormat(ActionStatus.NODE_FILTER_NOT_FOUND)); + } + + switch (action) { case ADD: RequirementNodeFilterPropertyDataDefinition newProperty = new RequirementNodeFilterPropertyDataDefinition(); -- cgit 1.2.3-korg