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