diff options
author | Oren Kleks <orenkle@amdocs.com> | 2019-02-14 17:31:35 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2019-02-19 07:37:39 +0000 |
commit | b123ebd394134c95723fb96cf5c05af3580330a8 (patch) | |
tree | 053bba3dc7ca1ca380e7651e18816336073670b0 | |
parent | 5930a00104a710b4c5abb1cfec2f4b7c978378c1 (diff) |
Fix Logger Creation
Add dependent child service to service
Issue-ID: SDC-1987
Change-Id: Ibfac137cbdc296d4b3fc97937054f879aeeaf46f
Signed-off-by: shrek2000 <orenkle@amdocs.com>
2 files changed, 23 insertions, 25 deletions
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<CINodeFilterDataDefinition, StorageOperationStatus> result; Either<Boolean, ResponseFormat> 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<ComponentInstance> 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<ComponentInstance> 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(); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java index 989708c8d6..7b3076ae8b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java @@ -22,10 +22,8 @@ package org.openecomp.sdc.be.model.jsontitan.operations; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; import fj.data.Either; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Set; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; @@ -41,14 +39,12 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.common.jsongraph.util.CommonUtility; -import org.openecomp.sdc.common.log.elements.LoggerFactory; import org.openecomp.sdc.common.log.wrappers.Logger; @org.springframework.stereotype.Component("service-filter-operations") public class NodeFilterOperation extends BaseOperation { - private static Logger logger = LoggerFactory.getLogger(NodeFilterOperation.class, - org.slf4j.LoggerFactory.getLogger(NodeFilterOperation.class)); + private static Logger logger = Logger.getLogger(NodeFilterOperation.class); public Either<Set<String>, StorageOperationStatus> deleteNodeFilters(Service service, Set<String> componentInstanceIds) { |