1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
5 //
6 package fr.ifremer.quadrige2.core.dao.referential;
7
8 /*-
9 * #%L
10 * Quadrige2 Core :: Server API
11 * %%
12 * Copyright (C) 2017 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
27 */
28
29 import fr.ifremer.quadrige2.core.dao.referential.monitoringLocation.ProjectionSystem;
30 import fr.ifremer.quadrige2.core.dao.referential.pmfm.Pmfm;
31 import java.io.Serializable;
32 import java.sql.Timestamp;
33 import java.util.Collection;
34 import java.util.Date;
35 import java.util.HashSet;
36
37 /**
38 * Liste l'ensemble des unités de mesure.
39 */
40 // HibernateEntity.vsl annotations merge-point
41 public abstract class Unit
42 implements Serializable, Comparable<Unit>
43 {
44 /**
45 * The serial version UID of this class. Needed for serialization.
46 */
47 private static final long serialVersionUID = -4718773931997930290L;
48
49 // Generate 5 attributes
50 private Integer unitId;
51
52 /**
53 * Identifiant interne de l'unité
54 * @return this.unitId Integer
55 */
56 public Integer getUnitId()
57 {
58 return this.unitId;
59 }
60
61 /**
62 * Identifiant interne de l'unité
63 * @param unitIdIn Integer
64 */
65 public void setUnitId(Integer unitIdIn)
66 {
67 this.unitId = unitIdIn;
68 }
69
70 private String unitNm;
71
72 /**
73 * Libellé de l'unité (kilogramme, ...)
74 * @return this.unitNm String
75 */
76 public String getUnitNm()
77 {
78 return this.unitNm;
79 }
80
81 /**
82 * Libellé de l'unité (kilogramme, ...)
83 * @param unitNmIn String
84 */
85 public void setUnitNm(String unitNmIn)
86 {
87 this.unitNm = unitNmIn;
88 }
89
90 private String unitSymbol;
91
92 /**
93 * Symbole de l'unité (kg, cm, ...)
94 * @return this.unitSymbol String
95 */
96 public String getUnitSymbol()
97 {
98 return this.unitSymbol;
99 }
100
101 /**
102 * Symbole de l'unité (kg, cm, ...)
103 * @param unitSymbolIn String
104 */
105 public void setUnitSymbol(String unitSymbolIn)
106 {
107 this.unitSymbol = unitSymbolIn;
108 }
109
110 private Date unitCreationDt;
111
112 /**
113 * Date de création de l'unité
114 * @return this.unitCreationDt Date
115 */
116 public Date getUnitCreationDt()
117 {
118 return this.unitCreationDt;
119 }
120
121 /**
122 * Date de création de l'unité
123 * @param unitCreationDtIn Date
124 */
125 public void setUnitCreationDt(Date unitCreationDtIn)
126 {
127 this.unitCreationDt = unitCreationDtIn;
128 }
129
130 private Timestamp updateDt;
131
132 /**
133 * Date de maj de l'unité
134 * @return this.updateDt Timestamp
135 */
136 public Timestamp getUpdateDt()
137 {
138 return this.updateDt;
139 }
140
141 /**
142 * Date de maj de l'unité
143 * @param updateDtIn Timestamp
144 */
145 public void setUpdateDt(Timestamp updateDtIn)
146 {
147 this.updateDt = updateDtIn;
148 }
149
150 // Generate 10 associations
151 private Collection<Pmfm> pmfms = new HashSet<Pmfm>();
152
153 /**
154 * Liste les quadruplets paramètre, méthode, support, fraction.
155 * @return this.pmfms Collection<Pmfm>
156 */
157 public Collection<Pmfm> getPmfms()
158 {
159 return this.pmfms;
160 }
161
162 /**
163 * Liste les quadruplets paramètre, méthode, support, fraction.
164 * @param pmfmsIn Collection<Pmfm>
165 */
166 public void setPmfms(Collection<Pmfm> pmfmsIn)
167 {
168 this.pmfms = pmfmsIn;
169 }
170
171 /**
172 * Liste les quadruplets paramètre, méthode, support, fraction.
173 * @param elementToAdd Pmfm
174 * @return <tt>true</tt> if this collection changed as a result of the
175 * call
176 */
177 public boolean addPmfms(Pmfm elementToAdd)
178 {
179 return this.pmfms.add(elementToAdd);
180 }
181
182 /**
183 * Liste les quadruplets paramètre, méthode, support, fraction.
184 * @param elementToRemove Pmfm
185 * @return <tt>true</tt> if this collection changed as a result of the
186 * call
187 */
188 public boolean removePmfms(Pmfm elementToRemove)
189 {
190 return this.pmfms.remove(elementToRemove);
191 }
192
193 private Status status;
194
195 /**
196 * Liste des états possibles d'un objet.
197 * @return this.status Status
198 */
199 public Status getStatus()
200 {
201 return this.status;
202 }
203
204 /**
205 * Liste des états possibles d'un objet.
206 * @param statusIn Status
207 */
208 public void setStatus(Status statusIn)
209 {
210 this.status = statusIn;
211 }
212
213 private Collection<SamplingEquipment> samplingEquipmentIds = new HashSet<SamplingEquipment>();
214
215 /**
216 * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
217 * @return this.samplingEquipmentIds Collection<SamplingEquipment>
218 */
219 public Collection<SamplingEquipment> getSamplingEquipmentIds()
220 {
221 return this.samplingEquipmentIds;
222 }
223
224 /**
225 * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
226 * @param samplingEquipmentIdsIn Collection<SamplingEquipment>
227 */
228 public void setSamplingEquipmentIds(Collection<SamplingEquipment> samplingEquipmentIdsIn)
229 {
230 this.samplingEquipmentIds = samplingEquipmentIdsIn;
231 }
232
233 /**
234 * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
235 * @param elementToAdd SamplingEquipment
236 * @return <tt>true</tt> if this collection changed as a result of the
237 * call
238 */
239 public boolean addSamplingEquipmentIds(SamplingEquipment elementToAdd)
240 {
241 return this.samplingEquipmentIds.add(elementToAdd);
242 }
243
244 /**
245 * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
246 * @param elementToRemove SamplingEquipment
247 * @return <tt>true</tt> if this collection changed as a result of the
248 * call
249 */
250 public boolean removeSamplingEquipmentIds(SamplingEquipment elementToRemove)
251 {
252 return this.samplingEquipmentIds.remove(elementToRemove);
253 }
254
255 private Collection<ProjectionSystem> projSystemCds = new HashSet<ProjectionSystem>();
256
257 /**
258 * Système de projection utilisé pour une transformation de coordonnées
259 * @return this.projSystemCds Collection<ProjectionSystem>
260 */
261 public Collection<ProjectionSystem> getProjSystemCds()
262 {
263 return this.projSystemCds;
264 }
265
266 /**
267 * Système de projection utilisé pour une transformation de coordonnées
268 * @param projSystemCdsIn Collection<ProjectionSystem>
269 */
270 public void setProjSystemCds(Collection<ProjectionSystem> projSystemCdsIn)
271 {
272 this.projSystemCds = projSystemCdsIn;
273 }
274
275 /**
276 * Système de projection utilisé pour une transformation de coordonnées
277 * @param elementToAdd ProjectionSystem
278 * @return <tt>true</tt> if this collection changed as a result of the
279 * call
280 */
281 public boolean addProjSystemCds(ProjectionSystem elementToAdd)
282 {
283 return this.projSystemCds.add(elementToAdd);
284 }
285
286 /**
287 * Système de projection utilisé pour une transformation de coordonnées
288 * @param elementToRemove ProjectionSystem
289 * @return <tt>true</tt> if this collection changed as a result of the
290 * call
291 */
292 public boolean removeProjSystemCds(ProjectionSystem elementToRemove)
293 {
294 return this.projSystemCds.remove(elementToRemove);
295 }
296
297 /**
298 * Returns <code>true</code> if the argument is an Unit instance and all identifiers for this entity
299 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
300 */
301 @Override
302 public boolean equals(Object object)
303 {
304 if (this == object)
305 {
306 return true;
307 }
308 if (!(object instanceof Unit))
309 {
310 return false;
311 }
312 final Unit that = (Unit)object;
313 if (this.unitId == null || that.getUnitId() == null || !this.unitId.equals(that.getUnitId()))
314 {
315 return false;
316 }
317 return true;
318 }
319
320 /**
321 * Returns a hash code based on this entity's identifiers.
322 */
323 @Override
324 public int hashCode()
325 {
326 int hashCode = 0;
327 hashCode = 29 * hashCode + (this.unitId == null ? 0 : this.unitId.hashCode());
328
329 return hashCode;
330 }
331
332 /**
333 * Constructs new instances of {@link Unit}.
334 */
335 public static final class Factory
336 {
337 /**
338 * Constructs a new instance of {@link Unit}.
339 * @return new UnitImpl()
340 */
341 public static Unit newInstance()
342 {
343 return new UnitImpl();
344 }
345
346 /**
347 * Constructs a new instance of {@link Unit}, taking all required and/or
348 * read-only properties as arguments, except for identifiers.
349 * @param unitNm String
350 * @param updateDt Timestamp
351 * @param status Status
352 * @return newInstance
353 */
354 public static Unit newInstance(String unitNm, Timestamp updateDt, Status status)
355 {
356 final Unit entity = new UnitImpl();
357 entity.setUnitNm(unitNm);
358 entity.setUpdateDt(updateDt);
359 entity.setStatus(status);
360 return entity;
361 }
362
363 /**
364 * Constructs a new instance of {@link Unit}, taking all possible properties
365 * (except the identifier(s))as arguments.
366 * @param unitNm String
367 * @param unitSymbol String
368 * @param unitCreationDt Date
369 * @param updateDt Timestamp
370 * @param pmfms Collection<Pmfm>
371 * @param status Status
372 * @param samplingEquipmentIds Collection<SamplingEquipment>
373 * @param projSystemCds Collection<ProjectionSystem>
374 * @return newInstance Unit
375 */
376 public static Unit newInstance(String unitNm, String unitSymbol, Date unitCreationDt, Timestamp updateDt, Collection<Pmfm> pmfms, Status status, Collection<SamplingEquipment> samplingEquipmentIds, Collection<ProjectionSystem> projSystemCds)
377 {
378 final Unit entity = new UnitImpl();
379 entity.setUnitNm(unitNm);
380 entity.setUnitSymbol(unitSymbol);
381 entity.setUnitCreationDt(unitCreationDt);
382 entity.setUpdateDt(updateDt);
383 entity.setPmfms(pmfms);
384 entity.setStatus(status);
385 entity.setSamplingEquipmentIds(samplingEquipmentIds);
386 entity.setProjSystemCds(projSystemCds);
387 return entity;
388 }
389 }
390
391 /**
392 * @see Comparable#compareTo
393 */
394 public int compareTo(Unit o)
395 {
396 int cmp = 0;
397 if (this.getUnitId() != null)
398 {
399 cmp = this.getUnitId().compareTo(o.getUnitId());
400 }
401 else
402 {
403 if (this.getUnitNm() != null)
404 {
405 cmp = (cmp != 0 ? cmp : this.getUnitNm().compareTo(o.getUnitNm()));
406 }
407 if (this.getUnitSymbol() != null)
408 {
409 cmp = (cmp != 0 ? cmp : this.getUnitSymbol().compareTo(o.getUnitSymbol()));
410 }
411 if (this.getUnitCreationDt() != null)
412 {
413 cmp = (cmp != 0 ? cmp : this.getUnitCreationDt().compareTo(o.getUnitCreationDt()));
414 }
415 if (this.getUpdateDt() != null)
416 {
417 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
418 }
419 }
420 return cmp;
421 }
422 // HibernateEntity.vsl merge-point
423 // Unit.java merge-point
424 }