re base code
[sdc.git] / test-apis-ci / src / main / java / org / openecomp / sdc / ci / tests / tosca / datatypes / ToscaDefinition.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.ci.tests.tosca.datatypes;
22
23 import org.yaml.snakeyaml.TypeDescription;
24
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
28 import java.util.Map;
29
30 public class ToscaDefinition {
31
32         String tosca_definitions_version;
33         Map<String, String> metadata = new HashMap<>();
34         List<Map<String, ToscaImportsDefinition>> imports = new ArrayList<>();
35         Map<String, ToscaNodeTypesDefinition> node_types = new HashMap<>();
36         ToscaTopologyTemplateDefinition topology_template = new ToscaTopologyTemplateDefinition();
37
38         public ToscaDefinition() {
39                 super();
40         }
41
42         public ToscaDefinition(String tosca_definitions_version, Map<String, String> metadata, List<Map<String, ToscaImportsDefinition>> imports, Map<String, ToscaNodeTypesDefinition> node_types,
43                         ToscaTopologyTemplateDefinition topology_template) {
44                 super();
45                 this.tosca_definitions_version = tosca_definitions_version;
46                 this.metadata = metadata;
47                 this.imports = imports;
48                 this.node_types = node_types;
49                 this.topology_template = topology_template;
50         }
51
52         public ToscaDefinition(ToscaDefinition toscaDefinition){
53                 this.tosca_definitions_version = toscaDefinition.tosca_definitions_version;
54                 this.metadata = new HashMap<>(toscaDefinition.metadata);
55                 this.imports = new ArrayList<>(toscaDefinition.imports);
56                 this.node_types = new HashMap<>(toscaDefinition.node_types);
57                 this.topology_template = new ToscaTopologyTemplateDefinition(toscaDefinition.topology_template);
58         }
59         
60         public List<Map<String, ToscaImportsDefinition>> getImports() {
61                 return imports;
62         }
63
64         public void setImports(List<Map<String, ToscaImportsDefinition>> imports) {
65                 this.imports = imports;
66         }
67
68         public Map<String, String> getMetadata() {
69                 return metadata;
70         }
71
72         public void setMetadata(Map<String, String> metadata) {
73                 this.metadata = metadata;
74         }
75
76         public String getTosca_definitions_version() {
77                 return tosca_definitions_version;
78         }
79
80         public void setTosca_definitions_version(String tosca_definitions_version) {
81                 this.tosca_definitions_version = tosca_definitions_version;
82         }
83
84         
85         public Map<String, ToscaNodeTypesDefinition> getNode_types() {
86                 return node_types;
87         }
88
89         public void setNode_types(Map<String, ToscaNodeTypesDefinition> node_types) {
90                 this.node_types = node_types;
91         }
92
93         public ToscaTopologyTemplateDefinition getTopology_template() {
94                 return topology_template;
95         }
96
97         public void setTopology_template(ToscaTopologyTemplateDefinition topology_template) {
98                 this.topology_template = topology_template;
99         }
100
101
102
103         //gets Type description for Yaml snake
104         public static TypeDescription getTypeDescription(){
105         TypeDescription typeDescription = new TypeDescription(ToscaDefinition.class);
106         typeDescription.putMapPropertyType("metadata", String.class, String.class);
107         typeDescription.putListPropertyType("imports", Map.class);
108         typeDescription.putMapPropertyType("node_types", String.class, ToscaNodeTypesDefinition.class);
109         return typeDescription;
110         }
111         
112         
113 }