1 package org.openecomp.core.impl;
3 import org.openecomp.sdc.logging.api.Logger;
4 import org.openecomp.sdc.logging.api.LoggerFactory;
5 import org.openecomp.sdc.tosca.datatypes.model.Import;
6 import org.openecomp.sdc.tosca.datatypes.model.NodeType;
7 import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
9 import java.util.ArrayList;
10 import java.util.HashMap;
11 import java.util.List;
14 public class GlobalSubstitutionServiceTemplate extends ServiceTemplate {
15 private static final Logger logger = LoggerFactory.getLogger(ServiceTemplate.class);
17 public static final String GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME = "GlobalSubstitutionServiceTemplate.yaml";
18 public static final String TEMPLATE_NAME_PROPERTY = "template_name";
19 public static final String DEFININTION_VERSION = "tosca_simple_yaml_1_0_0";
20 public static final String HEAT_INDEX = "openecomp_heat_index";
22 public GlobalSubstitutionServiceTemplate() {
28 public void appendNodes(Map<String, NodeType> nodes) {
29 getNode_types().putAll(nodes);
33 writeDefinitionSection();
34 writeMetadataSection();
35 writeImportsSection();
36 setNode_types(new HashMap<>());
39 private void writeImportsSection() {
40 List<Map<String, Import>> imports = new ArrayList<>();
41 Map<String, Import> stringImportMap = new HashMap<>();
42 imports.add(stringImportMap);
44 Import imprtObj = new Import();
45 imprtObj.setFile("openecomp-heat/_index.yml");
46 stringImportMap.put("openecomp_heat_index", imprtObj);
50 private void writeMetadataSection() {
51 Map<String, String> metadata = new HashMap<>();
52 metadata.put(TEMPLATE_NAME_PROPERTY, "GlobalSubstitutionTypes");
53 setMetadata(metadata);
56 private void writeDefinitionSection() {
57 setTosca_definitions_version(DEFININTION_VERSION);