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