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 java.util.Objects;
23 import org.openecomp.sdc.versioning.dao.types.Version;
24 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
26 public class LimitEntity implements VersionableEntity {
28 private static final String ENTITY_TYPE = "Limit";
30 private String vendorLicenseModelId;
31 private String epLkgId;
33 private LimitType type;
34 private String description;
35 private String metric;
36 private Version version;
39 private AggregationFunction aggregationFunction;
41 //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(AggregationFunction aggregationFunction) {
69 this.aggregationFunction = aggregationFunction;
72 public String getTime() {
76 public void setTime(String time) {
81 public String getEntityType() {
86 public String getFirstClassCitizenId() {
87 return getVendorLicenseModelId();
91 public String getId() {
96 public void setId(String id) {
101 public Version getVersion() {
106 public void setVersion(Version version) {
107 this.version = version;
110 public String getEpLkgId() {
114 public void setEpLkgId(String epLkgId) {
115 this.epLkgId = epLkgId;
118 public String getVendorLicenseModelId() {
119 return vendorLicenseModelId;
122 public void setVendorLicenseModelId(String vendorLicenseModelId) {
123 this.vendorLicenseModelId = vendorLicenseModelId;
126 public LimitType getType() {
130 public void setType(LimitType type) {
134 public String getName() {
138 public void setName(String name) {
142 public String getMetric() {
146 public void setMetric(String metric) {
147 this.metric = metric;
150 public String getDescription() {
154 public void setDescription(String description) {
155 this.description = description;
158 public String getValue() {
162 public void setValue(String value) {
165 //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
168 public String getParent() {
172 public void setParent(String parent) {
173 this.parent = parent;
177 public int hashCode() {
178 return Objects.hash(vendorLicenseModelId, version, epLkgId, id, name, description, type, metric, unit, time, aggregationFunction, value);
182 public boolean equals(Object obj) {
186 if (obj == null || getClass() != obj.getClass()) {
189 LimitEntity that = (LimitEntity) obj;
190 return Objects.equals(that.unit, unit) && Objects.equals(that.value, value) && Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
191 && Objects.equals(epLkgId, that.epLkgId) && Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects
192 .equals(description, that.description) && Objects.equals(type, that.type) && Objects.equals(metric, that.metric) && Objects
193 .equals(aggregationFunction, that.aggregationFunction);
197 public String toString() {
198 return "LimitEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + ", version=" + version + ", epLkgId=" + epLkgId + ", id='"
199 + id + '\'' + ", name='" + name + '\'' + ", description='" + description + '\'' + ", type=" + type + ", metric=" + metric + ", value='"
200 + value + '\'' + ", unit='" + unit + '\'' + ", aggregationFunction=" + aggregationFunction + ", time=" + time + '}';