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.metier;
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 fr.ifremer.adagio.core.dao.referential.gear.Gear;
034import fr.ifremer.adagio.core.dao.referential.taxon.TaxonGroup;
035import java.io.Serializable;
036import java.sql.Timestamp;
037
038/**
039 * <html>
040 * <head>
041 * </head>
042 * <body>
043 * <p>
044 * M&#233;tier, qui peut etre un m&#233;tier de peche ou non.<br><br>Un
045 * m&#233;tier de peche a obligatoirement une esp&#232;ce cible (TaxonGroup) de
046 * d&#233;fini, et &#233;ventuellement un engin (Gear).
047 * </p>
048 * <p>
049 * Dans ce cas, le nom (name) et le mn&#233;monique (label) pourront etre
050 * d&#233;termin&#233; par la concat&#233;nation de l'engin et de l'esp&#232;ce cible.
051 * </p>
052 * <p>
053 * <br>
054 * <br>
055 * </p>
056 * <p>
057 * <u>V2.1 </u>: modification de la gestion des m&#233;tiers : suppression des
058 * classes FishingMetierGearType et MetierSpecies : un m&#233;tier est
059 * maintenant d&#233;fini directement par Gear et TaxonGroup.<br><br>=&gt; Le
060 * r&#233;f&#233;rentiel des engin du m&#233;tier (FishingMetierGearType) est maintenent
061 * int&#233;gr&#233; au r&#233;f&#233;rentiel g&#233;n&#233;rique des engins<br>
062 * </p>
063 * <p>
064 * </p>
065 * <p>
066 * =&gt; Le r&#233;f&#233;rentiel des esp&#232;ces m&#233;tier (MetierSpecies) est maintenent
067 * int&#233;gr&#233; au r&#233;f&#233;rentiel g&#233;n&#233;rique des groupes de taxon<br><br>
068 * </p>
069 * <p>
070 * <u>V3 </u>:<br>- Le m&#233;tier de peche n'a pas forc&#233;ment d'engin
071 * (optionnel) Ex : AQUNEP
072 * </p>
073 * <p>
074 * (Aquaculture)<br>- le mn&#233;monique et le libell&#233; ne sont plus calcul&#233;s &#224;
075 * la vol&#233;e par concat&#233;nation, pour permettre l'utilisation de libell&#233; plus
076 * court..
077 * </p>
078 * </body>
079 * </html>
080 */
081// HibernateEntity.vsl annotations merge-point
082public abstract class Metier
083    implements Serializable, Comparable<Metier>
084{
085    /**
086     * The serial version UID of this class. Needed for serialization.
087     */
088    private static final long serialVersionUID = -3164458557765948673L;
089
090    // Generate 6 attributes
091    private Integer id;
092
093    /**
094     * Idenfiant interne. Généré par le système.
095     * @return this.id Integer
096     */
097    public Integer getId()
098    {
099        return this.id;
100    }
101
102    /**
103     * Idenfiant interne. Généré par le système.
104     * @param idIn Integer
105     */
106    public void setId(Integer idIn)
107    {
108        this.id = idIn;
109    }
110
111    private String label;
112
113    /**
114     * Pour un métier de peche, le mnémonique est généralement la concaténation du mnémonique de
115     * l'engin et de celui du groupe de taxon (si un le groupe de taxon en a un).
116     * @return this.label String
117     */
118    public String getLabel()
119    {
120        return this.label;
121    }
122
123    /**
124     * Pour un métier de peche, le mnémonique est généralement la concaténation du mnémonique de
125     * l'engin et de celui du groupe de taxon (si un le groupe de taxon en a un).
126     * @param labelIn String
127     */
128    public void setLabel(String labelIn)
129    {
130        this.label = labelIn;
131    }
132
133    private String name;
134
135    /**
136     * Libellé du métier.
137     * Pour un métier de peche, déterminé généralement à partir de la concaténation du libellé de
138     * l'engin, de la chaine " à ", puis du libellé du groupe de taxon.
139     * @return this.name String
140     */
141    public String getName()
142    {
143        return this.name;
144    }
145
146    /**
147     * Libellé du métier.
148     * Pour un métier de peche, déterminé généralement à partir de la concaténation du libellé de
149     * l'engin, de la chaine " à ", puis du libellé du groupe de taxon.
150     * @param nameIn String
151     */
152    public void setName(String nameIn)
153    {
154        this.name = nameIn;
155    }
156
157    private String description;
158
159    /**
160     * Description longue du métier
161     * @return this.description String
162     */
163    public String getDescription()
164    {
165        return this.description;
166    }
167
168    /**
169     * Description longue du métier
170     * @param descriptionIn String
171     */
172    public void setDescription(String descriptionIn)
173    {
174        this.description = descriptionIn;
175    }
176
177    private String comments;
178
179    /**
180     * 
181     * @return this.comments String
182     */
183    public String getComments()
184    {
185        return this.comments;
186    }
187
188    /**
189     * 
190     * @param commentsIn String
191     */
192    public void setComments(String commentsIn)
193    {
194        this.comments = commentsIn;
195    }
196
197    private Timestamp updateDate;
198
199    /**
200     * 
201     * @return this.updateDate Timestamp
202     */
203    public Timestamp getUpdateDate()
204    {
205        return this.updateDate;
206    }
207
208    /**
209     * 
210     * @param updateDateIn Timestamp
211     */
212    public void setUpdateDate(Timestamp updateDateIn)
213    {
214        this.updateDate = updateDateIn;
215    }
216
217    // Generate 10 associations
218    private ValidityStatus validityStatus;
219
220    /**
221     * Etat de validation d'une donnée du référentiel. Utile pour les responsables de référentiel.
222     * Validity status of a referential data.
223     * @return this.validityStatus ValidityStatus
224     */
225    public ValidityStatus getValidityStatus()
226    {
227        return this.validityStatus;
228    }
229
230    /**
231     * Etat de validation d'une donnée du référentiel. Utile pour les responsables de référentiel.
232     * Validity status of a referential data.
233     * @param validityStatusIn ValidityStatus
234     */
235    public void setValidityStatus(ValidityStatus validityStatusIn)
236    {
237        this.validityStatus = validityStatusIn;
238    }
239
240    private Gear gear;
241
242    /**
243     * Engin du métier.
244     * Obligatoire si le métier est un métier de peche.
245     * @return this.gear Gear
246     */
247    public Gear getGear()
248    {
249        return this.gear;
250    }
251
252    /**
253     * Engin du métier.
254     * Obligatoire si le métier est un métier de peche.
255     * @param gearIn Gear
256     */
257    public void setGear(Gear gearIn)
258    {
259        this.gear = gearIn;
260    }
261
262    private TaxonGroup taxonGroup;
263
264    /**
265     * Uniquement les groupes de taxon de type "espece commerciale FAO".
266     * Obligatoire si le métier est un métier de peche.
267     * @return this.taxonGroup TaxonGroup
268     */
269    public TaxonGroup getTaxonGroup()
270    {
271        return this.taxonGroup;
272    }
273
274    /**
275     * Uniquement les groupes de taxon de type "espece commerciale FAO".
276     * Obligatoire si le métier est un métier de peche.
277     * @param taxonGroupIn TaxonGroup
278     */
279    public void setTaxonGroup(TaxonGroup taxonGroupIn)
280    {
281        this.taxonGroup = taxonGroupIn;
282    }
283
284    private Status status;
285
286    /**
287     * Pour les données du référentiel, information permettant de déterminer si une donnée est
288     * valide,
289     * obsolète ou temporaire.
290     * - obsolète (=inactif) : '0'
291     * - valide (=actif) : '1'
292     * - temporaire : '2'
293     * - en cours de suppression : '3'
294     * -  : '4'
295     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
296     * confondre
297     * avec par exemple l'activité d'un navire sur un mois.
298     * @return this.status Status
299     */
300    public Status getStatus()
301    {
302        return this.status;
303    }
304
305    /**
306     * Pour les données du référentiel, information permettant de déterminer si une donnée est
307     * valide,
308     * obsolète ou temporaire.
309     * - obsolète (=inactif) : '0'
310     * - valide (=actif) : '1'
311     * - temporaire : '2'
312     * - en cours de suppression : '3'
313     * -  : '4'
314     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
315     * confondre
316     * avec par exemple l'activité d'un navire sur un mois.
317     * @param statusIn Status
318     */
319    public void setStatus(Status statusIn)
320    {
321        this.status = statusIn;
322    }
323
324    /**
325     * Returns <code>true</code> if the argument is an Metier instance and all identifiers for this entity
326     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
327     */
328    @Override
329    public boolean equals(Object object)
330    {
331        if (this == object)
332        {
333            return true;
334        }
335        if (!(object instanceof Metier))
336        {
337            return false;
338        }
339        final Metier that = (Metier)object;
340        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
341        {
342            return false;
343        }
344        return true;
345    }
346
347    /**
348     * Returns a hash code based on this entity's identifiers.
349     */
350    @Override
351    public int hashCode()
352    {
353        int hashCode = 0;
354        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
355
356        return hashCode;
357    }
358
359    /**
360     * Constructs new instances of {@link Metier}.
361     */
362    public static final class Factory
363    {
364        /**
365         * Constructs a new instance of {@link Metier}.
366         * @return new MetierImpl()
367         */
368        public static Metier newInstance()
369        {
370            return new MetierImpl();
371        }
372
373        /**
374         * Constructs a new instance of {@link Metier}, taking all required and/or
375         * read-only properties as arguments, except for identifiers.
376         * @param name String
377         * @param updateDate Timestamp
378         * @param validityStatus ValidityStatus
379         * @param status Status
380         * @return newInstance
381         */
382        public static Metier newInstance(String name, Timestamp updateDate, ValidityStatus validityStatus, Status status)
383        {
384            final Metier entity = new MetierImpl();
385            entity.setName(name);
386            entity.setUpdateDate(updateDate);
387            entity.setValidityStatus(validityStatus);
388            entity.setStatus(status);
389            return entity;
390        }
391
392        /**
393         * Constructs a new instance of {@link Metier}, taking all possible properties
394         * (except the identifier(s))as arguments.
395         * @param label String
396         * @param name String
397         * @param description String
398         * @param comments String
399         * @param updateDate Timestamp
400         * @param validityStatus ValidityStatus
401         * @param gear Gear
402         * @param taxonGroup TaxonGroup
403         * @param status Status
404         * @return newInstance Metier
405         */
406        public static Metier newInstance(String label, String name, String description, String comments, Timestamp updateDate, ValidityStatus validityStatus, Gear gear, TaxonGroup taxonGroup, Status status)
407        {
408            final Metier entity = new MetierImpl();
409            entity.setLabel(label);
410            entity.setName(name);
411            entity.setDescription(description);
412            entity.setComments(comments);
413            entity.setUpdateDate(updateDate);
414            entity.setValidityStatus(validityStatus);
415            entity.setGear(gear);
416            entity.setTaxonGroup(taxonGroup);
417            entity.setStatus(status);
418            return entity;
419        }
420    }
421
422    /**
423     * @see Comparable#compareTo
424     */
425    public int compareTo(Metier o)
426    {
427        int cmp = 0;
428        if (this.getId() != null)
429        {
430            cmp = this.getId().compareTo(o.getId());
431        }
432        else
433        {
434            if (this.getLabel() != null)
435            {
436                cmp = (cmp != 0 ? cmp : this.getLabel().compareTo(o.getLabel()));
437            }
438            if (this.getName() != null)
439            {
440                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
441            }
442            if (this.getDescription() != null)
443            {
444                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
445            }
446            if (this.getComments() != null)
447            {
448                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
449            }
450            if (this.getUpdateDate() != null)
451            {
452                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
453            }
454        }
455        return cmp;
456    }
457// HibernateEntity.vsl merge-point
458// Metier.java merge-point
459}