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 java.io.Serializable;
032import java.sql.Timestamp;
033import java.util.Collection;
034import java.util.HashSet;
035
036/**
037 * Une classification d'engin permet le regroupement d'un ensemble cohérent d'engin.
038 * Exemple :
039 * - Engin FAO, appellée aussi CSITEP (Classification Standard Internationale Type des Engins de
040 * Pêche), ou, en anglais : International Standard Statistical Classification of Fishing Gear
041 * (ISSCFG) : ftp://ftp.fao.org/FI/DOCUMENT/cwp/handbook/annex/AnnexM1fishinggear.pdf
042 * - Engin CNTS (DPMA SIP)
043 * - Engin EU (basé sur les engins FAO, mais adapté au contexte réglementaire européen) :
044 * exemple :    - extension pour signifier 'pas d'engin' : NO
045 * extension pour signifier 'engin inconnu' : NK (Not Known)
046 * 'ligne avec canne (...)' : BTF (code utilisé pour des données historique)
047 * - 'Engin EU Corpus' pour le traitment (cf DRE_CORPUS dans tmpsih)
048 * - Engin Métier Ifremer (basé sur la classification FAO, et etendue aux besoins Ifremer/francais)
049 * Pour ObsMer, la classification utilisée est : FAO
050 * Pour les observations au débarquement, la classification utilisée est : FAO + CNTS (pour
051 * recroiser avec les déclarations)
052 */
053// HibernateEntity.vsl annotations merge-point
054public abstract class GearClassification
055    implements Serializable, Comparable<GearClassification>
056{
057    /**
058     * The serial version UID of this class. Needed for serialization.
059     */
060    private static final long serialVersionUID = 7403188940952848904L;
061
062    // Generate 6 attributes
063    private Integer id;
064
065    /**
066     * 
067     * @return this.id Integer
068     */
069    public Integer getId()
070    {
071        return this.id;
072    }
073
074    /**
075     * 
076     * @param idIn Integer
077     */
078    public void setId(Integer idIn)
079    {
080        this.id = idIn;
081    }
082
083    private String name;
084
085    /**
086     * 
087     * @return this.name String
088     */
089    public String getName()
090    {
091        return this.name;
092    }
093
094    /**
095     * 
096     * @param nameIn String
097     */
098    public void setName(String nameIn)
099    {
100        this.name = nameIn;
101    }
102
103    private String description;
104
105    /**
106     * 
107     * @return this.description String
108     */
109    public String getDescription()
110    {
111        return this.description;
112    }
113
114    /**
115     * 
116     * @param descriptionIn String
117     */
118    public void setDescription(String descriptionIn)
119    {
120        this.description = descriptionIn;
121    }
122
123    private Boolean isAggregation = Boolean.valueOf(false);
124
125    /**
126     * <html>
127     * <head>
128     * </head>
129     * <body>
130     * <p>
131     * TODO : confirmer si l'attribut est utile
132     * </p>
133     * <p>
134     * , dans la mesure ou les strat&#233;gies peuvent permettrent de choisir la
135     * classification &#224; utiliser.<br>
136     * </p>
137     * <p>
138     * Indicateur permettant de savoir si la classification est utilis&#233;
139     * uniquement dans le cadre de donn&#233;es d'agr&#233;gation.
140     * </p>
141     * </body>
142     * </html>
143     * @return this.isAggregation Boolean
144     */
145    public Boolean isIsAggregation()
146    {
147        return this.isAggregation;
148    }
149
150    /**
151     * <html>
152     * <head>
153     * </head>
154     * <body>
155     * <p>
156     * TODO : confirmer si l'attribut est utile
157     * </p>
158     * <p>
159     * , dans la mesure ou les strat&#233;gies peuvent permettrent de choisir la
160     * classification &#224; utiliser.<br>
161     * </p>
162     * <p>
163     * Indicateur permettant de savoir si la classification est utilis&#233;
164     * uniquement dans le cadre de donn&#233;es d'agr&#233;gation.
165     * </p>
166     * </body>
167     * </html>
168     * @param isAggregationIn Boolean
169     */
170    public void setIsAggregation(Boolean isAggregationIn)
171    {
172        this.isAggregation = isAggregationIn;
173    }
174
175    private Timestamp updateDate;
176
177    /**
178     * 
179     * @return this.updateDate Timestamp
180     */
181    public Timestamp getUpdateDate()
182    {
183        return this.updateDate;
184    }
185
186    /**
187     * 
188     * @param updateDateIn Timestamp
189     */
190    public void setUpdateDate(Timestamp updateDateIn)
191    {
192        this.updateDate = updateDateIn;
193    }
194
195    private String comments;
196
197    /**
198     * 
199     * @return this.comments String
200     */
201    public String getComments()
202    {
203        return this.comments;
204    }
205
206    /**
207     * 
208     * @param commentsIn String
209     */
210    public void setComments(String commentsIn)
211    {
212        this.comments = commentsIn;
213    }
214
215    // Generate 4 associations
216    private Collection<Gear> gears = new HashSet<Gear>();
217
218    /**
219     * <html>
220     * <head>
221     * </head>
222     * <body>
223     * <p>
224     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
225     * </p>
226     * <p>
227     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
228     * classification, via les liens d'engin parents/enfants.
229     * </p>
230     * <p>
231     * <br>
232     * </p>
233     * <p>
234     * Exemple, pour la classification 'Engin EU corpus' :
235     * </p>
236     * <p>
237     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
238     * </p>
239     * <p>
240     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
241     * </p>
242     * <p>
243     * * corpus 2 (...)<br>- ...
244     * </p>
245     * <p>
246     * <br>
247     * </p>
248     * <p>
249     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
250     * '03.0.0')<br>
251     * </p>
252     * <p>
253     * - 'OTB' 'chalut de fond'<br>
254     * </p>
255     * <p>
256     * - chalut p&#233;lagique
257     * </p>
258     * <p>
259     * - ...<br>* 'Filets'
260     * </p>
261     * </body>
262     * </html>
263     * @return this.gears Collection<Gear>
264     */
265    public Collection<Gear> getGears()
266    {
267        return this.gears;
268    }
269
270    /**
271     * <html>
272     * <head>
273     * </head>
274     * <body>
275     * <p>
276     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
277     * </p>
278     * <p>
279     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
280     * classification, via les liens d'engin parents/enfants.
281     * </p>
282     * <p>
283     * <br>
284     * </p>
285     * <p>
286     * Exemple, pour la classification 'Engin EU corpus' :
287     * </p>
288     * <p>
289     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
290     * </p>
291     * <p>
292     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
293     * </p>
294     * <p>
295     * * corpus 2 (...)<br>- ...
296     * </p>
297     * <p>
298     * <br>
299     * </p>
300     * <p>
301     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
302     * '03.0.0')<br>
303     * </p>
304     * <p>
305     * - 'OTB' 'chalut de fond'<br>
306     * </p>
307     * <p>
308     * - chalut p&#233;lagique
309     * </p>
310     * <p>
311     * - ...<br>* 'Filets'
312     * </p>
313     * </body>
314     * </html>
315     * @param gearsIn Collection<Gear>
316     */
317    public void setGears(Collection<Gear> gearsIn)
318    {
319        this.gears = gearsIn;
320    }
321
322    /**
323     * <html>
324     * <head>
325     * </head>
326     * <body>
327     * <p>
328     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
329     * </p>
330     * <p>
331     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
332     * classification, via les liens d'engin parents/enfants.
333     * </p>
334     * <p>
335     * <br>
336     * </p>
337     * <p>
338     * Exemple, pour la classification 'Engin EU corpus' :
339     * </p>
340     * <p>
341     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
342     * </p>
343     * <p>
344     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
345     * </p>
346     * <p>
347     * * corpus 2 (...)<br>- ...
348     * </p>
349     * <p>
350     * <br>
351     * </p>
352     * <p>
353     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
354     * '03.0.0')<br>
355     * </p>
356     * <p>
357     * - 'OTB' 'chalut de fond'<br>
358     * </p>
359     * <p>
360     * - chalut p&#233;lagique
361     * </p>
362     * <p>
363     * - ...<br>* 'Filets'
364     * </p>
365     * </body>
366     * </html>
367     * @param elementToAdd Gear
368     * @return <tt>true</tt> if this collection changed as a result of the
369     *         call
370     */
371    public boolean addGears(Gear elementToAdd)
372    {
373        return this.gears.add(elementToAdd);
374    }
375
376    /**
377     * <html>
378     * <head>
379     * </head>
380     * <body>
381     * <p>
382     * D&#233;fini un engin, non pas engin physique, mais au sens &quot;classe d'engin&quot;.
383     * </p>
384     * <p>
385     * Il est possible de d&#233;finir un arboresence d'engin, au sein d'une meme
386     * classification, via les liens d'engin parents/enfants.
387     * </p>
388     * <p>
389     * <br>
390     * </p>
391     * <p>
392     * Exemple, pour la classification 'Engin EU corpus' :
393     * </p>
394     * <p>
395     * * 'corpus effort de p&#234;che'<br>- PAL Palangre de surface (Longliner)<br>
396     * </p>
397     * <p>
398     * - EP1 Engins petits p&#233;lagiques - corpus r&#233;glementaire 685/95
399     * </p>
400     * <p>
401     * * corpus 2 (...)<br>- ...
402     * </p>
403     * <p>
404     * <br>
405     * </p>
406     * <p>
407     * Exemple, pour la classification 'FAO/CISTEP' :<br>* 'chaluts' (code
408     * '03.0.0')<br>
409     * </p>
410     * <p>
411     * - 'OTB' 'chalut de fond'<br>
412     * </p>
413     * <p>
414     * - chalut p&#233;lagique
415     * </p>
416     * <p>
417     * - ...<br>* 'Filets'
418     * </p>
419     * </body>
420     * </html>
421     * @param elementToRemove Gear
422     * @return <tt>true</tt> if this collection changed as a result of the
423     *         call
424     */
425    public boolean removeGears(Gear elementToRemove)
426    {
427        return this.gears.remove(elementToRemove);
428    }
429
430    /**
431     * Returns <code>true</code> if the argument is an GearClassification instance and all identifiers for this entity
432     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
433     */
434    @Override
435    public boolean equals(Object object)
436    {
437        if (this == object)
438        {
439            return true;
440        }
441        if (!(object instanceof GearClassification))
442        {
443            return false;
444        }
445        final GearClassification that = (GearClassification)object;
446        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
447        {
448            return false;
449        }
450        return true;
451    }
452
453    /**
454     * Returns a hash code based on this entity's identifiers.
455     */
456    @Override
457    public int hashCode()
458    {
459        int hashCode = 0;
460        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
461
462        return hashCode;
463    }
464
465    /**
466     * Constructs new instances of {@link GearClassification}.
467     */
468    public static final class Factory
469    {
470        /**
471         * Constructs a new instance of {@link GearClassification}.
472         * @return new GearClassificationImpl()
473         */
474        public static GearClassification newInstance()
475        {
476            return new GearClassificationImpl();
477        }
478
479        /**
480         * Constructs a new instance of {@link GearClassification}, taking all required and/or
481         * read-only properties as arguments, except for identifiers.
482         * @param name String
483         * @param isAggregation Boolean
484         * @param updateDate Timestamp
485         * @return newInstance
486         */
487        public static GearClassification newInstance(String name, Boolean isAggregation, Timestamp updateDate)
488        {
489            final GearClassification entity = new GearClassificationImpl();
490            entity.setName(name);
491            entity.setIsAggregation(isAggregation);
492            entity.setUpdateDate(updateDate);
493            return entity;
494        }
495
496        /**
497         * Constructs a new instance of {@link GearClassification}, taking all possible properties
498         * (except the identifier(s))as arguments.
499         * @param name String
500         * @param description String
501         * @param isAggregation Boolean
502         * @param updateDate Timestamp
503         * @param comments String
504         * @param gears Collection<Gear>
505         * @return newInstance GearClassification
506         */
507        public static GearClassification newInstance(String name, String description, Boolean isAggregation, Timestamp updateDate, String comments, Collection<Gear> gears)
508        {
509            final GearClassification entity = new GearClassificationImpl();
510            entity.setName(name);
511            entity.setDescription(description);
512            entity.setIsAggregation(isAggregation);
513            entity.setUpdateDate(updateDate);
514            entity.setComments(comments);
515            entity.setGears(gears);
516            return entity;
517        }
518    }
519
520    /**
521     * @see Comparable#compareTo
522     */
523    public int compareTo(GearClassification o)
524    {
525        int cmp = 0;
526        if (this.getId() != null)
527        {
528            cmp = this.getId().compareTo(o.getId());
529        }
530        else
531        {
532            if (this.getName() != null)
533            {
534                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
535            }
536            if (this.getDescription() != null)
537            {
538                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
539            }
540            if (this.isIsAggregation() != null)
541            {
542                cmp = (cmp != 0 ? cmp : this.isIsAggregation().compareTo(o.isIsAggregation()));
543            }
544            if (this.getUpdateDate() != null)
545            {
546                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
547            }
548            if (this.getComments() != null)
549            {
550                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
551            }
552        }
553        return cmp;
554    }
555// HibernateEntity.vsl merge-point
556// GearClassification.java merge-point
557}