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 org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
25 import java.io.Serializable;
27 public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
32 private static final long serialVersionUID = 1142973528643758481L;
34 private String vendorName;
35 private String vendorRelease;
36 private String resourceVendorModelNumber;
37 private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC
40 private Boolean isAbstract;
42 private String licenseType;
43 private String toscaResourceName;
45 public ResourceMetadataDataDefinition() {
47 resourceVendorModelNumber = "";
50 public ResourceMetadataDataDefinition(ResourceMetadataDataDefinition other) {
52 this.vendorName = other.getVendorName();
53 this.vendorRelease = other.getVendorRelease();
54 this.resourceVendorModelNumber = other.getResourceVendorModelNumber();
55 this.isAbstract = other.isHighestVersion();
56 this.resourceType = other.getResourceType();
57 this.toscaResourceName = other.getToscaResourceName();
60 public String getVendorName() {
64 public void setVendorName(String vendorName) {
65 this.vendorName = vendorName;
68 public String getVendorRelease() {
72 public void setVendorRelease(String vendorRelease) {
73 this.vendorRelease = vendorRelease;
76 public String getResourceVendorModelNumber() {
77 return resourceVendorModelNumber;
80 public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
81 this.resourceVendorModelNumber = resourceVendorModelNumber;
85 public ResourceTypeEnum getResourceType() {
89 public void setResourceType(ResourceTypeEnum resourceType) {
90 this.resourceType = resourceType;
93 public Boolean isAbstract() {
97 public void setAbstract(Boolean isAbstract) {
98 this.isAbstract = isAbstract;
101 public String getCost() {
105 public void setCost(String cost) {
109 public String getLicenseType() {
113 public void setLicenseType(String licenseType) {
114 this.licenseType = licenseType;
117 public String getToscaResourceName() {
118 return toscaResourceName;
121 public void setToscaResourceName(String toscaResourceName) {
122 this.toscaResourceName = toscaResourceName;
126 public String toString() {
127 return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease
128 + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType +
129 ", isAbstract=" + isAbstract + super.toString() + "]";
133 public int hashCode() {
134 final int prime = 31;
135 int result = super.hashCode();
136 result = prime * result + ((cost == null) ? 0 : cost.hashCode());
137 result = prime * result + ((isAbstract == null) ? 0 : isAbstract.hashCode());
138 result = prime * result + ((licenseType == null) ? 0 : licenseType.hashCode());
139 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
140 result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode());
141 result = prime * result + ((vendorRelease == null) ? 0 : vendorRelease.hashCode());
142 result = prime * result + ((resourceVendorModelNumber == null)? 0 : resourceVendorModelNumber.hashCode());
147 public boolean equals(Object obj) {
150 if (!super.equals(obj))
152 if (getClass() != obj.getClass())
154 ResourceMetadataDataDefinition other = (ResourceMetadataDataDefinition) obj;
156 if (other.cost != null)
158 } else if (!cost.equals(other.cost))
160 if (isAbstract == null) {
161 if (other.isAbstract != null)
163 } else if (!isAbstract.equals(other.isAbstract))
165 if (licenseType == null) {
166 if (other.licenseType != null)
168 } else if (!licenseType.equals(other.licenseType))
170 if (resourceType != other.resourceType)
172 if (vendorName == null) {
173 if (other.vendorName != null)
175 } else if (!vendorName.equals(other.vendorName))
177 if (vendorRelease == null) {
178 if (other.vendorRelease != null)
181 if (toscaResourceName == null) {
182 if (other.toscaResourceName != null)
184 } else if (!vendorRelease.equals(other.vendorRelease))
186 if (resourceVendorModelNumber == null) {
187 if (other.resourceVendorModelNumber != null)
189 } else if (!resourceVendorModelNumber.equals(other.resourceVendorModelNumber))
192 return super.equals(obj);
196 public String getActualComponentType() {
197 return getResourceType().getValue();