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