01b1c6a9592ad9a741b6aea27605a9734d5ade74
[sdc.git] /
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.tosca.datatypes.model;
22
23 import org.openecomp.sdc.tosca.services.YamlUtil;
24
25 import java.util.List;
26 import java.util.Map;
27
28
29 public class NodeTemplate implements Template {
30
31   private String type;
32   private String description;
33   private Map<String, String> metadata;
34   private List<String> directives;
35   private Map<String, Object> properties;
36   private Map<String, Object> attributes;
37   private List<Map<String, RequirementAssignment>> requirements;
38   private Map<String, CapabilityAssignment> capabilities;
39   private Map<String, Object> interfaces;
40   private Map<String, ArtifactDefinition> artifacts;
41   private NodeFilter node_filter;
42   private String copy;
43
44   public String getType() {
45     return type;
46   }
47
48   public void setType(String type) {
49     this.type = type;
50   }
51
52   public String getDescription() {
53     return description;
54   }
55
56   public void setDescription(String description) {
57     this.description = description;
58   }
59
60   public Map<String, String> getMetadata() {
61     return metadata;
62   }
63
64   public void setMetadata(Map<String, String> metadata) {
65     this.metadata = metadata;
66   }
67
68   public List<String> getDirectives() {
69     return directives;
70   }
71
72   public void setDirectives(List<String> directives) {
73     this.directives = directives;
74   }
75
76   public Map<String, Object> getProperties() {
77     return properties;
78   }
79
80   public void setProperties(Map<String, Object> properties) {
81     this.properties = properties;
82   }
83
84   public Map<String, Object> getAttributes() {
85     return attributes;
86   }
87
88   public void setAttributes(Map<String, Object> attributes) {
89     this.attributes = attributes;
90   }
91
92   public List<Map<String, RequirementAssignment>> getRequirements() {
93     return requirements;
94   }
95
96   public void setRequirements(List<Map<String, RequirementAssignment>> requirements) {
97     this.requirements = requirements;
98   }
99
100   public Map<String, CapabilityAssignment> getCapabilities() {
101     return capabilities;
102   }
103
104   public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
105     this.capabilities = capabilities;
106   }
107
108   public Map<String, Object> getInterfaces() {
109     return interfaces;
110   }
111
112   public void setInterfaces(Map<String, Object> interfaces) {
113     this.interfaces = interfaces;
114   }
115
116   public Map<String, ArtifactDefinition> getArtifacts() {
117     return artifacts;
118   }
119
120   public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
121     this.artifacts = artifacts;
122   }
123
124   public NodeFilter getNode_filter() {
125     return node_filter;
126   }
127
128   public void setNode_filter(NodeFilter node_filter) {
129     this.node_filter = node_filter;
130   }
131
132   public String getCopy() {
133     return copy;
134   }
135
136   public void setCopy(String copy) {
137     this.copy = copy;
138   }
139
140   @Override
141   public NodeTemplate clone() {
142     YamlUtil yamlUtil = new YamlUtil();
143     return yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class);
144   }
145
146   @Override
147   public boolean equals(Object o) {
148     if (this == o) {
149       return true;
150     }
151     if (!(o instanceof NodeTemplate)) {
152       return false;
153     }
154
155     NodeTemplate that = (NodeTemplate) o;
156
157     if (type != null ? !type.equals(that.type) : that.type != null) {
158       return false;
159     }
160     if (description != null ? !description.equals(that.description) : that.description != null) {
161       return false;
162     }
163     if (directives != null ? !directives.equals(that.directives) : that.directives != null) {
164       return false;
165     }
166     if (properties != null ? !properties.equals(that.properties) : that.properties != null) {
167       return false;
168     }
169     if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) {
170       return false;
171     }
172     if (requirements != null ? !requirements.equals(that.requirements)
173         : that.requirements != null) {
174       return false;
175     }
176     if (capabilities != null ? !capabilities.equals(that.capabilities)
177         : that.capabilities != null) {
178       return false;
179     }
180     if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) {
181       return false;
182     }
183     if (artifacts != null ? !artifacts.equals(that.artifacts) : that.artifacts != null) {
184       return false;
185     }
186     if (node_filter != null ? !node_filter.equals(that.node_filter) : that.node_filter != null) {
187       return false;
188     }
189     return copy != null ? copy.equals(that.copy) : that.copy == null;
190   }
191
192   @Override
193   public int hashCode() {
194     int result = type != null ? type.hashCode() : 0;
195     result = 31 * result + (description != null ? description.hashCode() : 0);
196     result = 31 * result + (directives != null ? directives.hashCode() : 0);
197     result = 31 * result + (properties != null ? properties.hashCode() : 0);
198     result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
199     result = 31 * result + (requirements != null ? requirements.hashCode() : 0);
200     result = 31 * result + (capabilities != null ? capabilities.hashCode() : 0);
201     result = 31 * result + (interfaces != null ? interfaces.hashCode() : 0);
202     result = 31 * result + (artifacts != null ? artifacts.hashCode() : 0);
203     result = 31 * result + (node_filter != null ? node_filter.hashCode() : 0);
204     result = 31 * result + (copy != null ? copy.hashCode() : 0);
205     return result;
206   }
207 }