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;
}
}
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 {
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;
}