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