[SDC] Onboarding 1710 rebase.
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / main / java / org / openecomp / sdc / translator / services / heattotosca / globaltypes / GlobalTypesGenerator.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.translator.services.heattotosca.globaltypes;
22
23 import org.openecomp.sdc.tosca.datatypes.model.Import;
24 import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
25 import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
26
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
30 import java.util.Map;
31
32
33 public class GlobalTypesGenerator {
34
35   private GlobalTypesGenerator() {
36   }
37
38   /**
39    * Gets global types service template.
40    *
41    * @return the global types service template
42    */
43   public static Map<String, ServiceTemplate> getGlobalTypesServiceTemplate() {
44     return GlobalTypesServiceTemplates.getGlobalTypesServiceTemplates();
45   }
46
47   /**
48    * Gets global types import list.
49    *
50    * @return the global types import list
51    */
52   public static List<Map<String, Import>> getGlobalTypesImportList() {
53     List<Map<String, Import>> globalImports = new ArrayList<>();
54     Map<String, Import> globalImportMap = new HashMap<>();
55     Map<String, ServiceTemplate> globalTypesServiceTemplate =
56         GlobalTypesGenerator.getGlobalTypesServiceTemplate();
57     globalImportMap.put("openecomp_heat_index",
58         HeatToToscaUtil.createServiceTemplateImport(globalTypesServiceTemplate.get
59             ("openecomp-heat/_index.yml")));
60     globalImports.add(globalImportMap);
61     return globalImports;
62   }
63
64   /**
65    * Gets global types import list for Manual Vsp onboarding.
66    *
67    * @return the global types import list
68    */
69   public static List<Map<String, Import>> getManualVspGlobalTypesImportList() {
70     List<Map<String, Import>> globalImports = new ArrayList<>();
71     Map<String, Import> globalImportMap = new HashMap<>();
72     Map<String, ServiceTemplate> globalTypesServiceTemplate =
73         GlobalTypesGenerator.getGlobalTypesServiceTemplate();
74     globalImportMap.put("openecomp_index",
75         HeatToToscaUtil.createServiceTemplateImport(globalTypesServiceTemplate.get
76             ("openecomp/_index.yml")));
77     globalImports.add(globalImportMap);
78     return globalImports;
79   }
80 }