private void addNodeType(PropertyDefinition artifact, ServiceTemplate toscaTemplate) throws ArtifactProcessorException { //Add basic fields for the node NodeType toscaNodeType = new NodeType(); toscaNodeType.setDerived_from(DERIVEDFROM); toscaNodeType.setVersion(artifact.getVersion()); toscaNodeType.setDescription(""); if(artifact.getParameters()!=null) { Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> toscaPropertyMap = new HashMap<>(); toscaNodeType.setProperties(toscaPropertyMap); //Add properties from parameters of PD for (Parameter pdParameter : artifact.getParameters()) { addProperty(toscaNodeType, pdParameter); } } // This is where it adds node in node Map and adds the map in tosca template Map<String,NodeType> toscaNodeMap = new HashMap<>(); toscaNodeMap.put(artifact.getKind(),toscaNodeType); toscaTemplate.setNode_types(toscaNodeMap); }
private void addNodeType(PropertyDefinition artifact, ServiceTemplate toscaTemplate) throws ArtifactProcessorException { // Add basic fields for the node NodeType toscaNodeType = new NodeType(); toscaNodeType.setDerived_from(DERIVEDFROM); toscaNodeType.setVersion(artifact.getVersion()); toscaNodeType.setDescription(""); if (artifact.getParameters() != null) { Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> toscaPropertyMap = new HashMap<>(); toscaNodeType.setProperties(toscaPropertyMap); // Add properties from parameters of PD for (Parameter pdParameter : artifact.getParameters()) { addProperty(toscaNodeType, pdParameter); } } // This is where it adds node in node Map and adds the map in tosca template Map<String, NodeType> toscaNodeMap = new HashMap<>(); toscaNodeMap.put(artifact.getKind(), toscaNodeType); toscaTemplate.setNode_types(toscaNodeMap); }