Added oparent to sdc main
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-license-lib / openecomp-sdc-vendor-license-api / src / main / java / org / openecomp / sdc / vendorlicense / dao / types / LimitEntity.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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 package org.openecomp.sdc.vendorlicense.dao.types;
21
22 import org.openecomp.sdc.versioning.dao.types.Version;
23 import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
24
25 import java.util.Objects;
26
27 public class LimitEntity implements VersionableEntity {
28   private static final String ENTITY_TYPE = "Limit";
29
30   private String id;
31   private String vendorLicenseModelId;
32   private String epLkgId;
33   private String name;
34   private LimitType type;
35   private String description;
36   private String metric;
37   private Version version;
38   private String value;
39   private String unit;
40   private AggregationFunction aggregationFunction;
41   private String time;
42   //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
43   // Xmls
44   private String parent;
45
46   public LimitEntity() {
47   }
48
49   public LimitEntity(String vlmId, Version version, String epLkgId, String id) {
50     this.vendorLicenseModelId = vlmId;
51     this.version = version;
52     this.epLkgId = epLkgId;
53     this.id = id;
54   }
55
56   public String getUnit() {
57     return unit;
58   }
59
60   public void setUnit(String unit) {
61     this.unit = unit;
62   }
63
64   public AggregationFunction getAggregationFunction() {
65     return aggregationFunction;
66   }
67
68   public void setAggregationFunction(
69       AggregationFunction aggregationFunction) {
70     this.aggregationFunction = aggregationFunction;
71   }
72
73   public String getTime() {
74     return time;
75   }
76
77   public void setTime(String time) {
78     this.time = time;
79   }
80
81
82   @Override
83   public String getEntityType() {
84     return ENTITY_TYPE;
85   }
86
87   @Override
88   public String getFirstClassCitizenId() {
89     return getVendorLicenseModelId();
90   }
91
92   @Override
93   public String getId() {
94     return id;
95   }
96
97   @Override
98   public void setId(String id) {
99     this.id = id;
100   }
101
102   @Override
103   public Version getVersion() {
104     return version;
105   }
106
107   public String getEpLkgId() {
108     return epLkgId;
109   }
110
111   public void setEpLkgId(String epLkgId) {
112     this.epLkgId = epLkgId;
113   }
114
115   @Override
116   public void setVersion(Version version) {
117     this.version = version;
118   }
119
120   public String getVendorLicenseModelId() {
121     return vendorLicenseModelId;
122   }
123
124   public void setVendorLicenseModelId(String vendorLicenseModelId) {
125     this.vendorLicenseModelId = vendorLicenseModelId;
126   }
127
128   public LimitType getType() {
129     return type;
130   }
131
132   public void setType(LimitType type) {
133     this.type = type;
134   }
135
136   public String getName() {
137     return name;
138   }
139
140   public void setName(String name) {
141     this.name = name;
142   }
143
144   public String getMetric() {
145     return metric;
146   }
147
148   public void setMetric(String metric) {
149     this.metric = metric;
150   }
151
152   public String getDescription() {
153     return description;
154   }
155
156   public void setDescription(String description) {
157     this.description = description;
158   }
159
160   public String getValue() {
161     return value;
162   }
163
164   public void setValue(String value) {
165     this.value = value;
166   }
167
168   //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
169   // Xmls
170   public String getParent() {
171     return parent;
172   }
173
174   public void setParent(String parent) {
175     this.parent = parent;
176   }
177
178   @Override
179   public int hashCode() {
180     return Objects.hash(vendorLicenseModelId, version, epLkgId, id, name, description, type,
181         metric, unit, time, aggregationFunction, value);
182   }
183
184   @Override
185   public boolean equals(Object obj) {
186     if (this == obj) {
187       return true;
188     }
189     if (obj == null || getClass() != obj.getClass()) {
190       return false;
191     }
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);
203
204   }
205
206   @Override
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 + '\''
215         + ", type=" + type
216         + ", metric=" + metric
217         + ", value='" + value + '\''
218         + ", unit='" + unit + '\''
219         + ", aggregationFunction=" + aggregationFunction
220         + ", time=" + time
221
222         + '}';
223   }
224
225 }