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 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;
43 public String getType() {
47 public void setType(String type) {
51 public String getDescription() {
55 public void setDescription(String description) {
56 this.description = description;
59 public List<String> getDirectives() {
63 public void setDirectives(List<String> directives) {
64 this.directives = directives;
67 public Map<String, Object> getProperties() {
71 public void setProperties(Map<String, Object> properties) {
72 this.properties = properties;
75 public Map<String, Object> getAttributes() {
79 public void setAttributes(Map<String, Object> attributes) {
80 this.attributes = attributes;
83 public List<Map<String, RequirementAssignment>> getRequirements() {
87 public void setRequirements(List<Map<String, RequirementAssignment>> requirements) {
88 this.requirements = requirements;
91 public Map<String, CapabilityAssignment> getCapabilities() {
95 public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
96 this.capabilities = capabilities;
99 public Map<String, InterfaceDefinition> getInterfaces() {
103 public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
104 this.interfaces = interfaces;
107 public Map<String, ArtifactDefinition> getArtifacts() {
111 public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
112 this.artifacts = artifacts;
115 public NodeFilter getNode_filter() {
119 public void setNode_filter(NodeFilter node_filter) {
120 this.node_filter = node_filter;
123 public String getCopy() {
127 public void setCopy(String copy) {
132 public NodeTemplate clone() {
133 YamlUtil yamlUtil = new YamlUtil();
134 NodeTemplate clone = yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class);
139 public boolean equals(Object o) {
143 if (!(o instanceof NodeTemplate)) {
147 NodeTemplate that = (NodeTemplate) o;
149 if (type != null ? !type.equals(that.type) : that.type != null) {
152 if (description != null ? !description.equals(that.description) : that.description != null) {
155 if (directives != null ? !directives.equals(that.directives) : that.directives != null) {
158 if (properties != null ? !properties.equals(that.properties) : that.properties != null) {
161 if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) {
164 if (requirements != null ? !requirements.equals(that.requirements)
165 : that.requirements != null) {
168 if (capabilities != null ? !capabilities.equals(that.capabilities)
169 : that.capabilities != null) {
172 if (interfaces != null ? !interfaces.equals(that.interfaces) : that.interfaces != null) {
175 if (artifacts != null ? !artifacts.equals(that.artifacts) : that.artifacts != null) {
178 if (node_filter != null ? !node_filter.equals(that.node_filter) : that.node_filter != null) {
181 return copy != null ? copy.equals(that.copy) : that.copy == null;
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);