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 java.util.List;
26 import org.yaml.snakeyaml.TypeDescription;
28 public class ToscaDefinition {
30 String tosca_definitions_version;
31 Map<String, String> metadata;
32 // Map<String, ToscaImportsDefinition> imports;
33 // TODO waiting for answer about imports representation
35 Map<String, ToscaNodeTypesDefinition> node_types;
36 ToscaTopologyTemplateDefinition topology_template;
38 public ToscaDefinition() {
43 public String toString() {
44 return "ToscaDefinition [tosca_definitions_version=" + tosca_definitions_version + ", metadata=" + metadata + ", imports=" + imports + ", node_types=" + node_types + ", topology_template=" + topology_template + "]";
47 public String getTosca_definitions_version() {
48 return tosca_definitions_version;
51 public void setTosca_definitions_version(String tosca_definitions_version) {
52 this.tosca_definitions_version = tosca_definitions_version;
55 public Map<String, String> getMetadata() {
59 public void setMetadata(Map<String, String> metadata) {
60 this.metadata = metadata;
66 // public Map<String,ToscaImportsDefinition> getImports() {
67 // return (Map<String, ToscaImportsDefinition>) imports;
70 // public void setImports(Map<String,ToscaImportsDefinition> imports) {
71 // this.imports = imports;
74 // public List<ToscaImportsDefinition> getImports() {
75 // return (List<ToscaImportsDefinition>) imports;
78 // public void setImports(List<ToscaImportsDefinition> imports) {
79 // this.imports = imports;
82 public Object getImports() {
86 public void setImports(Object imports) {
87 this.imports = imports;
90 public Map<String, ToscaNodeTypesDefinition> getNode_types() {
94 public void setNode_types(Map<String, ToscaNodeTypesDefinition> node_types) {
95 this.node_types = node_types;
98 public ToscaTopologyTemplateDefinition getTopology_template() {
99 return topology_template;
102 public void setTopology_template(ToscaTopologyTemplateDefinition topology_template) {
103 this.topology_template = topology_template;
108 //gets Type description for Yaml snake
109 public static TypeDescription getTypeDescription(){
110 TypeDescription typeDescription = new TypeDescription(ToscaDefinition.class);
111 typeDescription.putMapPropertyType("metadata", String.class, String.class);
112 // TODO Andrey imports format
113 typeDescription.putMapPropertyType("imports", String.class, ToscaImportsDefinition.class);
114 // typeDescription.putListPropertyType("imports", List.class);
115 typeDescription.putMapPropertyType("node_types", String.class, ToscaNodeTypesDefinition.class);
116 return typeDescription;