aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java42
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeFilterOperation.java6
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) {