2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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=========================================================
20 package org.openecomp.sdc.vendorlicense.dao.types;
22 import org.openecomp.sdc.versioning.dao.types.Version;
23 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
25 import java.util.Objects;
27 public class LimitEntity implements VersionableEntity {
28 private static final String ENTITY_TYPE = "Limit";
31 private String vendorLicenseModelId;
32 private String epLkgId;
34 private LimitType type;
35 private String description;
36 private String metric;
37 private Version version;
40 private AggregationFunction aggregationFunction;
42 //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
44 private String parent;
46 public LimitEntity() {
49 public LimitEntity(String vlmId, Version version, String epLkgId, String id) {
50 this.vendorLicenseModelId = vlmId;
51 this.version = version;
52 this.epLkgId = epLkgId;
56 public String getUnit() {
60 public void setUnit(String unit) {
64 public AggregationFunction getAggregationFunction() {
65 return aggregationFunction;
68 public void setAggregationFunction(
69 AggregationFunction aggregationFunction) {
70 this.aggregationFunction = aggregationFunction;
73 public String getTime() {
77 public void setTime(String time) {
83 public String getEntityType() {
88 public String getFirstClassCitizenId() {
89 return getVendorLicenseModelId();
93 public String getId() {
98 public void setId(String id) {
103 public Version getVersion() {
107 public String getEpLkgId() {
111 public void setEpLkgId(String epLkgId) {
112 this.epLkgId = epLkgId;
116 public void setVersion(Version version) {
117 this.version = version;
120 public String getVendorLicenseModelId() {
121 return vendorLicenseModelId;
124 public void setVendorLicenseModelId(String vendorLicenseModelId) {
125 this.vendorLicenseModelId = vendorLicenseModelId;
128 public LimitType getType() {
132 public void setType(LimitType type) {
136 public String getName() {
140 public void setName(String name) {
144 public String getMetric() {
148 public void setMetric(String metric) {
149 this.metric = metric;
152 public String getDescription() {
156 public void setDescription(String description) {
157 this.description = description;
160 public String getValue() {
164 public void setValue(String value) {
168 //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
170 public String getParent() {
174 public void setParent(String parent) {
175 this.parent = parent;
179 public int hashCode() {
180 return Objects.hash(vendorLicenseModelId, version, epLkgId, id, name, description, type,
181 metric, unit, time, aggregationFunction, value);
185 public boolean equals(Object obj) {
189 if (obj == null || getClass() != obj.getClass()) {
192 LimitEntity that = (LimitEntity) obj;
193 return Objects.equals(that.unit, unit)
194 && Objects.equals(that.value, value)
195 && Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
196 && Objects.equals(epLkgId, that.epLkgId)
197 && Objects.equals(id, that.id)
198 && Objects.equals(name, that.name)
199 && Objects.equals(description, that.description)
200 && Objects.equals(type, that.type)
201 && Objects.equals(metric, that.metric)
202 && Objects.equals(aggregationFunction, that.aggregationFunction);
207 public String toString() {
208 return "LimitEntity{"
209 + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
210 + ", version=" + version
211 + ", epLkgId=" + epLkgId
212 + ", id='" + id + '\''
213 + ", name='" + name + '\''
214 + ", description='" + description + '\''
216 + ", metric=" + metric
217 + ", value='" + value + '\''
218 + ", unit='" + unit + '\''
219 + ", aggregationFunction=" + aggregationFunction