aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-03-09 12:10:41 +0000
committerMichaelMorris <michael.morris@est.tech>2022-03-09 12:10:49 +0000
commitca1cef5e1c74dc5e8d2fb17864648e94b9b66aa0 (patch)
treec435c2304f6c8d964fb31ec9b7c277e4d3bf8345 /catalog-be
parent0f30b5b0aad2bfed9f30ff28fb5312b7838825de (diff)
Fix node filter capability issue
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3901 Change-Id: I877fcf99d154939eafe765073ecddf38bc7d9ba7
Diffstat (limited to 'catalog-be')
-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);