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.pmfm;
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 java.io.Serializable;
033import java.sql.Timestamp;
034import java.util.Collection;
035import java.util.Date;
036import java.util.HashSet;
037
038/**
039 * Une fraction analysée est un composant du support sur lequel porte l'analyse.
040 * Les fractions analysées sont généralement des fractions "organiques", au sens d'une
041 * classification par partie d'un même organisme,
042 * ex : foie, écaille, reins, dents, otolithe...
043 * Elles peuvent aussi être un sous ensemble quelconque du support. Par exemple, dans le cas des
044 * engins : le bras, …
045 * Les fractions dites "systématiques", au sens d'une classification systématique (ex : poisson :
046 * Cyprinidae / Cyprinus / Cyprinus carpio...) ne sont pas considérées comme des fractions au sens
047 * de l'entité, mais comme une précision apportée sur l'individu. Représentées par les entités
048 * "taxon" et "groupe de taxon", elles ne font pas partie de la liste des fractions analysées.
049 * Etant une liste de référence, une procédure stricte pour la création de nouvelles fractions
050 * analysées pourra être mise en place (On pourra s'inspirer des procédures utilisées dans
051 * Quadrige2, qui utilisent le référentiel national du SANDRE).
052 * Nombre de lignes : 10
053 */
054// HibernateEntity.vsl annotations merge-point
055public abstract class Fraction
056    implements Serializable, Comparable<Fraction>
057{
058    /**
059     * The serial version UID of this class. Needed for serialization.
060     */
061    private static final long serialVersionUID = 4926786808051558217L;
062
063    // Generate 6 attributes
064    private Integer id;
065
066    /**
067     * Identifiant unique de la fraction. Généré par le système.
068     * @return this.id Integer
069     */
070    public Integer getId()
071    {
072        return this.id;
073    }
074
075    /**
076     * Identifiant unique de la fraction. Généré par le système.
077     * @param idIn Integer
078     */
079    public void setId(Integer idIn)
080    {
081        this.id = idIn;
082    }
083
084    private String name;
085
086    /**
087     * Description courte de la fraction.
088     * @return this.name String
089     */
090    public String getName()
091    {
092        return this.name;
093    }
094
095    /**
096     * Description courte de la fraction.
097     * @param nameIn String
098     */
099    public void setName(String nameIn)
100    {
101        this.name = nameIn;
102    }
103
104    private String description;
105
106    /**
107     * Description longue de la fraction.
108     * @return this.description String
109     */
110    public String getDescription()
111    {
112        return this.description;
113    }
114
115    /**
116     * Description longue de la fraction.
117     * @param descriptionIn String
118     */
119    public void setDescription(String descriptionIn)
120    {
121        this.description = descriptionIn;
122    }
123
124    private Date creationDate;
125
126    /**
127     * 
128     * @return this.creationDate Date
129     */
130    public Date getCreationDate()
131    {
132        return this.creationDate;
133    }
134
135    /**
136     * 
137     * @param creationDateIn Date
138     */
139    public void setCreationDate(Date creationDateIn)
140    {
141        this.creationDate = creationDateIn;
142    }
143
144    private String comments;
145
146    /**
147     * 
148     * @return this.comments String
149     */
150    public String getComments()
151    {
152        return this.comments;
153    }
154
155    /**
156     * 
157     * @param commentsIn String
158     */
159    public void setComments(String commentsIn)
160    {
161        this.comments = commentsIn;
162    }
163
164    private Timestamp updateDate;
165
166    /**
167     * 
168     * @return this.updateDate Timestamp
169     */
170    public Timestamp getUpdateDate()
171    {
172        return this.updateDate;
173    }
174
175    /**
176     * 
177     * @param updateDateIn Timestamp
178     */
179    public void setUpdateDate(Timestamp updateDateIn)
180    {
181        this.updateDate = updateDateIn;
182    }
183
184    // Generate 3 associations
185    private Collection<Matrix> matrixes = new HashSet<Matrix>();
186
187    /**
188     * Le support est un composant du milieu sur lequel porte l'investigation. Les supports sont,
189     * par
190     * exemple :
191     * - un engin,
192     * - la mer (ou autre environnement),
193     * - bivalve (moule, huître, coque...)
194     * - crustacé (crevette...)
195     * - poisson (merlu, sardine...)
196     * - gastéropode (bigorneau, littorine...)
197     * - echinoderme    (oursin...)
198     * - masse d'eau, eau brute
199     * - eau filtrée
200     * - ...
201     * Le support ne correspond pas au support réellement analysé. En effet, il peut s'agir d'une
202     * analyse
203     * sur une fraction du support (par exemple, pour le poisson, l'otolite,… ou pour un engin, le
204     * bras).
205     * Nombre de lignes : 20
206     * @return this.matrixes Collection<Matrix>
207     */
208    public Collection<Matrix> getMatrixes()
209    {
210        return this.matrixes;
211    }
212
213    /**
214     * Le support est un composant du milieu sur lequel porte l'investigation. Les supports sont,
215     * par
216     * exemple :
217     * - un engin,
218     * - la mer (ou autre environnement),
219     * - bivalve (moule, huître, coque...)
220     * - crustacé (crevette...)
221     * - poisson (merlu, sardine...)
222     * - gastéropode (bigorneau, littorine...)
223     * - echinoderme    (oursin...)
224     * - masse d'eau, eau brute
225     * - eau filtrée
226     * - ...
227     * Le support ne correspond pas au support réellement analysé. En effet, il peut s'agir d'une
228     * analyse
229     * sur une fraction du support (par exemple, pour le poisson, l'otolite,… ou pour un engin, le
230     * bras).
231     * Nombre de lignes : 20
232     * @param matrixesIn Collection<Matrix>
233     */
234    public void setMatrixes(Collection<Matrix> matrixesIn)
235    {
236        this.matrixes = matrixesIn;
237    }
238
239    /**
240     * Le support est un composant du milieu sur lequel porte l'investigation. Les supports sont,
241     * par
242     * exemple :
243     * - un engin,
244     * - la mer (ou autre environnement),
245     * - bivalve (moule, huître, coque...)
246     * - crustacé (crevette...)
247     * - poisson (merlu, sardine...)
248     * - gastéropode (bigorneau, littorine...)
249     * - echinoderme    (oursin...)
250     * - masse d'eau, eau brute
251     * - eau filtrée
252     * - ...
253     * Le support ne correspond pas au support réellement analysé. En effet, il peut s'agir d'une
254     * analyse
255     * sur une fraction du support (par exemple, pour le poisson, l'otolite,… ou pour un engin, le
256     * bras).
257     * Nombre de lignes : 20
258     * @param elementToAdd Matrix
259     * @return <tt>true</tt> if this collection changed as a result of the
260     *         call
261     */
262    public boolean addMatrixes(Matrix elementToAdd)
263    {
264        return this.matrixes.add(elementToAdd);
265    }
266
267    /**
268     * Le support est un composant du milieu sur lequel porte l'investigation. Les supports sont,
269     * par
270     * exemple :
271     * - un engin,
272     * - la mer (ou autre environnement),
273     * - bivalve (moule, huître, coque...)
274     * - crustacé (crevette...)
275     * - poisson (merlu, sardine...)
276     * - gastéropode (bigorneau, littorine...)
277     * - echinoderme    (oursin...)
278     * - masse d'eau, eau brute
279     * - eau filtrée
280     * - ...
281     * Le support ne correspond pas au support réellement analysé. En effet, il peut s'agir d'une
282     * analyse
283     * sur une fraction du support (par exemple, pour le poisson, l'otolite,… ou pour un engin, le
284     * bras).
285     * Nombre de lignes : 20
286     * @param elementToRemove Matrix
287     * @return <tt>true</tt> if this collection changed as a result of the
288     *         call
289     */
290    public boolean removeMatrixes(Matrix elementToRemove)
291    {
292        return this.matrixes.remove(elementToRemove);
293    }
294
295    private Status status;
296
297    /**
298     * Pour les données du référentiel, information permettant de déterminer si une donnée est
299     * valide,
300     * obsolète ou temporaire.
301     * - obsolète (=inactif) : '0'
302     * - valide (=actif) : '1'
303     * - temporaire : '2'
304     * - en cours de suppression : '3'
305     * -  : '4'
306     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
307     * confondre
308     * avec par exemple l'activité d'un navire sur un mois.
309     * @return this.status Status
310     */
311    public Status getStatus()
312    {
313        return this.status;
314    }
315
316    /**
317     * Pour les données du référentiel, information permettant de déterminer si une donnée est
318     * valide,
319     * obsolète ou temporaire.
320     * - obsolète (=inactif) : '0'
321     * - valide (=actif) : '1'
322     * - temporaire : '2'
323     * - en cours de suppression : '3'
324     * -  : '4'
325     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
326     * confondre
327     * avec par exemple l'activité d'un navire sur un mois.
328     * @param statusIn Status
329     */
330    public void setStatus(Status statusIn)
331    {
332        this.status = statusIn;
333    }
334
335    /**
336     * Returns <code>true</code> if the argument is an Fraction instance and all identifiers for this entity
337     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
338     */
339    @Override
340    public boolean equals(Object object)
341    {
342        if (this == object)
343        {
344            return true;
345        }
346        if (!(object instanceof Fraction))
347        {
348            return false;
349        }
350        final Fraction that = (Fraction)object;
351        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
352        {
353            return false;
354        }
355        return true;
356    }
357
358    /**
359     * Returns a hash code based on this entity's identifiers.
360     */
361    @Override
362    public int hashCode()
363    {
364        int hashCode = 0;
365        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
366
367        return hashCode;
368    }
369
370    /**
371     * Constructs new instances of {@link Fraction}.
372     */
373    public static final class Factory
374    {
375        /**
376         * Constructs a new instance of {@link Fraction}.
377         * @return new FractionImpl()
378         */
379        public static Fraction newInstance()
380        {
381            return new FractionImpl();
382        }
383
384        /**
385         * Constructs a new instance of {@link Fraction}, taking all required and/or
386         * read-only properties as arguments, except for identifiers.
387         * @param name String
388         * @param creationDate Date
389         * @param updateDate Timestamp
390         * @param status Status
391         * @return newInstance
392         */
393        public static Fraction newInstance(String name, Date creationDate, Timestamp updateDate, Status status)
394        {
395            final Fraction entity = new FractionImpl();
396            entity.setName(name);
397            entity.setCreationDate(creationDate);
398            entity.setUpdateDate(updateDate);
399            entity.setStatus(status);
400            return entity;
401        }
402
403        /**
404         * Constructs a new instance of {@link Fraction}, taking all possible properties
405         * (except the identifier(s))as arguments.
406         * @param name String
407         * @param description String
408         * @param creationDate Date
409         * @param comments String
410         * @param updateDate Timestamp
411         * @param matrixes Collection<Matrix>
412         * @param status Status
413         * @return newInstance Fraction
414         */
415        public static Fraction newInstance(String name, String description, Date creationDate, String comments, Timestamp updateDate, Collection<Matrix> matrixes, Status status)
416        {
417            final Fraction entity = new FractionImpl();
418            entity.setName(name);
419            entity.setDescription(description);
420            entity.setCreationDate(creationDate);
421            entity.setComments(comments);
422            entity.setUpdateDate(updateDate);
423            entity.setMatrixes(matrixes);
424            entity.setStatus(status);
425            return entity;
426        }
427    }
428
429    /**
430     * @see Comparable#compareTo
431     */
432    public int compareTo(Fraction o)
433    {
434        int cmp = 0;
435        if (this.getId() != null)
436        {
437            cmp = this.getId().compareTo(o.getId());
438        }
439        else
440        {
441            if (this.getName() != null)
442            {
443                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
444            }
445            if (this.getDescription() != null)
446            {
447                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
448            }
449            if (this.getCreationDate() != null)
450            {
451                cmp = (cmp != 0 ? cmp : this.getCreationDate().compareTo(o.getCreationDate()));
452            }
453            if (this.getComments() != null)
454            {
455                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
456            }
457            if (this.getUpdateDate() != null)
458            {
459                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
460            }
461        }
462        return cmp;
463    }
464// HibernateEntity.vsl merge-point
465// Fraction.java merge-point
466}