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