1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.data.event;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 import fr.ifremer.quadrige2.core.dao.administration.user.Department;
30 import fr.ifremer.quadrige2.core.dao.data.survey.Survey;
31 import fr.ifremer.quadrige2.core.dao.referential.EventType;
32 import fr.ifremer.quadrige2.core.dao.referential.monitoringLocation.PositionningSystem;
33 import fr.ifremer.quadrige2.core.dao.system.EventArea;
34 import fr.ifremer.quadrige2.core.dao.system.EventLine;
35 import fr.ifremer.quadrige2.core.dao.system.EventPoint;
36 import java.io.Serializable;
37 import java.sql.Timestamp;
38 import java.util.Collection;
39 import java.util.Date;
40 import java.util.HashSet;
41
42
43
44
45
46 public abstract class Event
47 implements Serializable, Comparable<Event>
48 {
49
50
51
52 private static final long serialVersionUID = -8085508884426184017L;
53
54
55 private Integer eventId;
56
57
58
59
60
61 public Integer getEventId()
62 {
63 return this.eventId;
64 }
65
66
67
68
69
70 public void setEventId(Integer eventIdIn)
71 {
72 this.eventId = eventIdIn;
73 }
74
75 private String eventDc;
76
77
78
79
80
81 public String getEventDc()
82 {
83 return this.eventDc;
84 }
85
86
87
88
89
90 public void setEventDc(String eventDcIn)
91 {
92 this.eventDc = eventDcIn;
93 }
94
95 private String eventCm;
96
97
98
99
100
101 public String getEventCm()
102 {
103 return this.eventCm;
104 }
105
106
107
108
109
110 public void setEventCm(String eventCmIn)
111 {
112 this.eventCm = eventCmIn;
113 }
114
115 private Date eventStartDt;
116
117
118
119
120
121 public Date getEventStartDt()
122 {
123 return this.eventStartDt;
124 }
125
126
127
128
129
130 public void setEventStartDt(Date eventStartDtIn)
131 {
132 this.eventStartDt = eventStartDtIn;
133 }
134
135 private Date eventEndDt;
136
137
138
139
140
141 public Date getEventEndDt()
142 {
143 return this.eventEndDt;
144 }
145
146
147
148
149
150 public void setEventEndDt(Date eventEndDtIn)
151 {
152 this.eventEndDt = eventEndDtIn;
153 }
154
155 private String eventPositionCm;
156
157
158
159
160
161 public String getEventPositionCm()
162 {
163 return this.eventPositionCm;
164 }
165
166
167
168
169
170 public void setEventPositionCm(String eventPositionCmIn)
171 {
172 this.eventPositionCm = eventPositionCmIn;
173 }
174
175 private Date eventCreationDt;
176
177
178
179
180
181 public Date getEventCreationDt()
182 {
183 return this.eventCreationDt;
184 }
185
186
187
188
189
190 public void setEventCreationDt(Date eventCreationDtIn)
191 {
192 this.eventCreationDt = eventCreationDtIn;
193 }
194
195 private Timestamp updateDt;
196
197
198
199
200
201 public Timestamp getUpdateDt()
202 {
203 return this.updateDt;
204 }
205
206
207
208
209
210 public void setUpdateDt(Timestamp updateDtIn)
211 {
212 this.updateDt = updateDtIn;
213 }
214
215
216 private EventType eventType;
217
218
219
220
221
222 public EventType getEventType()
223 {
224 return this.eventType;
225 }
226
227
228
229
230
231 public void setEventType(EventType eventTypeIn)
232 {
233 this.eventType = eventTypeIn;
234 }
235
236 private Collection<EventLine> eventLines = new HashSet<EventLine>();
237
238
239
240
241
242 public Collection<EventLine> getEventLines()
243 {
244 return this.eventLines;
245 }
246
247
248
249
250
251 public void setEventLines(Collection<EventLine> eventLinesIn)
252 {
253 this.eventLines = eventLinesIn;
254 }
255
256
257
258
259
260
261
262 public boolean addEventLines(EventLine elementToAdd)
263 {
264 return this.eventLines.add(elementToAdd);
265 }
266
267
268
269
270
271
272
273 public boolean removeEventLines(EventLine elementToRemove)
274 {
275 return this.eventLines.remove(elementToRemove);
276 }
277
278 private Collection<EventPoint> eventPoints = new HashSet<EventPoint>();
279
280
281
282
283
284 public Collection<EventPoint> getEventPoints()
285 {
286 return this.eventPoints;
287 }
288
289
290
291
292
293 public void setEventPoints(Collection<EventPoint> eventPointsIn)
294 {
295 this.eventPoints = eventPointsIn;
296 }
297
298
299
300
301
302
303
304 public boolean addEventPoints(EventPoint elementToAdd)
305 {
306 return this.eventPoints.add(elementToAdd);
307 }
308
309
310
311
312
313
314
315 public boolean removeEventPoints(EventPoint elementToRemove)
316 {
317 return this.eventPoints.remove(elementToRemove);
318 }
319
320 private PositionningSystem positionningSystem;
321
322
323
324
325
326 public PositionningSystem getPositionningSystem()
327 {
328 return this.positionningSystem;
329 }
330
331
332
333
334
335 public void setPositionningSystem(PositionningSystem positionningSystemIn)
336 {
337 this.positionningSystem = positionningSystemIn;
338 }
339
340 private Department recorderDepartment;
341
342
343
344
345
346 public Department getRecorderDepartment()
347 {
348 return this.recorderDepartment;
349 }
350
351
352
353
354
355 public void setRecorderDepartment(Department recorderDepartmentIn)
356 {
357 this.recorderDepartment = recorderDepartmentIn;
358 }
359
360 private Collection<Survey> surveys = new HashSet<Survey>();
361
362
363
364
365
366
367 public Collection<Survey> getSurveys()
368 {
369 return this.surveys;
370 }
371
372
373
374
375
376
377 public void setSurveys(Collection<Survey> surveysIn)
378 {
379 this.surveys = surveysIn;
380 }
381
382
383
384
385
386
387
388
389 public boolean addSurveys(Survey elementToAdd)
390 {
391 return this.surveys.add(elementToAdd);
392 }
393
394
395
396
397
398
399
400
401 public boolean removeSurveys(Survey elementToRemove)
402 {
403 return this.surveys.remove(elementToRemove);
404 }
405
406 private Collection<EventArea> eventAreas = new HashSet<EventArea>();
407
408
409
410
411
412 public Collection<EventArea> getEventAreas()
413 {
414 return this.eventAreas;
415 }
416
417
418
419
420
421 public void setEventAreas(Collection<EventArea> eventAreasIn)
422 {
423 this.eventAreas = eventAreasIn;
424 }
425
426
427
428
429
430
431
432 public boolean addEventAreas(EventArea elementToAdd)
433 {
434 return this.eventAreas.add(elementToAdd);
435 }
436
437
438
439
440
441
442
443 public boolean removeEventAreas(EventArea elementToRemove)
444 {
445 return this.eventAreas.remove(elementToRemove);
446 }
447
448
449
450
451
452 @Override
453 public boolean equals(Object object)
454 {
455 if (this == object)
456 {
457 return true;
458 }
459 if (!(object instanceof Event))
460 {
461 return false;
462 }
463 final Event that = (Event)object;
464 if (this.eventId == null || that.getEventId() == null || !this.eventId.equals(that.getEventId()))
465 {
466 return false;
467 }
468 return true;
469 }
470
471
472
473
474 @Override
475 public int hashCode()
476 {
477 int hashCode = 0;
478 hashCode = 29 * hashCode + (this.eventId == null ? 0 : this.eventId.hashCode());
479
480 return hashCode;
481 }
482
483
484
485
486 public static final class Factory
487 {
488
489
490
491
492 public static Event newInstance()
493 {
494 return new EventImpl();
495 }
496
497
498
499
500
501
502
503
504
505
506
507 public static Event newInstance(String eventDc, Date eventStartDt, Timestamp updateDt, EventType eventType, Department recorderDepartment)
508 {
509 final Event entity = new EventImpl();
510 entity.setEventDc(eventDc);
511 entity.setEventStartDt(eventStartDt);
512 entity.setUpdateDt(updateDt);
513 entity.setEventType(eventType);
514 entity.setRecorderDepartment(recorderDepartment);
515 return entity;
516 }
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537 public static Event newInstance(String eventDc, String eventCm, Date eventStartDt, Date eventEndDt, String eventPositionCm, Date eventCreationDt, Timestamp updateDt, EventType eventType, Collection<EventLine> eventLines, Collection<EventPoint> eventPoints, PositionningSystem positionningSystem, Department recorderDepartment, Collection<Survey> surveys, Collection<EventArea> eventAreas)
538 {
539 final Event entity = new EventImpl();
540 entity.setEventDc(eventDc);
541 entity.setEventCm(eventCm);
542 entity.setEventStartDt(eventStartDt);
543 entity.setEventEndDt(eventEndDt);
544 entity.setEventPositionCm(eventPositionCm);
545 entity.setEventCreationDt(eventCreationDt);
546 entity.setUpdateDt(updateDt);
547 entity.setEventType(eventType);
548 entity.setEventLines(eventLines);
549 entity.setEventPoints(eventPoints);
550 entity.setPositionningSystem(positionningSystem);
551 entity.setRecorderDepartment(recorderDepartment);
552 entity.setSurveys(surveys);
553 entity.setEventAreas(eventAreas);
554 return entity;
555 }
556 }
557
558
559
560
561 public int compareTo(Event o)
562 {
563 int cmp = 0;
564 if (this.getEventId() != null)
565 {
566 cmp = this.getEventId().compareTo(o.getEventId());
567 }
568 else
569 {
570 if (this.getEventDc() != null)
571 {
572 cmp = (cmp != 0 ? cmp : this.getEventDc().compareTo(o.getEventDc()));
573 }
574 if (this.getEventCm() != null)
575 {
576 cmp = (cmp != 0 ? cmp : this.getEventCm().compareTo(o.getEventCm()));
577 }
578 if (this.getEventStartDt() != null)
579 {
580 cmp = (cmp != 0 ? cmp : this.getEventStartDt().compareTo(o.getEventStartDt()));
581 }
582 if (this.getEventEndDt() != null)
583 {
584 cmp = (cmp != 0 ? cmp : this.getEventEndDt().compareTo(o.getEventEndDt()));
585 }
586 if (this.getEventPositionCm() != null)
587 {
588 cmp = (cmp != 0 ? cmp : this.getEventPositionCm().compareTo(o.getEventPositionCm()));
589 }
590 if (this.getEventCreationDt() != null)
591 {
592 cmp = (cmp != 0 ? cmp : this.getEventCreationDt().compareTo(o.getEventCreationDt()));
593 }
594 if (this.getUpdateDt() != null)
595 {
596 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
597 }
598 }
599 return cmp;
600 }
601
602
603 }