View Javadoc
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.data.event;
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.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   * Liste les événements qui peuvent avoir ou non un rapport avec un passage.
44   */
45  // HibernateEntity.vsl annotations merge-point
46  public abstract class Event
47      implements Serializable, Comparable<Event>
48  {
49      /**
50       * The serial version UID of this class. Needed for serialization.
51       */
52      private static final long serialVersionUID = -8085508884426184017L;
53  
54      // Generate 8 attributes
55      private Integer eventId;
56  
57      /**
58       * Identifiant interne de l'évènement
59       * @return this.eventId Integer
60       */
61      public Integer getEventId()
62      {
63          return this.eventId;
64      }
65  
66      /**
67       * Identifiant interne de l'évènement
68       * @param eventIdIn Integer
69       */
70      public void setEventId(Integer eventIdIn)
71      {
72          this.eventId = eventIdIn;
73      }
74  
75      private String eventDc;
76  
77      /**
78       * Description de l'évènement
79       * @return this.eventDc String
80       */
81      public String getEventDc()
82      {
83          return this.eventDc;
84      }
85  
86      /**
87       * Description de l'évènement
88       * @param eventDcIn String
89       */
90      public void setEventDc(String eventDcIn)
91      {
92          this.eventDc = eventDcIn;
93      }
94  
95      private String eventCm;
96  
97      /**
98       * Commentaire sur l'évènement
99       * @return this.eventCm String
100      */
101     public String getEventCm()
102     {
103         return this.eventCm;
104     }
105 
106     /**
107      * Commentaire sur l'évènement
108      * @param eventCmIn String
109      */
110     public void setEventCm(String eventCmIn)
111     {
112         this.eventCm = eventCmIn;
113     }
114 
115     private Date eventStartDt;
116 
117     /**
118      * Date de début de l'évèvnement
119      * @return this.eventStartDt Date
120      */
121     public Date getEventStartDt()
122     {
123         return this.eventStartDt;
124     }
125 
126     /**
127      * Date de début de l'évèvnement
128      * @param eventStartDtIn Date
129      */
130     public void setEventStartDt(Date eventStartDtIn)
131     {
132         this.eventStartDt = eventStartDtIn;
133     }
134 
135     private Date eventEndDt;
136 
137     /**
138      * Date de fin de l'évènement.
139      * @return this.eventEndDt Date
140      */
141     public Date getEventEndDt()
142     {
143         return this.eventEndDt;
144     }
145 
146     /**
147      * Date de fin de l'évènement.
148      * @param eventEndDtIn Date
149      */
150     public void setEventEndDt(Date eventEndDtIn)
151     {
152         this.eventEndDt = eventEndDtIn;
153     }
154 
155     private String eventPositionCm;
156 
157     /**
158      * Commentaire sur la localisation
159      * @return this.eventPositionCm String
160      */
161     public String getEventPositionCm()
162     {
163         return this.eventPositionCm;
164     }
165 
166     /**
167      * Commentaire sur la localisation
168      * @param eventPositionCmIn String
169      */
170     public void setEventPositionCm(String eventPositionCmIn)
171     {
172         this.eventPositionCm = eventPositionCmIn;
173     }
174 
175     private Date eventCreationDt;
176 
177     /**
178      * Date de création de l'objet, mise à jour par le système
179      * @return this.eventCreationDt Date
180      */
181     public Date getEventCreationDt()
182     {
183         return this.eventCreationDt;
184     }
185 
186     /**
187      * Date de création de l'objet, mise à jour par le système
188      * @param eventCreationDtIn Date
189      */
190     public void setEventCreationDt(Date eventCreationDtIn)
191     {
192         this.eventCreationDt = eventCreationDtIn;
193     }
194 
195     private Timestamp updateDt;
196 
197     /**
198      * Date de modification de l'objet, mise à jour par le système
199      * @return this.updateDt Timestamp
200      */
201     public Timestamp getUpdateDt()
202     {
203         return this.updateDt;
204     }
205 
206     /**
207      * Date de modification de l'objet, mise à jour par le système
208      * @param updateDtIn Timestamp
209      */
210     public void setUpdateDt(Timestamp updateDtIn)
211     {
212         this.updateDt = updateDtIn;
213     }
214 
215     // Generate 7 associations
216     private EventType eventType;
217 
218     /**
219      * Liste des types d'évènement observables.
220      * @return this.eventType EventType
221      */
222     public EventType getEventType()
223     {
224         return this.eventType;
225     }
226 
227     /**
228      * Liste des types d'évènement observables.
229      * @param eventTypeIn EventType
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      * Gestion de la géométrie linéaire des évènements.
240      * @return this.eventLines Collection<EventLine>
241      */
242     public Collection<EventLine> getEventLines()
243     {
244         return this.eventLines;
245     }
246 
247     /**
248      * Gestion de la géométrie linéaire des évènements.
249      * @param eventLinesIn Collection<EventLine>
250      */
251     public void setEventLines(Collection<EventLine> eventLinesIn)
252     {
253         this.eventLines = eventLinesIn;
254     }
255 
256     /**
257      * Gestion de la géométrie linéaire des évènements.
258      * @param elementToAdd EventLine
259      * @return <tt>true</tt> if this collection changed as a result of the
260      *         call
261      */
262     public boolean addEventLines(EventLine elementToAdd)
263     {
264         return this.eventLines.add(elementToAdd);
265     }
266 
267     /**
268      * Gestion de la géométrie linéaire des évènements.
269      * @param elementToRemove EventLine
270      * @return <tt>true</tt> if this collection changed as a result of the
271      *         call
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      * Gestion de la géométrie ponctuelle des évènements.
282      * @return this.eventPoints Collection<EventPoint>
283      */
284     public Collection<EventPoint> getEventPoints()
285     {
286         return this.eventPoints;
287     }
288 
289     /**
290      * Gestion de la géométrie ponctuelle des évènements.
291      * @param eventPointsIn Collection<EventPoint>
292      */
293     public void setEventPoints(Collection<EventPoint> eventPointsIn)
294     {
295         this.eventPoints = eventPointsIn;
296     }
297 
298     /**
299      * Gestion de la géométrie ponctuelle des évènements.
300      * @param elementToAdd EventPoint
301      * @return <tt>true</tt> if this collection changed as a result of the
302      *         call
303      */
304     public boolean addEventPoints(EventPoint elementToAdd)
305     {
306         return this.eventPoints.add(elementToAdd);
307     }
308 
309     /**
310      * Gestion de la géométrie ponctuelle des évènements.
311      * @param elementToRemove EventPoint
312      * @return <tt>true</tt> if this collection changed as a result of the
313      *         call
314      */
315     public boolean removeEventPoints(EventPoint elementToRemove)
316     {
317         return this.eventPoints.remove(elementToRemove);
318     }
319 
320     private PositionningSystem positionningSystem;
321 
322     /**
323      * Informations complémentaires sur le positionnement d'un objet.
324      * @return this.positionningSystem PositionningSystem
325      */
326     public PositionningSystem getPositionningSystem()
327     {
328         return this.positionningSystem;
329     }
330 
331     /**
332      * Informations complémentaires sur le positionnement d'un objet.
333      * @param positionningSystemIn PositionningSystem
334      */
335     public void setPositionningSystem(PositionningSystem positionningSystemIn)
336     {
337         this.positionningSystem = positionningSystemIn;
338     }
339 
340     private Department recorderDepartment;
341 
342     /**
343      * Liste les départements ou services auxquels sont rattachés les agents
344      * @return this.recorderDepartment Department
345      */
346     public Department getRecorderDepartment()
347     {
348         return this.recorderDepartment;
349     }
350 
351     /**
352      * Liste les départements ou services auxquels sont rattachés les agents
353      * @param recorderDepartmentIn Department
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      * Liste les différents passages effectués sur un lieu de surveillance.
364      * Liste les différents passages effectués sur un lieu de surveillance.
365      * @return this.surveys Collection<Survey>
366      */
367     public Collection<Survey> getSurveys()
368     {
369         return this.surveys;
370     }
371 
372     /**
373      * Liste les différents passages effectués sur un lieu de surveillance.
374      * Liste les différents passages effectués sur un lieu de surveillance.
375      * @param surveysIn Collection<Survey>
376      */
377     public void setSurveys(Collection<Survey> surveysIn)
378     {
379         this.surveys = surveysIn;
380     }
381 
382     /**
383      * Liste les différents passages effectués sur un lieu de surveillance.
384      * Liste les différents passages effectués sur un lieu de surveillance.
385      * @param elementToAdd Survey
386      * @return <tt>true</tt> if this collection changed as a result of the
387      *         call
388      */
389     public boolean addSurveys(Survey elementToAdd)
390     {
391         return this.surveys.add(elementToAdd);
392     }
393 
394     /**
395      * Liste les différents passages effectués sur un lieu de surveillance.
396      * Liste les différents passages effectués sur un lieu de surveillance.
397      * @param elementToRemove Survey
398      * @return <tt>true</tt> if this collection changed as a result of the
399      *         call
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      * Gestion de la géométrie surfacique des évènements.
410      * @return this.eventAreas Collection<EventArea>
411      */
412     public Collection<EventArea> getEventAreas()
413     {
414         return this.eventAreas;
415     }
416 
417     /**
418      * Gestion de la géométrie surfacique des évènements.
419      * @param eventAreasIn Collection<EventArea>
420      */
421     public void setEventAreas(Collection<EventArea> eventAreasIn)
422     {
423         this.eventAreas = eventAreasIn;
424     }
425 
426     /**
427      * Gestion de la géométrie surfacique des évènements.
428      * @param elementToAdd EventArea
429      * @return <tt>true</tt> if this collection changed as a result of the
430      *         call
431      */
432     public boolean addEventAreas(EventArea elementToAdd)
433     {
434         return this.eventAreas.add(elementToAdd);
435     }
436 
437     /**
438      * Gestion de la géométrie surfacique des évènements.
439      * @param elementToRemove EventArea
440      * @return <tt>true</tt> if this collection changed as a result of the
441      *         call
442      */
443     public boolean removeEventAreas(EventArea elementToRemove)
444     {
445         return this.eventAreas.remove(elementToRemove);
446     }
447 
448     /**
449      * Returns <code>true</code> if the argument is an Event instance and all identifiers for this entity
450      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
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      * Returns a hash code based on this entity's identifiers.
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      * Constructs new instances of {@link Event}.
485      */
486     public static final class Factory
487     {
488         /**
489          * Constructs a new instance of {@link Event}.
490          * @return new EventImpl()
491          */
492         public static Event newInstance()
493         {
494             return new EventImpl();
495         }
496 
497         /**
498          * Constructs a new instance of {@link Event}, taking all required and/or
499          * read-only properties as arguments, except for identifiers.
500          * @param eventDc String
501          * @param eventStartDt Date
502          * @param updateDt Timestamp
503          * @param eventType EventType
504          * @param recorderDepartment Department
505          * @return newInstance
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          * Constructs a new instance of {@link Event}, taking all possible properties
520          * (except the identifier(s))as arguments.
521          * @param eventDc String
522          * @param eventCm String
523          * @param eventStartDt Date
524          * @param eventEndDt Date
525          * @param eventPositionCm String
526          * @param eventCreationDt Date
527          * @param updateDt Timestamp
528          * @param eventType EventType
529          * @param eventLines Collection<EventLine>
530          * @param eventPoints Collection<EventPoint>
531          * @param positionningSystem PositionningSystem
532          * @param recorderDepartment Department
533          * @param surveys Collection<Survey>
534          * @param eventAreas Collection<EventArea>
535          * @return newInstance Event
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      * @see Comparable#compareTo
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 // HibernateEntity.vsl merge-point
602 // Event.java merge-point
603 }