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.taxon;
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.Date;
035
036/**
037 * Deux éléments sont à distinguer dans l'autorité de classification d’un taxon :
038 * - La publication qui fait état de la description et de la nomenclature du taxon.
039 * - La citation, associée au nom du taxon, pour faire référence à la publication d'origine du
040 * taxon. Les règles de nomenclature des taxons et de leurs auteurs sont définies dans The
041 * International Code of Zoological Nomenclature (ICZN : http://www.iczn.org/iczn/index.jsp ) pour
042 * la faune, et dans The International Code of Botanical Nomenclature (ICBN :
043 * http://www.bgbm.fu-berlin.de/iapt/nomenclature/CODE/SaintLouis/0000St.Luistitle.htm) pour la
044 * flore.
045 * Chaque taxon ne possède qu'une seule publication, et une seule citation. Une publication peut
046 * correspondre à plusieurs taxons, et une citation peut être identique pour plusieurs taxons.
047 */
048// HibernateEntity.vsl annotations merge-point
049public abstract class Citation
050    implements Serializable, Comparable<Citation>
051{
052    /**
053     * The serial version UID of this class. Needed for serialization.
054     */
055    private static final long serialVersionUID = -1396517268586088144L;
056
057    // Generate 4 attributes
058    private Integer id;
059
060    /**
061     * Identifiant unique de la citation.Généré par le système.
062     * @return this.id Integer
063     */
064    public Integer getId()
065    {
066        return this.id;
067    }
068
069    /**
070     * Identifiant unique de la citation.Généré par le système.
071     * @param idIn Integer
072     */
073    public void setId(Integer idIn)
074    {
075        this.id = idIn;
076    }
077
078    private String name;
079
080    /**
081     * Libellé de la citation. Elle comprend toujours au moins un auteur et une date.
082     * @return this.name String
083     */
084    public String getName()
085    {
086        return this.name;
087    }
088
089    /**
090     * Libellé de la citation. Elle comprend toujours au moins un auteur et une date.
091     * @param nameIn String
092     */
093    public void setName(String nameIn)
094    {
095        this.name = nameIn;
096    }
097
098    private Date creationDate;
099
100    /**
101     * Date de création de la citation. Renseigné automatiquement par le système.
102     * @return this.creationDate Date
103     */
104    public Date getCreationDate()
105    {
106        return this.creationDate;
107    }
108
109    /**
110     * Date de création de la citation. Renseigné automatiquement par le système.
111     * @param creationDateIn Date
112     */
113    public void setCreationDate(Date creationDateIn)
114    {
115        this.creationDate = creationDateIn;
116    }
117
118    private Timestamp updateDate;
119
120    /**
121     * Date de mise à jour de la citation. Renseigné automatiquement par le système.
122     * @return this.updateDate Timestamp
123     */
124    public Timestamp getUpdateDate()
125    {
126        return this.updateDate;
127    }
128
129    /**
130     * Date de mise à jour de la citation. Renseigné automatiquement par le système.
131     * @param updateDateIn Timestamp
132     */
133    public void setUpdateDate(Timestamp updateDateIn)
134    {
135        this.updateDate = updateDateIn;
136    }
137
138    // Generate 3 associations
139    private Status status;
140
141    /**
142     * Pour les données du référentiel, information permettant de déterminer si une donnée est
143     * valide,
144     * obsolète ou temporaire.
145     * - obsolète (=inactif) : '0'
146     * - valide (=actif) : '1'
147     * - temporaire : '2'
148     * - en cours de suppression : '3'
149     * -  : '4'
150     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
151     * confondre
152     * avec par exemple l'activité d'un navire sur un mois.
153     * @return this.status Status
154     */
155    public Status getStatus()
156    {
157        return this.status;
158    }
159
160    /**
161     * Pour les données du référentiel, information permettant de déterminer si une donnée est
162     * valide,
163     * obsolète ou temporaire.
164     * - obsolète (=inactif) : '0'
165     * - valide (=actif) : '1'
166     * - temporaire : '2'
167     * - en cours de suppression : '3'
168     * -  : '4'
169     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
170     * confondre
171     * avec par exemple l'activité d'un navire sur un mois.
172     * @param statusIn Status
173     */
174    public void setStatus(Status statusIn)
175    {
176        this.status = statusIn;
177    }
178
179    /**
180     * Returns <code>true</code> if the argument is an Citation instance and all identifiers for this entity
181     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
182     */
183    @Override
184    public boolean equals(Object object)
185    {
186        if (this == object)
187        {
188            return true;
189        }
190        if (!(object instanceof Citation))
191        {
192            return false;
193        }
194        final Citation that = (Citation)object;
195        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
196        {
197            return false;
198        }
199        return true;
200    }
201
202    /**
203     * Returns a hash code based on this entity's identifiers.
204     */
205    @Override
206    public int hashCode()
207    {
208        int hashCode = 0;
209        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
210
211        return hashCode;
212    }
213
214    /**
215     * Constructs new instances of {@link Citation}.
216     */
217    public static final class Factory
218    {
219        /**
220         * Constructs a new instance of {@link Citation}.
221         * @return new CitationImpl()
222         */
223        public static Citation newInstance()
224        {
225            return new CitationImpl();
226        }
227
228
229        /**
230         * Constructs a new instance of {@link Citation}, taking all possible properties
231         * (except the identifier(s))as arguments.
232         * @param name String
233         * @param creationDate Date
234         * @param updateDate Timestamp
235         * @param status Status
236         * @return newInstance Citation
237         */
238        public static Citation newInstance(String name, Date creationDate, Timestamp updateDate, Status status)
239        {
240            final Citation entity = new CitationImpl();
241            entity.setName(name);
242            entity.setCreationDate(creationDate);
243            entity.setUpdateDate(updateDate);
244            entity.setStatus(status);
245            return entity;
246        }
247    }
248
249    /**
250     * @see Comparable#compareTo
251     */
252    public int compareTo(Citation o)
253    {
254        int cmp = 0;
255        if (this.getId() != null)
256        {
257            cmp = this.getId().compareTo(o.getId());
258        }
259        else
260        {
261            if (this.getName() != null)
262            {
263                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
264            }
265            if (this.getCreationDate() != null)
266            {
267                cmp = (cmp != 0 ? cmp : this.getCreationDate().compareTo(o.getCreationDate()));
268            }
269            if (this.getUpdateDate() != null)
270            {
271                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
272            }
273        }
274        return cmp;
275    }
276// HibernateEntity.vsl merge-point
277// Citation.java merge-point
278}