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;
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;
033
034/**
035 * Indice qualité d'une donnée.
036 * Actuellement, les indices qualités identifiés sont :
037 * 0 - Non qualifiée,
038 * 1 - Bonne,
039 * 2 - Hors statistiques,
040 * 3 - Douteuse,
041 * 4 - Fausse,
042 * 5 - Corrigée,
043 * 8 - Incomplète,
044 * 9 - Absente.
045 */
046// HibernateEntity.vsl annotations merge-point
047public abstract class QualityFlag
048    implements Serializable, Comparable<QualityFlag>
049{
050    /**
051     * The serial version UID of this class. Needed for serialization.
052     */
053    private static final long serialVersionUID = 3606228392696619475L;
054
055    // Generate 4 attributes
056    private String code;
057
058    /**
059     * 
060     * @return this.code String
061     */
062    public String getCode()
063    {
064        return this.code;
065    }
066
067    /**
068     * 
069     * @param codeIn String
070     */
071    public void setCode(String codeIn)
072    {
073        this.code = codeIn;
074    }
075
076    private String name;
077
078    /**
079     * 
080     * @return this.name String
081     */
082    public String getName()
083    {
084        return this.name;
085    }
086
087    /**
088     * 
089     * @param nameIn String
090     */
091    public void setName(String nameIn)
092    {
093        this.name = nameIn;
094    }
095
096    private Timestamp updateDate;
097
098    /**
099     * 
100     * @return this.updateDate Timestamp
101     */
102    public Timestamp getUpdateDate()
103    {
104        return this.updateDate;
105    }
106
107    /**
108     * 
109     * @param updateDateIn Timestamp
110     */
111    public void setUpdateDate(Timestamp updateDateIn)
112    {
113        this.updateDate = updateDateIn;
114    }
115
116    private String comments;
117
118    /**
119     * 
120     * @return this.comments String
121     */
122    public String getComments()
123    {
124        return this.comments;
125    }
126
127    /**
128     * 
129     * @param commentsIn String
130     */
131    public void setComments(String commentsIn)
132    {
133        this.comments = commentsIn;
134    }
135
136    // Generate 33 associations
137    private Status status;
138
139    /**
140     * Pour les données du référentiel, information permettant de déterminer si une donnée est
141     * valide,
142     * obsolète ou temporaire.
143     * - obsolète (=inactif) : '0'
144     * - valide (=actif) : '1'
145     * - temporaire : '2'
146     * - en cours de suppression : '3'
147     * -  : '4'
148     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
149     * confondre
150     * avec par exemple l'activité d'un navire sur un mois.
151     * @return this.status Status
152     */
153    public Status getStatus()
154    {
155        return this.status;
156    }
157
158    /**
159     * Pour les données du référentiel, information permettant de déterminer si une donnée est
160     * valide,
161     * obsolète ou temporaire.
162     * - obsolète (=inactif) : '0'
163     * - valide (=actif) : '1'
164     * - temporaire : '2'
165     * - en cours de suppression : '3'
166     * -  : '4'
167     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
168     * confondre
169     * avec par exemple l'activité d'un navire sur un mois.
170     * @param statusIn Status
171     */
172    public void setStatus(Status statusIn)
173    {
174        this.status = statusIn;
175    }
176
177    /**
178     * Returns <code>true</code> if the argument is an QualityFlag instance and all identifiers for this entity
179     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
180     */
181    @Override
182    public boolean equals(Object object)
183    {
184        if (this == object)
185        {
186            return true;
187        }
188        if (!(object instanceof QualityFlag))
189        {
190            return false;
191        }
192        final QualityFlag that = (QualityFlag)object;
193        if (this.code == null || that.getCode() == null || !this.code.equals(that.getCode()))
194        {
195            return false;
196        }
197        return true;
198    }
199
200    /**
201     * Returns a hash code based on this entity's identifiers.
202     */
203    @Override
204    public int hashCode()
205    {
206        int hashCode = 0;
207        hashCode = 29 * hashCode + (this.code == null ? 0 : this.code.hashCode());
208
209        return hashCode;
210    }
211
212    /**
213     * Constructs new instances of {@link QualityFlag}.
214     */
215    public static final class Factory
216    {
217        /**
218         * Constructs a new instance of {@link QualityFlag}.
219         * @return new QualityFlagImpl()
220         */
221        public static QualityFlag newInstance()
222        {
223            return new QualityFlagImpl();
224        }
225
226        /**
227         * Constructs a new instance of {@link QualityFlag}, taking all required and/or
228         * read-only properties as arguments, except for identifiers.
229         * @param name String
230         * @param updateDate Timestamp
231         * @param status Status
232         * @return newInstance
233         */
234        public static QualityFlag newInstance(String name, Timestamp updateDate, Status status)
235        {
236            final QualityFlag entity = new QualityFlagImpl();
237            entity.setName(name);
238            entity.setUpdateDate(updateDate);
239            entity.setStatus(status);
240            return entity;
241        }
242
243        /**
244         * Constructs a new instance of {@link QualityFlag}, taking all possible properties
245         * (except the identifier(s))as arguments.
246         * @param name String
247         * @param updateDate Timestamp
248         * @param comments String
249         * @param status Status
250         * @return newInstance QualityFlag
251         */
252        public static QualityFlag newInstance(String name, Timestamp updateDate, String comments, Status status)
253        {
254            final QualityFlag entity = new QualityFlagImpl();
255            entity.setName(name);
256            entity.setUpdateDate(updateDate);
257            entity.setComments(comments);
258            entity.setStatus(status);
259            return entity;
260        }
261    }
262
263    /**
264     * @see Comparable#compareTo
265     */
266    public int compareTo(QualityFlag o)
267    {
268        int cmp = 0;
269        if (this.getCode() != null)
270        {
271            cmp = this.getCode().compareTo(o.getCode());
272        }
273        else
274        {
275            if (this.getName() != null)
276            {
277                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
278            }
279            if (this.getUpdateDate() != null)
280            {
281                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
282            }
283            if (this.getComments() != null)
284            {
285                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
286            }
287        }
288        return cmp;
289    }
290// HibernateEntity.vsl merge-point
291// QualityFlag.java merge-point
292}