2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.ci.tests.tosca.datatypes;
23 import org.yaml.snakeyaml.TypeDescription;
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
30 public class ToscaDefinition {
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();
38 public ToscaDefinition() {
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) {
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;
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);
60 public List<Map<String, ToscaImportsDefinition>> getImports() {
64 public void setImports(List<Map<String, ToscaImportsDefinition>> imports) {
65 this.imports = imports;
68 public Map<String, String> getMetadata() {
72 public void setMetadata(Map<String, String> metadata) {
73 this.metadata = metadata;
76 public String getTosca_definitions_version() {
77 return tosca_definitions_version;
80 public void setTosca_definitions_version(String tosca_definitions_version) {
81 this.tosca_definitions_version = tosca_definitions_version;
85 public Map<String, ToscaNodeTypesDefinition> getNode_types() {
89 public void setNode_types(Map<String, ToscaNodeTypesDefinition> node_types) {
90 this.node_types = node_types;
93 public ToscaTopologyTemplateDefinition getTopology_template() {
94 return topology_template;
97 public void setTopology_template(ToscaTopologyTemplateDefinition topology_template) {
98 this.topology_template = topology_template;
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;