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.quadrige3.core.dao.data.event;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 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 import fr.ifremer.quadrige3.core.dao.administration.user.Department;
29 import fr.ifremer.quadrige3.core.dao.data.survey.Survey;
30 import fr.ifremer.quadrige3.core.dao.referential.EventType;
31 import fr.ifremer.quadrige3.core.dao.referential.monitoringLocation.PositionningSystem;
32 import fr.ifremer.quadrige3.core.dao.system.EventArea;
33 import fr.ifremer.quadrige3.core.dao.system.EventLine;
34 import fr.ifremer.quadrige3.core.dao.system.EventPoint;
35 import java.io.Serializable;
36 import java.sql.Timestamp;
37 import java.util.Collection;
38 import java.util.Date;
39 import java.util.HashSet;
40
41 /**
42 * Liste les événements qui peuvent avoir ou non un rapport avec un passage.
43 */
44 // HibernateEntity.vsl annotations merge-point
45 public abstract class Event
46 implements Serializable, Comparable<Event>
47 {
48 /**
49 * The serial version UID of this class. Needed for serialization.
50 */
51 private static final long serialVersionUID = 909796630594870265L;
52
53 // Generate 9 attributes
54 private Integer eventId;
55
56 /**
57 * Identifiant interne de l'évènement
58 * @return this.eventId Integer
59 */
60 public Integer getEventId()
61 {
62 return this.eventId;
63 }
64
65 /**
66 * Identifiant interne de l'évènement
67 * @param eventIdIn Integer
68 */
69 public void setEventId(Integer eventIdIn)
70 {
71 this.eventId = eventIdIn;
72 }
73
74 private String eventDc;
75
76 /**
77 * Description de l'évènement
78 * @return this.eventDc String
79 */
80 public String getEventDc()
81 {
82 return this.eventDc;
83 }
84
85 /**
86 * Description de l'évènement
87 * @param eventDcIn String
88 */
89 public void setEventDc(String eventDcIn)
90 {
91 this.eventDc = eventDcIn;
92 }
93
94 private String eventCm;
95
96 /**
97 * Commentaire sur l'évènement
98 * @return this.eventCm String
99 */
100 public String getEventCm()
101 {
102 return this.eventCm;
103 }
104
105 /**
106 * Commentaire sur l'évènement
107 * @param eventCmIn String
108 */
109 public void setEventCm(String eventCmIn)
110 {
111 this.eventCm = eventCmIn;
112 }
113
114 private Date eventStartDt;
115
116 /**
117 * Date de début de l'évèvnement
118 * @return this.eventStartDt Date
119 */
120 public Date getEventStartDt()
121 {
122 return this.eventStartDt;
123 }
124
125 /**
126 * Date de début de l'évèvnement
127 * @param eventStartDtIn Date
128 */
129 public void setEventStartDt(Date eventStartDtIn)
130 {
131 this.eventStartDt = eventStartDtIn;
132 }
133
134 private Date eventEndDt;
135
136 /**
137 * Date de fin de l'évènement.
138 * @return this.eventEndDt Date
139 */
140 public Date getEventEndDt()
141 {
142 return this.eventEndDt;
143 }
144
145 /**
146 * Date de fin de l'évènement.
147 * @param eventEndDtIn Date
148 */
149 public void setEventEndDt(Date eventEndDtIn)
150 {
151 this.eventEndDt = eventEndDtIn;
152 }
153
154 private String eventPositionCm;
155
156 /**
157 * Commentaire sur la localisation
158 * @return this.eventPositionCm String
159 */
160 public String getEventPositionCm()
161 {
162 return this.eventPositionCm;
163 }
164
165 /**
166 * Commentaire sur la localisation
167 * @param eventPositionCmIn String
168 */
169 public void setEventPositionCm(String eventPositionCmIn)
170 {
171 this.eventPositionCm = eventPositionCmIn;
172 }
173
174 private Date eventCreationDt;
175
176 /**
177 * Date de création de l'objet, mise à jour par le système
178 * @return this.eventCreationDt Date
179 */
180 public Date getEventCreationDt()
181 {
182 return this.eventCreationDt;
183 }
184
185 /**
186 * Date de création de l'objet, mise à jour par le système
187 * @param eventCreationDtIn Date
188 */
189 public void setEventCreationDt(Date eventCreationDtIn)
190 {
191 this.eventCreationDt = eventCreationDtIn;
192 }
193
194 private Timestamp updateDt;
195
196 /**
197 * Date de modification de l'objet, mise à jour par le système
198 * @return this.updateDt Timestamp
199 */
200 public Timestamp getUpdateDt()
201 {
202 return this.updateDt;
203 }
204
205 /**
206 * Date de modification de l'objet, mise à jour par le système
207 * @param updateDtIn Timestamp
208 */
209 public void setUpdateDt(Timestamp updateDtIn)
210 {
211 this.updateDt = updateDtIn;
212 }
213
214 private Integer remoteId;
215
216 /**
217 *
218 * @return this.remoteId Integer
219 */
220 public Integer getRemoteId()
221 {
222 return this.remoteId;
223 }
224
225 /**
226 *
227 * @param remoteIdIn Integer
228 */
229 public void setRemoteId(Integer remoteIdIn)
230 {
231 this.remoteId = remoteIdIn;
232 }
233
234 // Generate 7 associations
235 private EventType eventType;
236
237 /**
238 * Liste des types d'évènement observables.
239 * @return this.eventType EventType
240 */
241 public EventType getEventType()
242 {
243 return this.eventType;
244 }
245
246 /**
247 * Liste des types d'évènement observables.
248 * @param eventTypeIn EventType
249 */
250 public void setEventType(EventType eventTypeIn)
251 {
252 this.eventType = eventTypeIn;
253 }
254
255 private Collection<EventLine> eventLines = new HashSet<EventLine>();
256
257 /**
258 * Gestion de la géométrie linéaire des évènements.
259 * @return this.eventLines Collection<EventLine>
260 */
261 public Collection<EventLine> getEventLines()
262 {
263 return this.eventLines;
264 }
265
266 /**
267 * Gestion de la géométrie linéaire des évènements.
268 * @param eventLinesIn Collection<EventLine>
269 */
270 public void setEventLines(Collection<EventLine> eventLinesIn)
271 {
272 this.eventLines = eventLinesIn;
273 }
274
275 /**
276 * Gestion de la géométrie linéaire des évènements.
277 * @param elementToAdd EventLine
278 * @return <tt>true</tt> if this collection changed as a result of the
279 * call
280 */
281 public boolean addEventLines(EventLine elementToAdd)
282 {
283 return this.eventLines.add(elementToAdd);
284 }
285
286 /**
287 * Gestion de la géométrie linéaire des évènements.
288 * @param elementToRemove EventLine
289 * @return <tt>true</tt> if this collection changed as a result of the
290 * call
291 */
292 public boolean removeEventLines(EventLine elementToRemove)
293 {
294 return this.eventLines.remove(elementToRemove);
295 }
296
297 private Collection<EventPoint> eventPoints = new HashSet<EventPoint>();
298
299 /**
300 * Gestion de la géométrie ponctuelle des évènements.
301 * @return this.eventPoints Collection<EventPoint>
302 */
303 public Collection<EventPoint> getEventPoints()
304 {
305 return this.eventPoints;
306 }
307
308 /**
309 * Gestion de la géométrie ponctuelle des évènements.
310 * @param eventPointsIn Collection<EventPoint>
311 */
312 public void setEventPoints(Collection<EventPoint> eventPointsIn)
313 {
314 this.eventPoints = eventPointsIn;
315 }
316
317 /**
318 * Gestion de la géométrie ponctuelle des évènements.
319 * @param elementToAdd EventPoint
320 * @return <tt>true</tt> if this collection changed as a result of the
321 * call
322 */
323 public boolean addEventPoints(EventPoint elementToAdd)
324 {
325 return this.eventPoints.add(elementToAdd);
326 }
327
328 /**
329 * Gestion de la géométrie ponctuelle des évènements.
330 * @param elementToRemove EventPoint
331 * @return <tt>true</tt> if this collection changed as a result of the
332 * call
333 */
334 public boolean removeEventPoints(EventPoint elementToRemove)
335 {
336 return this.eventPoints.remove(elementToRemove);
337 }
338
339 private PositionningSystem positionningSystem;
340
341 /**
342 * Informations complémentaires sur le positionnement d'un objet.
343 * @return this.positionningSystem PositionningSystem
344 */
345 public PositionningSystem getPositionningSystem()
346 {
347 return this.positionningSystem;
348 }
349
350 /**
351 * Informations complémentaires sur le positionnement d'un objet.
352 * @param positionningSystemIn PositionningSystem
353 */
354 public void setPositionningSystem(PositionningSystem positionningSystemIn)
355 {
356 this.positionningSystem = positionningSystemIn;
357 }
358
359 private Department recorderDepartment;
360
361 /**
362 * Liste les départements ou services auxquels sont rattachés les agents
363 * @return this.recorderDepartment Department
364 */
365 public Department getRecorderDepartment()
366 {
367 return this.recorderDepartment;
368 }
369
370 /**
371 * Liste les départements ou services auxquels sont rattachés les agents
372 * @param recorderDepartmentIn Department
373 */
374 public void setRecorderDepartment(Department recorderDepartmentIn)
375 {
376 this.recorderDepartment = recorderDepartmentIn;
377 }
378
379 private Collection<Survey> surveys = new HashSet<Survey>();
380
381 /**
382 * Liste les différents passages effectués sur un lieu de surveillance.
383 * Liste les différents passages effectués sur un lieu de surveillance.
384 * @return this.surveys Collection<Survey>
385 */
386 public Collection<Survey> getSurveys()
387 {
388 return this.surveys;
389 }
390
391 /**
392 * Liste les différents passages effectués sur un lieu de surveillance.
393 * Liste les différents passages effectués sur un lieu de surveillance.
394 * @param surveysIn Collection<Survey>
395 */
396 public void setSurveys(Collection<Survey> surveysIn)
397 {
398 this.surveys = surveysIn;
399 }
400
401 /**
402 * Liste les différents passages effectués sur un lieu de surveillance.
403 * Liste les différents passages effectués sur un lieu de surveillance.
404 * @param elementToAdd Survey
405 * @return <tt>true</tt> if this collection changed as a result of the
406 * call
407 */
408 public boolean addSurveys(Survey elementToAdd)
409 {
410 return this.surveys.add(elementToAdd);
411 }
412
413 /**
414 * Liste les différents passages effectués sur un lieu de surveillance.
415 * Liste les différents passages effectués sur un lieu de surveillance.
416 * @param elementToRemove Survey
417 * @return <tt>true</tt> if this collection changed as a result of the
418 * call
419 */
420 public boolean removeSurveys(Survey elementToRemove)
421 {
422 return this.surveys.remove(elementToRemove);
423 }
424
425 private Collection<EventArea> eventAreas = new HashSet<EventArea>();
426
427 /**
428 * Gestion de la géométrie surfacique des évènements.
429 * @return this.eventAreas Collection<EventArea>
430 */
431 public Collection<EventArea> getEventAreas()
432 {
433 return this.eventAreas;
434 }
435
436 /**
437 * Gestion de la géométrie surfacique des évènements.
438 * @param eventAreasIn Collection<EventArea>
439 */
440 public void setEventAreas(Collection<EventArea> eventAreasIn)
441 {
442 this.eventAreas = eventAreasIn;
443 }
444
445 /**
446 * Gestion de la géométrie surfacique des évènements.
447 * @param elementToAdd EventArea
448 * @return <tt>true</tt> if this collection changed as a result of the
449 * call
450 */
451 public boolean addEventAreas(EventArea elementToAdd)
452 {
453 return this.eventAreas.add(elementToAdd);
454 }
455
456 /**
457 * Gestion de la géométrie surfacique des évènements.
458 * @param elementToRemove EventArea
459 * @return <tt>true</tt> if this collection changed as a result of the
460 * call
461 */
462 public boolean removeEventAreas(EventArea elementToRemove)
463 {
464 return this.eventAreas.remove(elementToRemove);
465 }
466
467 /**
468 * Returns <code>true</code> if the argument is an Event instance and all identifiers for this entity
469 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
470 */
471 @Override
472 public boolean equals(Object object)
473 {
474 if (this == object)
475 {
476 return true;
477 }
478 if (!(object instanceof Event))
479 {
480 return false;
481 }
482 final Event that = (Event)object;
483 if (this.eventId == null || that.getEventId() == null || !this.eventId.equals(that.getEventId()))
484 {
485 return false;
486 }
487 return true;
488 }
489
490 /**
491 * Returns a hash code based on this entity's identifiers.
492 */
493 @Override
494 public int hashCode()
495 {
496 int hashCode = 0;
497 hashCode = 29 * hashCode + (this.eventId == null ? 0 : this.eventId.hashCode());
498
499 return hashCode;
500 }
501
502 /**
503 * Constructs new instances of {@link Event}.
504 */
505 public static final class Factory
506 {
507 /**
508 * Constructs a new instance of {@link Event}.
509 * @return new EventImpl()
510 */
511 public static Event newInstance()
512 {
513 return new EventImpl();
514 }
515
516 /**
517 * Constructs a new instance of {@link Event}, taking all required and/or
518 * read-only properties as arguments, except for identifiers.
519 * @param eventDc String
520 * @param eventStartDt Date
521 * @param eventType EventType
522 * @param recorderDepartment Department
523 * @return newInstance
524 */
525 public static Event newInstance(String eventDc, Date eventStartDt, EventType eventType, Department recorderDepartment)
526 {
527 final Event entity = new EventImpl();
528 entity.setEventDc(eventDc);
529 entity.setEventStartDt(eventStartDt);
530 entity.setEventType(eventType);
531 entity.setRecorderDepartment(recorderDepartment);
532 return entity;
533 }
534
535 /**
536 * Constructs a new instance of {@link Event}, taking all possible properties
537 * (except the identifier(s))as arguments.
538 * @param eventDc String
539 * @param eventCm String
540 * @param eventStartDt Date
541 * @param eventEndDt Date
542 * @param eventPositionCm String
543 * @param eventCreationDt Date
544 * @param updateDt Timestamp
545 * @param remoteId Integer
546 * @param eventType EventType
547 * @param eventLines Collection<EventLine>
548 * @param eventPoints Collection<EventPoint>
549 * @param positionningSystem PositionningSystem
550 * @param recorderDepartment Department
551 * @param surveys Collection<Survey>
552 * @param eventAreas Collection<EventArea>
553 * @return newInstance Event
554 */
555 public static Event newInstance(String eventDc, String eventCm, Date eventStartDt, Date eventEndDt, String eventPositionCm, Date eventCreationDt, Timestamp updateDt, Integer remoteId, EventType eventType, Collection<EventLine> eventLines, Collection<EventPoint> eventPoints, PositionningSystem positionningSystem, Department recorderDepartment, Collection<Survey> surveys, Collection<EventArea> eventAreas)
556 {
557 final Event entity = new EventImpl();
558 entity.setEventDc(eventDc);
559 entity.setEventCm(eventCm);
560 entity.setEventStartDt(eventStartDt);
561 entity.setEventEndDt(eventEndDt);
562 entity.setEventPositionCm(eventPositionCm);
563 entity.setEventCreationDt(eventCreationDt);
564 entity.setUpdateDt(updateDt);
565 entity.setRemoteId(remoteId);
566 entity.setEventType(eventType);
567 entity.setEventLines(eventLines);
568 entity.setEventPoints(eventPoints);
569 entity.setPositionningSystem(positionningSystem);
570 entity.setRecorderDepartment(recorderDepartment);
571 entity.setSurveys(surveys);
572 entity.setEventAreas(eventAreas);
573 return entity;
574 }
575 }
576
577 /**
578 * @see Comparable#compareTo
579 */
580 public int compareTo(Event o)
581 {
582 int cmp = 0;
583 if (this.getEventId() != null)
584 {
585 cmp = this.getEventId().compareTo(o.getEventId());
586 }
587 else
588 {
589 if (this.getEventDc() != null)
590 {
591 cmp = (cmp != 0 ? cmp : this.getEventDc().compareTo(o.getEventDc()));
592 }
593 if (this.getEventCm() != null)
594 {
595 cmp = (cmp != 0 ? cmp : this.getEventCm().compareTo(o.getEventCm()));
596 }
597 if (this.getEventStartDt() != null)
598 {
599 cmp = (cmp != 0 ? cmp : this.getEventStartDt().compareTo(o.getEventStartDt()));
600 }
601 if (this.getEventEndDt() != null)
602 {
603 cmp = (cmp != 0 ? cmp : this.getEventEndDt().compareTo(o.getEventEndDt()));
604 }
605 if (this.getEventPositionCm() != null)
606 {
607 cmp = (cmp != 0 ? cmp : this.getEventPositionCm().compareTo(o.getEventPositionCm()));
608 }
609 if (this.getEventCreationDt() != null)
610 {
611 cmp = (cmp != 0 ? cmp : this.getEventCreationDt().compareTo(o.getEventCreationDt()));
612 }
613 if (this.getUpdateDt() != null)
614 {
615 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
616 }
617 if (this.getRemoteId() != null)
618 {
619 cmp = (cmp != 0 ? cmp : this.getRemoteId().compareTo(o.getRemoteId()));
620 }
621 }
622 return cmp;
623 }
624 // HibernateEntity.vsl merge-point
625 // Event.java merge-point
626 }