2eb5e23352bfd2feaf0aeb0a9d93c44c552391fe
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.be.datatypes.components;
22
23 import java.io.Serializable;
24
25 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
26
27 public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
28
29         /**
30          * 
31          */
32         private static final long serialVersionUID = 1142973528643758481L;
33
34         private String vendorName;
35         private String vendorRelease;
36         private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC
37                                                                                                                                         // is
38                                                                                                                                         // default
39         private Boolean isAbstract;
40         private String cost;
41         private String licenseType;
42         private String toscaResourceName;
43
44         public ResourceMetadataDataDefinition() {
45                 super();
46         }
47
48         public ResourceMetadataDataDefinition(ResourceMetadataDataDefinition other) {
49                 super(other);
50                 this.vendorName = other.getVendorName();
51                 this.vendorRelease = other.getVendorRelease();
52                 this.isAbstract = other.isHighestVersion();
53                 this.resourceType = other.getResourceType();
54                 this.toscaResourceName = other.getToscaResourceName();
55         }
56
57         public String getVendorName() {
58                 return vendorName;
59         }
60
61         public void setVendorName(String vendorName) {
62                 this.vendorName = vendorName;
63         }
64
65         public String getVendorRelease() {
66                 return vendorRelease;
67         }
68
69         public void setVendorRelease(String vendorRelease) {
70                 this.vendorRelease = vendorRelease;
71         }
72
73         public ResourceTypeEnum getResourceType() {
74                 return resourceType;
75         }
76
77         public void setResourceType(ResourceTypeEnum resourceType) {
78                 this.resourceType = resourceType;
79         }
80
81         public Boolean isAbstract() {
82                 return isAbstract;
83         }
84
85         public void setAbstract(Boolean isAbstract) {
86                 this.isAbstract = isAbstract;
87         }
88
89         public String getCost() {
90                 return cost;
91         }
92
93         public void setCost(String cost) {
94                 this.cost = cost;
95         }
96
97         public String getLicenseType() {
98                 return licenseType;
99         }
100
101         public void setLicenseType(String licenseType) {
102                 this.licenseType = licenseType;
103         }
104
105         public String getToscaResourceName() {
106                 return toscaResourceName;
107         }
108
109         public void setToscaResourceName(String toscaResourceName) {
110                 this.toscaResourceName = toscaResourceName;
111         }
112
113         @Override
114         public String toString() {
115                 return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease
116                                 + ", resourceType=" + resourceType + ", isAbstract=" + isAbstract + super.toString() + "]";
117         }
118
119         @Override
120         public int hashCode() {
121                 final int prime = 31;
122                 int result = super.hashCode();
123                 result = prime * result + ((cost == null) ? 0 : cost.hashCode());
124                 result = prime * result + ((isAbstract == null) ? 0 : isAbstract.hashCode());
125                 result = prime * result + ((licenseType == null) ? 0 : licenseType.hashCode());
126                 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
127                 result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode());
128                 result = prime * result + ((vendorRelease == null) ? 0 : vendorRelease.hashCode());
129                 return result;
130         }
131
132         @Override
133         public boolean equals(Object obj) {
134                 if (this == obj)
135                         return true;
136                 if (!super.equals(obj))
137                         return false;
138                 if (getClass() != obj.getClass())
139                         return false;
140                 ResourceMetadataDataDefinition other = (ResourceMetadataDataDefinition) obj;
141                 if (cost == null) {
142                         if (other.cost != null)
143                                 return false;
144                 } else if (!cost.equals(other.cost))
145                         return false;
146                 if (isAbstract == null) {
147                         if (other.isAbstract != null)
148                                 return false;
149                 } else if (!isAbstract.equals(other.isAbstract))
150                         return false;
151                 if (licenseType == null) {
152                         if (other.licenseType != null)
153                                 return false;
154                 } else if (!licenseType.equals(other.licenseType))
155                         return false;
156                 if (resourceType != other.resourceType)
157                         return false;
158                 if (vendorName == null) {
159                         if (other.vendorName != null)
160                                 return false;
161                 } else if (!vendorName.equals(other.vendorName))
162                         return false;
163                 if (vendorRelease == null) {
164                         if (other.vendorRelease != null)
165                                 return false;
166                 }
167                 if (toscaResourceName == null) {
168                         if (other.toscaResourceName != null)
169                                 return false;
170                 } else if (!vendorRelease.equals(other.vendorRelease))
171                         return false;
172
173                 return super.equals(obj);
174         }
175
176 }