001// license-header java merge-point
002//
003// Attention: Generated code! Do not modify by hand!
004// Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
005//
006package fr.ifremer.adagio.core.dao.referential.gear;
007
008/*
009 * #%L
010 * SIH-Adagio :: Core
011 * $Id:$
012 * $HeadURL:$
013 * %%
014 * Copyright (C) 2012 - 2014 Ifremer
015 * %%
016 * This program is free software: you can redistribute it and/or modify
017 * it under the terms of the GNU Affero General Public License as published by
018 * the Free Software Foundation, either version 3 of the License, or
019 * (at your option) any later version.
020 * 
021 * This program is distributed in the hope that it will be useful,
022 * but WITHOUT ANY WARRANTY; without even the implied warranty of
023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
024 * GNU General Public License for more details.
025 * 
026 * You should have received a copy of the GNU Affero General Public License
027 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
028 * #L%
029 */
030
031import fr.ifremer.adagio.core.dao.referential.Status;
032import fr.ifremer.adagio.core.dao.referential.ValidityStatus;
033import java.io.Serializable;
034import java.sql.Timestamp;
035import java.util.Collection;
036import java.util.HashSet;
037
038/**
039 * <html>
040 * <head>
041 * </head>
042 * <body>
043 * <p>
044 * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
045 * </p>
046 * <p>
047 * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
048 * classification, via les liens d'engin parents/enfants.
049 * </p>
050 * <p>
051 * <br>
052 * </p>
053 * <p>
054 * Exemple, pour la classification 'Engin EU corpus' :
055 * </p>
056 * <p>
057 * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
058 * </p>
059 * <p>
060 * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
061 * </p>
062 * <p>
063 * * corpus 2 (...)<br>- ...
064 * </p>
065 * <p>
066 * <br>
067 * </p>
068 * <p>
069 * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
070 * '03.0.0')<br>
071 * </p>
072 * <p>
073 * - 'OTB' 'chalut de fond'<br>
074 * </p>
075 * <p>
076 * - chalut p&#233;lagique
077 * </p>
078 * <p>
079 * - ...<br>* 'Filets'
080 * </p>
081 * </body>
082 * </html>
083 */
084// HibernateEntity.vsl annotations merge-point
085public abstract class Gear
086    implements Serializable, Comparable<Gear>
087{
088    /**
089     * The serial version UID of this class. Needed for serialization.
090     */
091    private static final long serialVersionUID = 6393036862397354417L;
092
093    // Generate 6 attributes
094    private Integer id;
095
096    /**
097     * Idenfiant interne. Généré par le système.
098     * @return this.id Integer
099     */
100    public Integer getId()
101    {
102        return this.id;
103    }
104
105    /**
106     * Idenfiant interne. Généré par le système.
107     * @param idIn Integer
108     */
109    public void setId(Integer idIn)
110    {
111        this.id = idIn;
112    }
113
114    private String label;
115
116    /**
117     * Mnémonique (ou code) de l'engin. Le mnémonique doit être unique pour une meme classification
118     * d'engin.
119     * Par exemple : - Pour la classification FAO/CSITEP : label='OTB'
120     * @return this.label String
121     */
122    public String getLabel()
123    {
124        return this.label;
125    }
126
127    /**
128     * Mnémonique (ou code) de l'engin. Le mnémonique doit être unique pour une meme classification
129     * d'engin.
130     * Par exemple : - Pour la classification FAO/CSITEP : label='OTB'
131     * @param labelIn String
132     */
133    public void setLabel(String labelIn)
134    {
135        this.label = labelIn;
136    }
137
138    private String name;
139
140    /**
141     * Libellé de l'engin.
142     * il s'agit du libellé "officiel" de la classification.
143     * note : ce libellé peut etre régionalisé via "GearLocation".
144     * @return this.name String
145     */
146    public String getName()
147    {
148        return this.name;
149    }
150
151    /**
152     * Libellé de l'engin.
153     * il s'agit du libellé "officiel" de la classification.
154     * note : ce libellé peut etre régionalisé via "GearLocation".
155     * @param nameIn String
156     */
157    public void setName(String nameIn)
158    {
159        this.name = nameIn;
160    }
161
162    private String description;
163
164    /**
165     * 
166     * @return this.description String
167     */
168    public String getDescription()
169    {
170        return this.description;
171    }
172
173    /**
174     * 
175     * @param descriptionIn String
176     */
177    public void setDescription(String descriptionIn)
178    {
179        this.description = descriptionIn;
180    }
181
182    private Timestamp updateDate;
183
184    /**
185     * 
186     * @return this.updateDate Timestamp
187     */
188    public Timestamp getUpdateDate()
189    {
190        return this.updateDate;
191    }
192
193    /**
194     * 
195     * @param updateDateIn Timestamp
196     */
197    public void setUpdateDate(Timestamp updateDateIn)
198    {
199        this.updateDate = updateDateIn;
200    }
201
202    private String comments;
203
204    /**
205     * 
206     * @return this.comments String
207     */
208    public String getComments()
209    {
210        return this.comments;
211    }
212
213    /**
214     * 
215     * @param commentsIn String
216     */
217    public void setComments(String commentsIn)
218    {
219        this.comments = commentsIn;
220    }
221
222    // Generate 21 associations
223    private Gear parentGear;
224
225    /**
226     * <html>
227     * <head>
228     * </head>
229     * <body>
230     * <p>
231     * D&#233;fini l'engin parent, au sein de la meme classification
232     * </p>
233     * <p>
234     * <u>note :</u> pour une association entre des classifications diff&#233;rents,
235     * cf &quot;synonymGears&quot;
236     * </p>
237     * </body>
238     * </html>
239     * @return this.parentGear Gear
240     */
241    public Gear getParentGear()
242    {
243        return this.parentGear;
244    }
245
246    /**
247     * <html>
248     * <head>
249     * </head>
250     * <body>
251     * <p>
252     * D&#233;fini l'engin parent, au sein de la meme classification
253     * </p>
254     * <p>
255     * <u>note :</u> pour une association entre des classifications diff&#233;rents,
256     * cf &quot;synonymGears&quot;
257     * </p>
258     * </body>
259     * </html>
260     * @param parentGearIn Gear
261     */
262    public void setParentGear(Gear parentGearIn)
263    {
264        this.parentGear = parentGearIn;
265    }
266
267    private ValidityStatus validityStatus;
268
269    /**
270     * Etat de validation d'une donnée du référentiel. Utile pour les responsables de référentiel.
271     * Validity status of a referential data.
272     * @return this.validityStatus ValidityStatus
273     */
274    public ValidityStatus getValidityStatus()
275    {
276        return this.validityStatus;
277    }
278
279    /**
280     * Etat de validation d'une donnée du référentiel. Utile pour les responsables de référentiel.
281     * Validity status of a referential data.
282     * @param validityStatusIn ValidityStatus
283     */
284    public void setValidityStatus(ValidityStatus validityStatusIn)
285    {
286        this.validityStatus = validityStatusIn;
287    }
288
289    private Collection<Gear> childGears = new HashSet<Gear>();
290
291    /**
292     * <html>
293     * <head>
294     * </head>
295     * <body>
296     * <p>
297     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
298     * </p>
299     * <p>
300     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
301     * classification, via les liens d'engin parents/enfants.
302     * </p>
303     * <p>
304     * <br>
305     * </p>
306     * <p>
307     * Exemple, pour la classification 'Engin EU corpus' :
308     * </p>
309     * <p>
310     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
311     * </p>
312     * <p>
313     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
314     * </p>
315     * <p>
316     * * corpus 2 (...)<br>- ...
317     * </p>
318     * <p>
319     * <br>
320     * </p>
321     * <p>
322     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
323     * '03.0.0')<br>
324     * </p>
325     * <p>
326     * - 'OTB' 'chalut de fond'<br>
327     * </p>
328     * <p>
329     * - chalut p&#233;lagique
330     * </p>
331     * <p>
332     * - ...<br>* 'Filets'
333     * </p>
334     * </body>
335     * </html>
336     * @return this.childGears Collection<Gear>
337     */
338    public Collection<Gear> getChildGears()
339    {
340        return this.childGears;
341    }
342
343    /**
344     * <html>
345     * <head>
346     * </head>
347     * <body>
348     * <p>
349     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
350     * </p>
351     * <p>
352     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
353     * classification, via les liens d'engin parents/enfants.
354     * </p>
355     * <p>
356     * <br>
357     * </p>
358     * <p>
359     * Exemple, pour la classification 'Engin EU corpus' :
360     * </p>
361     * <p>
362     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
363     * </p>
364     * <p>
365     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
366     * </p>
367     * <p>
368     * * corpus 2 (...)<br>- ...
369     * </p>
370     * <p>
371     * <br>
372     * </p>
373     * <p>
374     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
375     * '03.0.0')<br>
376     * </p>
377     * <p>
378     * - 'OTB' 'chalut de fond'<br>
379     * </p>
380     * <p>
381     * - chalut p&#233;lagique
382     * </p>
383     * <p>
384     * - ...<br>* 'Filets'
385     * </p>
386     * </body>
387     * </html>
388     * @param childGearsIn Collection<Gear>
389     */
390    public void setChildGears(Collection<Gear> childGearsIn)
391    {
392        this.childGears = childGearsIn;
393    }
394
395    /**
396     * <html>
397     * <head>
398     * </head>
399     * <body>
400     * <p>
401     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
402     * </p>
403     * <p>
404     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
405     * classification, via les liens d'engin parents/enfants.
406     * </p>
407     * <p>
408     * <br>
409     * </p>
410     * <p>
411     * Exemple, pour la classification 'Engin EU corpus' :
412     * </p>
413     * <p>
414     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
415     * </p>
416     * <p>
417     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
418     * </p>
419     * <p>
420     * * corpus 2 (...)<br>- ...
421     * </p>
422     * <p>
423     * <br>
424     * </p>
425     * <p>
426     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
427     * '03.0.0')<br>
428     * </p>
429     * <p>
430     * - 'OTB' 'chalut de fond'<br>
431     * </p>
432     * <p>
433     * - chalut p&#233;lagique
434     * </p>
435     * <p>
436     * - ...<br>* 'Filets'
437     * </p>
438     * </body>
439     * </html>
440     * @param elementToAdd Gear
441     * @return <tt>true</tt> if this collection changed as a result of the
442     *         call
443     */
444    public boolean addChildGears(Gear elementToAdd)
445    {
446        return this.childGears.add(elementToAdd);
447    }
448
449    /**
450     * <html>
451     * <head>
452     * </head>
453     * <body>
454     * <p>
455     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
456     * </p>
457     * <p>
458     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
459     * classification, via les liens d'engin parents/enfants.
460     * </p>
461     * <p>
462     * <br>
463     * </p>
464     * <p>
465     * Exemple, pour la classification 'Engin EU corpus' :
466     * </p>
467     * <p>
468     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
469     * </p>
470     * <p>
471     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
472     * </p>
473     * <p>
474     * * corpus 2 (...)<br>- ...
475     * </p>
476     * <p>
477     * <br>
478     * </p>
479     * <p>
480     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
481     * '03.0.0')<br>
482     * </p>
483     * <p>
484     * - 'OTB' 'chalut de fond'<br>
485     * </p>
486     * <p>
487     * - chalut p&#233;lagique
488     * </p>
489     * <p>
490     * - ...<br>* 'Filets'
491     * </p>
492     * </body>
493     * </html>
494     * @param elementToRemove Gear
495     * @return <tt>true</tt> if this collection changed as a result of the
496     *         call
497     */
498    public boolean removeChildGears(Gear elementToRemove)
499    {
500        return this.childGears.remove(elementToRemove);
501    }
502
503    private GearClassification gearClassification;
504
505    /**
506     * Une classification d'engin permet le regroupement d'un ensemble cohérent d'engin.
507     * Exemple :
508     * - Engin FAO, appellée aussi CSITEP (Classification Standard Internationale Type des Engins de
509     * Pêche), ou, en anglais : International Standard Statistical Classification of Fishing Gear
510     * (ISSCFG)
511     * : ftp://ftp.fao.org/FI/DOCUMENT/cwp/handbook/annex/AnnexM1fishinggear.pdf
512     * - Engin CNTS (DPMA SIP)
513     * - Engin EU (basé sur les engins FAO, mais adapté au contexte réglementaire européen) :
514     * exemple :    - extension pour signifier 'pas d'engin' : NO
515     * extension pour signifier 'engin inconnu' : NK (Not Known)
516     * 'ligne avec canne (...)' : BTF (code utilisé pour des données historique)
517     * - 'Engin EU Corpus' pour le traitment (cf DRE_CORPUS dans tmpsih)
518     * - Engin Métier Ifremer (basé sur la classification FAO, et etendue aux besoins
519     * Ifremer/francais)
520     * Pour ObsMer, la classification utilisée est : FAO
521     * Pour les observations au débarquement, la classification utilisée est : FAO + CNTS (pour
522     * recroiser
523     * avec les déclarations)
524     * @return this.gearClassification GearClassification
525     */
526    public GearClassification getGearClassification()
527    {
528        return this.gearClassification;
529    }
530
531    /**
532     * Une classification d'engin permet le regroupement d'un ensemble cohérent d'engin.
533     * Exemple :
534     * - Engin FAO, appellée aussi CSITEP (Classification Standard Internationale Type des Engins de
535     * Pêche), ou, en anglais : International Standard Statistical Classification of Fishing Gear
536     * (ISSCFG)
537     * : ftp://ftp.fao.org/FI/DOCUMENT/cwp/handbook/annex/AnnexM1fishinggear.pdf
538     * - Engin CNTS (DPMA SIP)
539     * - Engin EU (basé sur les engins FAO, mais adapté au contexte réglementaire européen) :
540     * exemple :    - extension pour signifier 'pas d'engin' : NO
541     * extension pour signifier 'engin inconnu' : NK (Not Known)
542     * 'ligne avec canne (...)' : BTF (code utilisé pour des données historique)
543     * - 'Engin EU Corpus' pour le traitment (cf DRE_CORPUS dans tmpsih)
544     * - Engin Métier Ifremer (basé sur la classification FAO, et etendue aux besoins
545     * Ifremer/francais)
546     * Pour ObsMer, la classification utilisée est : FAO
547     * Pour les observations au débarquement, la classification utilisée est : FAO + CNTS (pour
548     * recroiser
549     * avec les déclarations)
550     * @param gearClassificationIn GearClassification
551     */
552    public void setGearClassification(GearClassification gearClassificationIn)
553    {
554        this.gearClassification = gearClassificationIn;
555    }
556
557    private Status status;
558
559    /**
560     * Pour les données du référentiel, information permettant de déterminer si une donnée est
561     * valide,
562     * obsolète ou temporaire.
563     * - obsolète (=inactif) : '0'
564     * - valide (=actif) : '1'
565     * - temporaire : '2'
566     * - en cours de suppression : '3'
567     * -  : '4'
568     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
569     * confondre
570     * avec par exemple l'activité d'un navire sur un mois.
571     * @return this.status Status
572     */
573    public Status getStatus()
574    {
575        return this.status;
576    }
577
578    /**
579     * Pour les données du référentiel, information permettant de déterminer si une donnée est
580     * valide,
581     * obsolète ou temporaire.
582     * - obsolète (=inactif) : '0'
583     * - valide (=actif) : '1'
584     * - temporaire : '2'
585     * - en cours de suppression : '3'
586     * -  : '4'
587     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
588     * confondre
589     * avec par exemple l'activité d'un navire sur un mois.
590     * @param statusIn Status
591     */
592    public void setStatus(Status statusIn)
593    {
594        this.status = statusIn;
595    }
596
597    /**
598     * Returns <code>true</code> if the argument is an Gear instance and all identifiers for this entity
599     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
600     */
601    @Override
602    public boolean equals(Object object)
603    {
604        if (this == object)
605        {
606            return true;
607        }
608        if (!(object instanceof Gear))
609        {
610            return false;
611        }
612        final Gear that = (Gear)object;
613        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
614        {
615            return false;
616        }
617        return true;
618    }
619
620    /**
621     * Returns a hash code based on this entity's identifiers.
622     */
623    @Override
624    public int hashCode()
625    {
626        int hashCode = 0;
627        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
628
629        return hashCode;
630    }
631
632    /**
633     * Constructs new instances of {@link Gear}.
634     */
635    public static final class Factory
636    {
637        /**
638         * Constructs a new instance of {@link Gear}.
639         * @return new GearImpl()
640         */
641        public static Gear newInstance()
642        {
643            return new GearImpl();
644        }
645
646        /**
647         * Constructs a new instance of {@link Gear}, taking all required and/or
648         * read-only properties as arguments, except for identifiers.
649         * @param label String
650         * @param name String
651         * @param updateDate Timestamp
652         * @param validityStatus ValidityStatus
653         * @param gearClassification GearClassification
654         * @param status Status
655         * @return newInstance
656         */
657        public static Gear newInstance(String label, String name, Timestamp updateDate, ValidityStatus validityStatus, GearClassification gearClassification, Status status)
658        {
659            final Gear entity = new GearImpl();
660            entity.setLabel(label);
661            entity.setName(name);
662            entity.setUpdateDate(updateDate);
663            entity.setValidityStatus(validityStatus);
664            entity.setGearClassification(gearClassification);
665            entity.setStatus(status);
666            return entity;
667        }
668
669        /**
670         * Constructs a new instance of {@link Gear}, taking all possible properties
671         * (except the identifier(s))as arguments.
672         * @param label String
673         * @param name String
674         * @param description String
675         * @param updateDate Timestamp
676         * @param comments String
677         * @param parentGear Gear
678         * @param validityStatus ValidityStatus
679         * @param childGears Collection<Gear>
680         * @param gearClassification GearClassification
681         * @param status Status
682         * @return newInstance Gear
683         */
684        public static Gear newInstance(String label, String name, String description, Timestamp updateDate, String comments, Gear parentGear, ValidityStatus validityStatus, Collection<Gear> childGears, GearClassification gearClassification, Status status)
685        {
686            final Gear entity = new GearImpl();
687            entity.setLabel(label);
688            entity.setName(name);
689            entity.setDescription(description);
690            entity.setUpdateDate(updateDate);
691            entity.setComments(comments);
692            entity.setParentGear(parentGear);
693            entity.setValidityStatus(validityStatus);
694            entity.setChildGears(childGears);
695            entity.setGearClassification(gearClassification);
696            entity.setStatus(status);
697            return entity;
698        }
699    }
700
701    /**
702     * @see Comparable#compareTo
703     */
704    public int compareTo(Gear o)
705    {
706        int cmp = 0;
707        if (this.getId() != null)
708        {
709            cmp = this.getId().compareTo(o.getId());
710        }
711        else
712        {
713            if (this.getLabel() != null)
714            {
715                cmp = (cmp != 0 ? cmp : this.getLabel().compareTo(o.getLabel()));
716            }
717            if (this.getName() != null)
718            {
719                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
720            }
721            if (this.getDescription() != null)
722            {
723                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
724            }
725            if (this.getUpdateDate() != null)
726            {
727                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
728            }
729            if (this.getComments() != null)
730            {
731                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
732            }
733        }
734        return cmp;
735    }
736// HibernateEntity.vsl merge-point
737// Gear.java merge-point
738}