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