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.tosca.datatypes.model;
23 import org.openecomp.sdc.tosca.services.YamlUtil;
25 import java.util.List;
29 public class NodeTemplate implements Template {
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;
44 public String getType() {
48 public void setType(String type) {
52 public String getDescription() {
56 public void setDescription(String description) {
57 this.description = description;
60 public Map<String, String> getMetadata() {
64 public void setMetadata(Map<String, String> metadata) {
65 this.metadata = metadata;
68 public List<String> getDirectives() {
72 public void setDirectives(List<String> directives) {
73 this.directives = directives;
76 public Map<String, Object> getProperties() {
80 public void setProperties(Map<String, Object> properties) {
81 this.properties = properties;
84 public Map<String, Object> getAttributes() {
88 public void setAttributes(Map<String, Object> attributes) {
89 this.attributes = attributes;
92 public List<Map<String, RequirementAssignment>> getRequirements() {
96 public void setRequirements(List<Map<String, RequirementAssignment>> requirements) {
97 this.requirements = requirements;
100 public Map<String, CapabilityAssignment> getCapabilities() {
104 public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
105 this.capabilities = capabilities;
108 public Map<String, Object> getInterfaces() {
112 public void setInterfaces(Map<String, Object> interfaces) {
113 this.interfaces = interfaces;
116 public Map<String, ArtifactDefinition> getArtifacts() {
120 public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
121 this.artifacts = artifacts;
124 public NodeFilter getNode_filter() {
128 public void setNode_filter(NodeFilter node_filter) {
129 this.node_filter = node_filter;
132 public String getCopy() {
136 public void setCopy(String copy) {
141 public NodeTemplate clone() {
142 YamlUtil yamlUtil = new YamlUtil();
143 return yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class);
147 public boolean equals(Object o) {
151 if (!(o instanceof NodeTemplate)) {
155 NodeTemplate that = (NodeTemplate) o;
157 if (type != null ? !type.equals(that.type) : that.type != null) {
160 if (description != null ? !description.equals(that.description) : that.description != null) {
163 if (directives != null ? !directives.equals(that.directives) : that.directives != null) {
166 if (properties != null ? !properties.equals(that.properties) : that.properties != null) {
169 if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) {
172 if (requirements != null ? !requirements.equals(that.requirements)
173 : that.requirements != null) {
176 if (capabilities != null ? !capabilities.equals(that.capabilities)
177 : that.capabilities != null) {
180 if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) {
183 if (artifacts != null ? !artifacts.equals(that.artifacts) : that.artifacts != null) {
186 if (node_filter != null ? !node_filter.equals(that.node_filter) : that.node_filter != null) {
189 return copy != null ? copy.equals(that.copy) : that.copy == null;
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);