Provide tosca function to List entries
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / csar / YamlTemplateParsingHandler.java
index 9734a0a..1500074 100644 (file)
@@ -1374,6 +1374,7 @@ public class YamlTemplateParsingHandler {
 
     @SuppressWarnings("unchecked")
     private void fillInputsListRecursively(UploadPropInfo propertyDef, List<Object> propValueList) {
+        int index = 0;
         for (Object objValue : propValueList) {
             if (objValue instanceof Map) {
                 Map<String, Object> objMap = (Map<String, Object>) objValue;
@@ -1383,10 +1384,24 @@ public class YamlTemplateParsingHandler {
                     Set<String> keys = objMap.keySet();
                     findAndFillInputsListRecursively(propertyDef, objMap, keys);
                 }
+                if (toscaFunctionYamlParsingHandler.isPropertyValueToscaFunction(objValue)) {
+                    Map<String, Object> propValueMap = new HashMap<String, Object>();
+                    propValueMap.put(String.valueOf(index),objValue);
+                    final Collection<SubPropertyToscaFunction> subPropertyToscaFunctions = buildSubPropertyToscaFunctions(propValueMap, new ArrayList<>());
+                    if (CollectionUtils.isNotEmpty(subPropertyToscaFunctions)) {
+                        Collection<SubPropertyToscaFunction> existingSubPropertyToscaFunctions = propertyDef.getSubPropertyToscaFunctions();
+                        if (existingSubPropertyToscaFunctions == null) {
+                            propertyDef.setSubPropertyToscaFunctions(subPropertyToscaFunctions);
+                        } else {
+                            propertyDef.getSubPropertyToscaFunctions().addAll(subPropertyToscaFunctions);
+                        }
+                    }
+                }
             } else if (objValue instanceof List) {
                 List<Object> propSubValueList = (List<Object>) objValue;
                 fillInputsListRecursively(propertyDef, propSubValueList);
             }
+            index++;
         }
     }