aboutsummaryrefslogtreecommitdiffstats
path: root/common-be/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src/main')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelper.java43
1 files changed, 38 insertions, 5 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelper.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelper.java
index 1f7459c59d..fa9e4d5fc7 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelper.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelper.java
@@ -67,10 +67,25 @@ public class PropertyFilterConstraintDataDefinitionHelper {
final Optional<ToscaFunction> toscaFunction = createToscaFunctionFromLegacyConstraintValue(valueYaml);
if (toscaFunction.isPresent()) {
propertyFilterConstraint.setValue(toscaFunction.get());
- } else {
+ propertyFilterConstraint.setValueType(detectValueType(valueYaml));
+ }
+ else {
propertyFilterConstraint.setValue(valueYaml);
+ if (valueYaml instanceof List) {
+ List<ToscaFunction> listToscaFunction = new ArrayList<>();
+ ((List<?>) valueYaml).stream().forEach(val -> {
+ final Optional<ToscaFunction> optToscaFunctionLst = createToscaFunctionFromLegacyConstraintValue(val);
+ if (optToscaFunctionLst.isPresent()) {
+ listToscaFunction.add(optToscaFunctionLst.get());
+ }
+ });
+ propertyFilterConstraint.setValue(listToscaFunction);
+ propertyFilterConstraint.setValueType(FilterValueType.SEVERAL);
+ }
+ else {
+ propertyFilterConstraint.setValueType(detectValueType(valueYaml));
+ }
}
- propertyFilterConstraint.setValueType(detectValueType(valueYaml));
propertyFilterConstraint.setTargetType(PropertyFilterTargetType.PROPERTY);
return propertyFilterConstraint;
}
@@ -90,9 +105,7 @@ public class PropertyFilterConstraintDataDefinitionHelper {
}
ToscaFunctionType toscaFunctionType = ToscaFunctionType.findType((String) toscaFunctionTypeObject).orElse(null);
if (toscaFunctionType == null) {
- if (((String) toscaFunctionTypeObject).equalsIgnoreCase("$get_input_ext") ||
- ((String) toscaFunctionTypeObject).equalsIgnoreCase("$juel") ||
- ((String) toscaFunctionTypeObject).equalsIgnoreCase("$other")) {
+ if (((String) toscaFunctionTypeObject).startsWith("$")) {
toscaFunctionType = ToscaFunctionType.CUSTOM;
}
else {
@@ -509,6 +522,26 @@ public class PropertyFilterConstraintDataDefinitionHelper {
return FilterValueType.CUSTOM;
}
}
+ else if (value instanceof List) {
+ final Map<?, ?> valueAsMap = (Map<?, ?>) ((List<?>) value).get(0);
+ if (valueAsMap.containsKey(ToscaFunctionType.CONCAT.getName())) {
+ return FilterValueType.CONCAT;
+ }
+ if (valueAsMap.containsKey(ToscaFunctionType.GET_ATTRIBUTE.getName())) {
+ return FilterValueType.GET_ATTRIBUTE;
+ }
+ if (valueAsMap.containsKey(ToscaFunctionType.GET_PROPERTY.getName())) {
+ return FilterValueType.GET_PROPERTY;
+ }
+ if (valueAsMap.containsKey(ToscaFunctionType.GET_INPUT.getName())) {
+ return FilterValueType.GET_INPUT;
+ }
+ if (valueAsMap.containsKey("$get_input_ext") ||
+ valueAsMap.containsKey("$juel") ||
+ valueAsMap.containsKey("$other")) {
+ return FilterValueType.CUSTOM;
+ }
+ }
return FilterValueType.STATIC;
}