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.be.datatypes.components;
23 import java.io.Serializable;
25 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
26 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
28 public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
33 private static final long serialVersionUID = 1142973528643758481L;
35 private String vendorName;
36 private String vendorRelease;
37 private String resourceVendorModelNumber;
38 private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC
41 private Boolean isAbstract;
43 private String licenseType;
44 private String toscaResourceName;
46 public ResourceMetadataDataDefinition() {
48 resourceVendorModelNumber = "";
51 public ResourceMetadataDataDefinition(ResourceMetadataDataDefinition other) {
53 this.vendorName = other.getVendorName();
54 this.vendorRelease = other.getVendorRelease();
55 this.resourceVendorModelNumber = other.getResourceVendorModelNumber();
56 this.isAbstract = other.isHighestVersion();
57 this.resourceType = other.getResourceType();
58 this.toscaResourceName = other.getToscaResourceName();
61 public String getVendorName() {
65 public void setVendorName(String vendorName) {
66 this.vendorName = vendorName;
69 public String getVendorRelease() {
73 public void setVendorRelease(String vendorRelease) {
74 this.vendorRelease = vendorRelease;
77 public String getResourceVendorModelNumber() {
78 return resourceVendorModelNumber;
81 public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
82 this.resourceVendorModelNumber = resourceVendorModelNumber;
86 public ResourceTypeEnum getResourceType() {
90 public void setResourceType(ResourceTypeEnum resourceType) {
91 this.resourceType = resourceType;
94 public Boolean isAbstract() {
98 public void setAbstract(Boolean isAbstract) {
99 this.isAbstract = isAbstract;
102 public String getCost() {
106 public void setCost(String cost) {
110 public String getLicenseType() {
114 public void setLicenseType(String licenseType) {
115 this.licenseType = licenseType;
118 public String getToscaResourceName() {
119 return toscaResourceName;
122 public void setToscaResourceName(String toscaResourceName) {
123 this.toscaResourceName = toscaResourceName;
127 public String toString() {
128 return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease
129 + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType +
130 ", isAbstract=" + isAbstract + super.toString() + "]";
134 public int hashCode() {
135 final int prime = 31;
136 int result = super.hashCode();
137 result = prime * result + ((cost == null) ? 0 : cost.hashCode());
138 result = prime * result + ((isAbstract == null) ? 0 : isAbstract.hashCode());
139 result = prime * result + ((licenseType == null) ? 0 : licenseType.hashCode());
140 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
141 result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode());
142 result = prime * result + ((vendorRelease == null) ? 0 : vendorRelease.hashCode());
143 result = prime * result + ((resourceVendorModelNumber == null)? 0 : resourceVendorModelNumber.hashCode());
148 public boolean equals(Object obj) {
151 if (!super.equals(obj))
153 if (getClass() != obj.getClass())
155 ResourceMetadataDataDefinition other = (ResourceMetadataDataDefinition) obj;
157 if (other.cost != null)
159 } else if (!cost.equals(other.cost))
161 if (isAbstract == null) {
162 if (other.isAbstract != null)
164 } else if (!isAbstract.equals(other.isAbstract))
166 if (licenseType == null) {
167 if (other.licenseType != null)
169 } else if (!licenseType.equals(other.licenseType))
171 if (resourceType != other.resourceType)
173 if (vendorName == null) {
174 if (other.vendorName != null)
176 } else if (!vendorName.equals(other.vendorName))
178 if (vendorRelease == null) {
179 if (other.vendorRelease != null)
182 if (toscaResourceName == null) {
183 if (other.toscaResourceName != null)
185 } else if (!vendorRelease.equals(other.vendorRelease))
187 if (resourceVendorModelNumber == null) {
188 if (other.resourceVendorModelNumber != null)
190 } else if (!resourceVendorModelNumber.equals(other.resourceVendorModelNumber))
193 return super.equals(obj);