1
2
3
4
5
6 package fr.ifremer.quadrige3.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 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
43
44
45 public abstract class Event
46 implements Serializable, Comparable<Event>
47 {
48
49
50
51 private static final long serialVersionUID = 909796630594870265L;
52
53
54 private Integer eventId;
55
56
57
58
59
60 public Integer getEventId()
61 {
62 return this.eventId;
63 }
64
65
66
67
68
69 public void setEventId(Integer eventIdIn)
70 {
71 this.eventId = eventIdIn;
72 }
73
74 private String eventDc;
75
76
77
78
79
80 public String getEventDc()
81 {
82 return this.eventDc;
83 }
84
85
86
87
88
89 public void setEventDc(String eventDcIn)
90 {
91 this.eventDc = eventDcIn;
92 }
93
94 private String eventCm;
95
96
97
98
99
100 public String getEventCm()
101 {
102 return this.eventCm;
103 }
104
105
106
107
108
109 public void setEventCm(String eventCmIn)
110 {
111 this.eventCm = eventCmIn;
112 }
113
114 private Date eventStartDt;
115
116
117
118
119
120 public Date getEventStartDt()
121 {
122 return this.eventStartDt;
123 }
124
125
126
127
128
129 public void setEventStartDt(Date eventStartDtIn)
130 {
131 this.eventStartDt = eventStartDtIn;
132 }
133
134 private Date eventEndDt;
135
136
137
138
139
140 public Date getEventEndDt()
141 {
142 return this.eventEndDt;
143 }
144
145
146
147
148
149 public void setEventEndDt(Date eventEndDtIn)
150 {
151 this.eventEndDt = eventEndDtIn;
152 }
153
154 private String eventPositionCm;
155
156
157
158
159
160 public String getEventPositionCm()
161 {
162 return this.eventPositionCm;
163 }
164
165
166
167
168
169 public void setEventPositionCm(String eventPositionCmIn)
170 {
171 this.eventPositionCm = eventPositionCmIn;
172 }
173
174 private Date eventCreationDt;
175
176
177
178
179
180 public Date getEventCreationDt()
181 {
182 return this.eventCreationDt;
183 }
184
185
186
187
188
189 public void setEventCreationDt(Date eventCreationDtIn)
190 {
191 this.eventCreationDt = eventCreationDtIn;
192 }
193
194 private Timestamp updateDt;
195
196
197
198
199
200 public Timestamp getUpdateDt()
201 {
202 return this.updateDt;
203 }
204
205
206
207
208
209 public void setUpdateDt(Timestamp updateDtIn)
210 {
211 this.updateDt = updateDtIn;
212 }
213
214 private Integer remoteId;
215
216
217
218
219
220 public Integer getRemoteId()
221 {
222 return this.remoteId;
223 }
224
225
226
227
228
229 public void setRemoteId(Integer remoteIdIn)
230 {
231 this.remoteId = remoteIdIn;
232 }
233
234
235 private EventType eventType;
236
237
238
239
240
241 public EventType getEventType()
242 {
243 return this.eventType;
244 }
245
246
247
248
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
259
260
261 public Collection<EventLine> getEventLines()
262 {
263 return this.eventLines;
264 }
265
266
267
268
269
270 public void setEventLines(Collection<EventLine> eventLinesIn)
271 {
272 this.eventLines = eventLinesIn;
273 }
274
275
276
277
278
279
280
281 public boolean addEventLines(EventLine elementToAdd)
282 {
283 return this.eventLines.add(elementToAdd);
284 }
285
286
287
288
289
290
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
301
302
303 public Collection<EventPoint> getEventPoints()
304 {
305 return this.eventPoints;
306 }
307
308
309
310
311
312 public void setEventPoints(Collection<EventPoint> eventPointsIn)
313 {
314 this.eventPoints = eventPointsIn;
315 }
316
317
318
319
320
321
322
323 public boolean addEventPoints(EventPoint elementToAdd)
324 {
325 return this.eventPoints.add(elementToAdd);
326 }
327
328
329
330
331
332
333
334 public boolean removeEventPoints(EventPoint elementToRemove)
335 {
336 return this.eventPoints.remove(elementToRemove);
337 }
338
339 private PositionningSystem positionningSystem;
340
341
342
343
344
345 public PositionningSystem getPositionningSystem()
346 {
347 return this.positionningSystem;
348 }
349
350
351
352
353
354 public void setPositionningSystem(PositionningSystem positionningSystemIn)
355 {
356 this.positionningSystem = positionningSystemIn;
357 }
358
359 private Department recorderDepartment;
360
361
362
363
364
365 public Department getRecorderDepartment()
366 {
367 return this.recorderDepartment;
368 }
369
370
371
372
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
383
384
385
386 public Collection<Survey> getSurveys()
387 {
388 return this.surveys;
389 }
390
391
392
393
394
395
396 public void setSurveys(Collection<Survey> surveysIn)
397 {
398 this.surveys = surveysIn;
399 }
400
401
402
403
404
405
406
407
408 public boolean addSurveys(Survey elementToAdd)
409 {
410 return this.surveys.add(elementToAdd);
411 }
412
413
414
415
416
417
418
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
429
430
431 public Collection<EventArea> getEventAreas()
432 {
433 return this.eventAreas;
434 }
435
436
437
438
439
440 public void setEventAreas(Collection<EventArea> eventAreasIn)
441 {
442 this.eventAreas = eventAreasIn;
443 }
444
445
446
447
448
449
450
451 public boolean addEventAreas(EventArea elementToAdd)
452 {
453 return this.eventAreas.add(elementToAdd);
454 }
455
456
457
458
459
460
461
462 public boolean removeEventAreas(EventArea elementToRemove)
463 {
464 return this.eventAreas.remove(elementToRemove);
465 }
466
467
468
469
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
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
504
505 public static final class Factory
506 {
507
508
509
510
511 public static Event newInstance()
512 {
513 return new EventImpl();
514 }
515
516
517
518
519
520
521
522
523
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
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
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
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
625
626 }