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;
034
035/**
036 * Niveau (ou période) d'agrégation de la donnée.
037 * Par exemple :
038 * - aucune (pas d'agrégation)
039 * - jour,
040 * - mois,
041 * - année
042 * - marée
043 * - opération
044 * - zone de peche (cas des séquences de peche ?)
045 * Utiliser une période d'agrégation permet de définir des valeurs moyennes sur une période
046 * d'agrégation (par exemple : le mois) indépendamment de la période concernée (par exemple : une
047 * année).
048 * Exemple :
049 * - moyenne mensuelle sur l'année, du nombre d'engin levé par jour :
050 * - paramètre : nombre d'engin levé
051 * - niveau d'agrégation du PSFM : jour
052 * - période concerné : 01/01/XX au 31/12/XX : définie au niveau de l'entité à laquelle est
053 * rattachée la mesure (exemple : la marée, l'opération, les caractéristiques d'utilisation, etc.).
054 * - période d'agrégation sur la mesure (xxxMeasurement) : mois
055 */
056// HibernateEntity.vsl annotations merge-point
057public abstract class AggregationLevel
058    implements Serializable, Comparable<AggregationLevel>
059{
060    /**
061     * The serial version UID of this class. Needed for serialization.
062     */
063    private static final long serialVersionUID = -4681955582651361615L;
064
065    // Generate 5 attributes
066    private Integer id;
067
068    /**
069     * Idenfiant interne. Généré par le système.
070     * @return this.id Integer
071     */
072    public Integer getId()
073    {
074        return this.id;
075    }
076
077    /**
078     * Idenfiant interne. Généré par le système.
079     * @param idIn Integer
080     */
081    public void setId(Integer idIn)
082    {
083        this.id = idIn;
084    }
085
086    private String name;
087
088    /**
089     * 
090     * @return this.name String
091     */
092    public String getName()
093    {
094        return this.name;
095    }
096
097    /**
098     * 
099     * @param nameIn String
100     */
101    public void setName(String nameIn)
102    {
103        this.name = nameIn;
104    }
105
106    private Integer rankOrder;
107
108    /**
109     * rang permettant de classer les niveau d'agrégation par ordre de précision : le niveau le plus
110     * bas est 'aucune' (donnée brute), le niveau le plus haut pourrait etre 'année' (moyenne
111     * annuelle)
112     * @return this.rankOrder Integer
113     */
114    public Integer getRankOrder()
115    {
116        return this.rankOrder;
117    }
118
119    /**
120     * rang permettant de classer les niveau d'agrégation par ordre de précision : le niveau le plus
121     * bas est 'aucune' (donnée brute), le niveau le plus haut pourrait etre 'année' (moyenne
122     * annuelle)
123     * @param rankOrderIn Integer
124     */
125    public void setRankOrder(Integer rankOrderIn)
126    {
127        this.rankOrder = rankOrderIn;
128    }
129
130    private Timestamp updateDate;
131
132    /**
133     * 
134     * @return this.updateDate Timestamp
135     */
136    public Timestamp getUpdateDate()
137    {
138        return this.updateDate;
139    }
140
141    /**
142     * 
143     * @param updateDateIn Timestamp
144     */
145    public void setUpdateDate(Timestamp updateDateIn)
146    {
147        this.updateDate = updateDateIn;
148    }
149
150    private String comments;
151
152    /**
153     * 
154     * @return this.comments String
155     */
156    public String getComments()
157    {
158        return this.comments;
159    }
160
161    /**
162     * 
163     * @param commentsIn String
164     */
165    public void setComments(String commentsIn)
166    {
167        this.comments = commentsIn;
168    }
169
170    // Generate 3 associations
171    private Status status;
172
173    /**
174     * Pour les données du référentiel, information permettant de déterminer si une donnée est
175     * valide,
176     * obsolète ou temporaire.
177     * - obsolète (=inactif) : '0'
178     * - valide (=actif) : '1'
179     * - temporaire : '2'
180     * - en cours de suppression : '3'
181     * -  : '4'
182     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
183     * confondre
184     * avec par exemple l'activité d'un navire sur un mois.
185     * @return this.status Status
186     */
187    public Status getStatus()
188    {
189        return this.status;
190    }
191
192    /**
193     * Pour les données du référentiel, information permettant de déterminer si une donnée est
194     * valide,
195     * obsolète ou temporaire.
196     * - obsolète (=inactif) : '0'
197     * - valide (=actif) : '1'
198     * - temporaire : '2'
199     * - en cours de suppression : '3'
200     * -  : '4'
201     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
202     * confondre
203     * avec par exemple l'activité d'un navire sur un mois.
204     * @param statusIn Status
205     */
206    public void setStatus(Status statusIn)
207    {
208        this.status = statusIn;
209    }
210
211    /**
212     * Returns <code>true</code> if the argument is an AggregationLevel instance and all identifiers for this entity
213     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
214     */
215    @Override
216    public boolean equals(Object object)
217    {
218        if (this == object)
219        {
220            return true;
221        }
222        if (!(object instanceof AggregationLevel))
223        {
224            return false;
225        }
226        final AggregationLevel that = (AggregationLevel)object;
227        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
228        {
229            return false;
230        }
231        return true;
232    }
233
234    /**
235     * Returns a hash code based on this entity's identifiers.
236     */
237    @Override
238    public int hashCode()
239    {
240        int hashCode = 0;
241        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
242
243        return hashCode;
244    }
245
246    /**
247     * Constructs new instances of {@link AggregationLevel}.
248     */
249    public static final class Factory
250    {
251        /**
252         * Constructs a new instance of {@link AggregationLevel}.
253         * @return new AggregationLevelImpl()
254         */
255        public static AggregationLevel newInstance()
256        {
257            return new AggregationLevelImpl();
258        }
259
260        /**
261         * Constructs a new instance of {@link AggregationLevel}, taking all required and/or
262         * read-only properties as arguments, except for identifiers.
263         * @param name String
264         * @param rankOrder Integer
265         * @param updateDate Timestamp
266         * @param status Status
267         * @return newInstance
268         */
269        public static AggregationLevel newInstance(String name, Integer rankOrder, Timestamp updateDate, Status status)
270        {
271            final AggregationLevel entity = new AggregationLevelImpl();
272            entity.setName(name);
273            entity.setRankOrder(rankOrder);
274            entity.setUpdateDate(updateDate);
275            entity.setStatus(status);
276            return entity;
277        }
278
279        /**
280         * Constructs a new instance of {@link AggregationLevel}, taking all possible properties
281         * (except the identifier(s))as arguments.
282         * @param name String
283         * @param rankOrder Integer
284         * @param updateDate Timestamp
285         * @param comments String
286         * @param status Status
287         * @return newInstance AggregationLevel
288         */
289        public static AggregationLevel newInstance(String name, Integer rankOrder, Timestamp updateDate, String comments, Status status)
290        {
291            final AggregationLevel entity = new AggregationLevelImpl();
292            entity.setName(name);
293            entity.setRankOrder(rankOrder);
294            entity.setUpdateDate(updateDate);
295            entity.setComments(comments);
296            entity.setStatus(status);
297            return entity;
298        }
299    }
300
301    /**
302     * @see Comparable#compareTo
303     */
304    public int compareTo(AggregationLevel o)
305    {
306        int cmp = 0;
307        if (this.getId() != null)
308        {
309            cmp = this.getId().compareTo(o.getId());
310        }
311        else
312        {
313            if (this.getName() != null)
314            {
315                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
316            }
317            if (this.getRankOrder() != null)
318            {
319                cmp = (cmp != 0 ? cmp : this.getRankOrder().compareTo(o.getRankOrder()));
320            }
321            if (this.getUpdateDate() != null)
322            {
323                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
324            }
325            if (this.getComments() != null)
326            {
327                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
328            }
329        }
330        return cmp;
331    }
332// HibernateEntity.vsl merge-point
333// AggregationLevel.java merge-point
334}