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;
27 import java.util.Objects;
30 public class NodeTemplate implements Template {
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;
45 public String getType() {
49 public void setType(String type) {
53 public String getDescription() {
57 public void setDescription(String description) {
58 this.description = description;
61 public Map<String, String> getMetadata() {
65 public void setMetadata(Map<String, String> metadata) {
66 this.metadata = metadata;
69 public List<String> getDirectives() {
73 public void setDirectives(List<String> directives) {
74 this.directives = directives;
77 public Map<String, Object> getProperties() {
81 public void setProperties(Map<String, Object> properties) {
82 this.properties = properties;
85 public Map<String, Object> getAttributes() {
89 public void setAttributes(Map<String, Object> attributes) {
90 this.attributes = attributes;
93 public List<Map<String, RequirementAssignment>> getRequirements() {
97 public void setRequirements(List<Map<String, RequirementAssignment>> requirements) {
98 this.requirements = requirements;
101 public Map<String, CapabilityAssignment> getCapabilities() {
105 public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
106 this.capabilities = capabilities;
109 public Map<String, Object> getInterfaces() {
113 public void setInterfaces(Map<String, Object> interfaces) {
114 this.interfaces = interfaces;
117 public Map<String, ArtifactDefinition> getArtifacts() {
121 public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
122 this.artifacts = artifacts;
125 public NodeFilter getNode_filter() {
129 public void setNode_filter(NodeFilter node_filter) {
130 this.node_filter = node_filter;
133 public String getCopy() {
137 public void setCopy(String copy) {
142 public NodeTemplate clone() {
143 YamlUtil yamlUtil = new YamlUtil();
144 return yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class);
148 public boolean equals(Object o) {
152 if (!(o instanceof NodeTemplate)) {
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);
171 public int hashCode() {
174 .hash(type, description, metadata, directives, properties, attributes, requirements,
175 capabilities, interfaces, artifacts, node_filter, copy);