summaryrefslogtreecommitdiffstats
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/validation/NodeFilterValidator.java10
1 files changed, 7 insertions, 3 deletions
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 01e07eb6cd..db5de58129 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
@@ -257,11 +257,11 @@ public class NodeFilterValidator {
capabilityDefinition -> capabilityDefinition.getProperties().stream().anyMatch(
componentInstanceProperty -> uiConstraint.getServicePropertyName()
.equalsIgnoreCase(componentInstanceProperty.getName())))).findFirst();
- if (optionalCapabilityDefinitionList.isPresent()) {
- optionalComponentInstanceProperty = optionalCapabilityDefinitionList.get().stream().findAny()
- .map(capabilityDefinition -> capabilityDefinition.getProperties().get(0));
+ if (optionalCapabilityDefinitionList.isPresent() && !optionalCapabilityDefinitionList.get().isEmpty()) {
+ optionalComponentInstanceProperty = getComponentInstanceProperty(optionalCapabilityDefinitionList.get().get(0), uiConstraint.getServicePropertyName());
}
}
+
if (optionalComponentInstanceProperty.isEmpty()) {
return Either.right(componentsUtils.getResponseFormat(ActionStatus.SELECTED_PROPERTY_NOT_PRESENT, uiConstraint.getServicePropertyName()));
}
@@ -273,6 +273,10 @@ public class NodeFilterValidator {
return isValidValueCheck(optionalComponentInstanceProperty.get().getType(), String.valueOf(uiConstraint.getValue()),
uiConstraint.getServicePropertyName());
}
+
+ private Optional<ComponentInstanceProperty> getComponentInstanceProperty(CapabilityDefinition capabilityDefinition, final String propertyName){
+ return capabilityDefinition.getProperties().stream().filter(property -> property.getName().equals(propertyName)).findAny();
+ }
private Either<Boolean, ResponseFormat> isValidValueCheck(String type, String value, String propertyName) {
ToscaPropertyType toscaPropertyType = ToscaPropertyType.isValidType(type);