Provide import support for timeout field in interface operation implementation
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / impl / InterfaceDefinitionHandler.java
index aa15d8a..4e535eb 100644 (file)
@@ -51,6 +51,7 @@ import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
 import org.openecomp.sdc.be.model.InputDefinition;
 import org.openecomp.sdc.be.model.InterfaceDefinition;
 import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
@@ -261,11 +262,27 @@ public class InterfaceDefinitionHandler {
                         propertyDef.setName(k);
                         propertyDef.setType(type.getType());
                         propertyDef.setValue(v.toString());
+                        if (type.equals(ToscaPropertyType.LIST)) {
+                            Gson gson = new Gson();
+                            propertyDef.setValue(gson.toJson(v));
+                            PropertyDataDefinition pdd = new PropertyDataDefinition();
+                            pdd.setType("string");
+                            SchemaDefinition sd = new SchemaDefinition();
+                            sd.setProperty(pdd);
+                            propertyDef.setSchema(sd);
+                        }
                         artifactDataDefinition.addProperty(propertyDef);
                     }
                 });
             }
         }
+
+        if (operationDefinitionMap.get(IMPLEMENTATION.getElementName()) instanceof Map &&
+            ((Map) operationDefinitionMap.get(IMPLEMENTATION.getElementName())).containsKey("timeout")) {
+            final Object timeOut = ((Map) operationDefinitionMap.get(IMPLEMENTATION.getElementName())).get("timeout");
+            artifactDataDefinition.setTimeout((Integer)timeOut);
+        }
+
         if (operationDefinitionMap.get(IMPLEMENTATION.getElementName()) instanceof String) {
             final String implementation = (String) operationDefinitionMap.get(IMPLEMENTATION.getElementName());
             artifactDataDefinition.setArtifactName(generateArtifactName(implementation));
@@ -294,6 +311,9 @@ public class InterfaceDefinitionHandler {
         if (value instanceof Float || value instanceof Double) {
             return ToscaPropertyType.FLOAT;
         }
+        if (value instanceof List) {
+            return ToscaPropertyType.LIST;
+        }
         return null;
     }