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.io.Serializable;
26 import java.util.List;
31 public class ToscaGroupsTopologyTemplateDefinition extends ToscaServiceGroupsMetadataDefinition implements Serializable {
33 public static final long serialVersionUID = -6373752349967949120L;
34 public String type; // required
35 public String description;
36 // private Map<String, String> properties;
37 public ToscaGroupPropertyDefinition properties;
38 public Map<String, String> targets; // required
39 public Map<String, Object> interfaces;
40 public List<String> members;
41 // private Map<String, String> metadata;
42 // private ToscaServiceGroupsMetadataDefinition metadata;
44 public ToscaGroupsTopologyTemplateDefinition() {
48 // public ToscaServiceGroupsMetadataDefinition getMetadata() {
52 public void setMetadata(ToscaServiceGroupsMetadataDefinition metadata) {
53 this.vfModuleModelCustomizationUUID = metadata.vfModuleModelCustomizationUUID;
54 this.vfModuleModelInvariantUUID = metadata.vfModuleModelInvariantUUID;
55 this.vfModuleModelName = metadata.vfModuleModelName;
56 this.vfModuleModelUUID = metadata.vfModuleModelUUID;
57 this.vfModuleModelVersion = metadata.vfModuleModelVersion;
62 public String getType() {
66 public void setType(String type) {
70 public String getDescription() {
74 public void setDescription(String description) {
75 this.description = description;
78 // public Map<String, String> getProperties() {
82 // public void setProperties(Map<String, String> properties) {
83 // this.properties = properties;
86 public ToscaGroupPropertyDefinition getProperties() {
90 public void setProperties(ToscaGroupPropertyDefinition properties) {
91 this.properties = properties;
94 public Map<String, String> getTargets() {
98 public void setTargets(Map<String, String> targets) {
99 this.targets = targets;
102 public Map<String, Object> getInterfaces() {
106 public void setInterfaces(Map<String, Object> interfaces) {
107 this.interfaces = interfaces;
110 public List<String> getMembers() {
114 public void setMembers(List<String> members) {
115 this.members = members;
118 // public Map<String, String> getMetadata() {
122 // public void setMetadata(Map<String, String> metadata) {
123 // this.metadata = metadata;
127 // public String toString() {
128 // return "ToscaGroupsTopologyTemplateDefinition [type=" + type + ", description=" + description + ", properties=" + properties + ", targets=" + targets + ", interfaces=" + interfaces + ", members=" + members + ", metadata=" + metadata
134 public String toString() {
135 return "ToscaGroupsTopologyTemplateDefinition{" +
136 "type='" + type + '\'' +
137 ", description='" + description + '\'' +
138 ", properties=" + properties +
139 ", targets=" + targets +
140 ", interfaces=" + interfaces +
141 ", members=" + members +
147 public boolean equals(Object o) {
148 if (this == o) return true;
149 if (!(o instanceof ToscaGroupsTopologyTemplateDefinition)) return false;
150 if (!super.equals(o)) return false;
152 ToscaGroupsTopologyTemplateDefinition that = (ToscaGroupsTopologyTemplateDefinition) o;
154 // if (type != null ? !type.equals(that.type) : that.type != null) return false;
155 // if (description != null ? !description.equals(that.description) : that.description != null) return false;
156 // if (properties != null ? !properties.equals(that.properties) : that.properties != null) return false;
157 // if (targets != null ? !targets.equals(that.targets) : that.targets != null) return false;
158 // if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) return false;
159 // return members != null ? members.equals(that.members) : that.members == null;
161 return (properties != null ? properties.equals(that.properties) : false);
164 //gets Type description for Yaml snake
165 public static TypeDescription getTypeDescription(){
166 TypeDescription typeDescription = new TypeDescription(ToscaGroupsTopologyTemplateDefinition.class);
167 // typeDescription.putMapPropertyType("properties", String.class, Object.class);
168 // typeDescription.putListPropertyType("properties", ToscaGroupPropertyDefinition.class);
169 typeDescription.putMapPropertyType("interfaces", String.class, Object.class);
170 typeDescription.putMapPropertyType("targets", String.class, Object.class);
171 // typeDescription.putMapPropertyType("metadata", String.class, String.class);
172 typeDescription.putMapPropertyType("metadata", String.class, String.class);
173 typeDescription.putListPropertyType("members", String.class);
174 return typeDescription;