aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java31
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java12
3 files changed, 20 insertions, 25 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
index 544f030d91..85453e33d2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java
@@ -120,7 +120,7 @@ public abstract class BaseBusinessLogic {
protected IGroupInstanceOperation groupInstanceOperation;
protected InterfaceLifecycleOperation interfaceLifecycleTypeOperation;
protected PolicyTypeOperation policyTypeOperation;
- protected ArtifactsOperations artifactToscaOperation;
+ protected ArtifactsOperations artifactToscaOperation;
protected UserValidations userValidations;
DataTypeValidatorConverter dataTypeValidatorConverter = DataTypeValidatorConverter.getInstance();
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
index 3c770d15aa..27daaf2aae 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -96,22 +96,21 @@ public class NodeFilterValidator {
final List<String> uiConstraints,
final NodeFilterConstraintAction action) {
try {
- for (final String uiConstraint : uiConstraints) {
- if (NodeFilterConstraintAction.ADD != action && NodeFilterConstraintAction.UPDATE != action) {
- break;
- }
- final UIConstraint constraint = new ConstraintConvertor().convert(uiConstraint);
- if (ConstraintConvertor.PROPERTY_CONSTRAINT.equals(constraint.getSourceType())) {
- final Either<Boolean, ResponseFormat> booleanResponseFormatEither =
+ if (NodeFilterConstraintAction.ADD == action || NodeFilterConstraintAction.UPDATE == action) {
+ for (final String uiConstraint : uiConstraints) {
+ final UIConstraint constraint = new ConstraintConvertor().convert(uiConstraint);
+ if (ConstraintConvertor.PROPERTY_CONSTRAINT.equals(constraint.getSourceType())) {
+ final Either<Boolean, ResponseFormat> booleanResponseFormatEither =
validatePropertyConstraint(parentComponent, componentInstanceId, constraint);
- if (booleanResponseFormatEither.isRight()) {
- return booleanResponseFormatEither;
- }
- } else if (ConstraintConvertor.STATIC_CONSTRAINT.equals(constraint.getSourceType())) {
- final Either<Boolean, ResponseFormat> booleanResponseFormatEither =
+ if (booleanResponseFormatEither.isRight()) {
+ return booleanResponseFormatEither;
+ }
+ } else if (ConstraintConvertor.STATIC_CONSTRAINT.equals(constraint.getSourceType())) {
+ final Either<Boolean, ResponseFormat> booleanResponseFormatEither =
validateStaticValueAndOperator(parentComponent, componentInstanceId, constraint);
- if (booleanResponseFormatEither.isRight()) {
- return booleanResponseFormatEither;
+ if (booleanResponseFormatEither.isRight()) {
+ return booleanResponseFormatEither;
+ }
}
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java
index 4a43ab23a6..7141379fe3 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java
@@ -145,9 +145,9 @@ public class ComponentNodeFilterServlet extends AbstractValidationsServlet {
LOGGER.debug(FAILED_TO_PARSE_COMPONENT);
return buildErrorResponse(convertResponse.right().value());
}
- final Optional<CINodeFilterDataDefinition> actionResponse;
final String constraint = new ConstraintConvertor().convert(uiConstraint);
- actionResponse = componentNodeFilterBusinessLogic
+
+ final Optional<CINodeFilterDataDefinition> actionResponse = componentNodeFilterBusinessLogic
.addNodeFilter(componentId.toLowerCase(), componentInstanceId, NodeFilterConstraintAction.ADD,
uiConstraint.getServicePropertyName(), constraint, true, componentTypeEnum);
@@ -163,7 +163,6 @@ public class ComponentNodeFilterServlet extends AbstractValidationsServlet {
BeEcompErrorManager.getInstance().logBeRestApiGeneralError(NODE_FILTER_CREATION);
LOGGER.error(CREATE_NODE_FILTER_WITH_AN_ERROR, e);
return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
-
}
}
@@ -214,10 +213,8 @@ public class ComponentNodeFilterServlet extends AbstractValidationsServlet {
LOGGER.debug("failed to parse data");
return buildErrorResponse(convertResponse.right().value());
}
- final Optional<CINodeFilterDataDefinition> actionResponse;
final List<String> constraints = new ConstraintConvertor().convertToList(uiConstraints);
-
- actionResponse = componentNodeFilterBusinessLogic
+ final Optional<CINodeFilterDataDefinition> actionResponse = componentNodeFilterBusinessLogic
.updateNodeFilter(componentId.toLowerCase(), componentInstanceId, constraints,
true, componentTypeEnum);
@@ -262,8 +259,7 @@ public class ComponentNodeFilterServlet extends AbstractValidationsServlet {
componentNodeFilterBusinessLogic.validateUser(userId);
try {
- final Optional<CINodeFilterDataDefinition> actionResponse;
- actionResponse = componentNodeFilterBusinessLogic
+ final Optional<CINodeFilterDataDefinition>actionResponse = componentNodeFilterBusinessLogic
.deleteNodeFilter(componentId.toLowerCase(), componentInstanceId, NodeFilterConstraintAction.DELETE,
null, index, true, ComponentTypeEnum.findByParamName(componentType));