re base code
[sdc.git] / test-apis-ci / src / main / java / org / openecomp / sdc / ci / tests / tosca / datatypes / ToscaGroupsTopologyTemplateDefinition.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.io.Serializable;
26 import java.util.List;
27 import java.util.Map;
28
29 //      spec page 102
30
31 public class ToscaGroupsTopologyTemplateDefinition extends ToscaServiceGroupsMetadataDefinition implements Serializable {
32
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;
43
44         public ToscaGroupsTopologyTemplateDefinition() {
45                 super();
46         }
47
48 //      public ToscaServiceGroupsMetadataDefinition getMetadata() {
49 //              return metadata;
50 //      }
51 //
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;
58         }
59
60
61
62         public String getType() {
63                 return type;
64         }
65
66         public void setType(String type) {
67                 this.type = type;
68         }
69
70         public String getDescription() {
71                 return description;
72         }
73
74         public void setDescription(String description) {
75                 this.description = description;
76         }
77
78 //      public Map<String, String> getProperties() {
79 //              return properties;
80 //      }
81 //
82 //      public void setProperties(Map<String, String> properties) {
83 //              this.properties = properties;
84 //      }
85
86         public ToscaGroupPropertyDefinition getProperties() {
87                 return properties;
88         }
89
90         public void setProperties(ToscaGroupPropertyDefinition properties) {
91                 this.properties = properties;
92         }
93
94         public Map<String, String> getTargets() {
95                 return targets;
96         }
97
98         public void setTargets(Map<String, String> targets) {
99                 this.targets = targets;
100         }
101
102         public Map<String, Object> getInterfaces() {
103                 return interfaces;
104         }
105
106         public void setInterfaces(Map<String, Object> interfaces) {
107                 this.interfaces = interfaces;
108         }
109
110         public List<String> getMembers() {
111                 return members;
112         }
113
114         public void setMembers(List<String> members) {
115                 this.members = members;
116         }
117
118 //      public Map<String, String> getMetadata() {
119 //              return metadata;
120 //      }
121 //
122 //      public void setMetadata(Map<String, String> metadata) {
123 //              this.metadata = metadata;
124 //      }
125
126 //      @Override
127 //      public String toString() {
128 //              return "ToscaGroupsTopologyTemplateDefinition [type=" + type + ", description=" + description + ", properties=" + properties + ", targets=" + targets + ", interfaces=" + interfaces + ", members=" + members + ", metadata=" + metadata
129 //                              + "]";
130 //      }
131
132
133         @Override
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 +
142                                 '}';
143         }
144
145
146         @Override
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;
151
152                 ToscaGroupsTopologyTemplateDefinition that = (ToscaGroupsTopologyTemplateDefinition) o;
153
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;
160
161                 return (properties != null ? properties.equals(that.properties) : false);
162         }
163
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;
175         }
176
177 }