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.data.vessel;
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.QualityFlag;
032import fr.ifremer.adagio.core.dao.referential.location.Location;
033import java.io.Serializable;
034import java.util.Date;
035
036/**
037 * Définit le lieu d'immatriculation d'un navire statistique et la période associée.
038 * Nombre de lignes : 72700
039 */
040// HibernateEntity.vsl annotations merge-point
041public abstract class VesselRegistrationPeriod
042    implements Serializable, Comparable<VesselRegistrationPeriod>
043{
044    /**
045     * The serial version UID of this class. Needed for serialization.
046     */
047    private static final long serialVersionUID = 1400358090358950484L;
048
049    private VesselRegistrationPeriodPK vesselRegistrationPeriodPk;
050
051    /**
052     * Get the composite primary key identifier class
053     * @return vesselRegistrationPeriodPk
054     */
055    public VesselRegistrationPeriodPK getVesselRegistrationPeriodPk()
056    {
057        return this.vesselRegistrationPeriodPk;
058    }
059
060    /**
061     * Set the composite primary key identifier class
062     * @param vesselRegistrationPeriodPkIn
063     */
064    public void setVesselRegistrationPeriodPk(VesselRegistrationPeriodPK vesselRegistrationPeriodPkIn) {
065        this.vesselRegistrationPeriodPk = vesselRegistrationPeriodPkIn;
066    }
067
068    // Generate 5 attributes
069    /**
070     * 
071     * @return this.startDateTime Date
072     */
073    public Date getStartDateTime()
074    {
075        return this.getVesselRegistrationPeriodPk().getStartDateTime();
076    }
077
078    /**
079     * 
080     * @param startDateTimeIn Date
081     */
082    public void setStartDateTime(Date startDateTimeIn)
083    {
084        this.getVesselRegistrationPeriodPk().setStartDateTime(startDateTimeIn);
085    }
086
087    private Date endDateTime;
088
089    /**
090     * 
091     * @return this.endDateTime Date
092     */
093    public Date getEndDateTime()
094    {
095        return this.endDateTime;
096    }
097
098    /**
099     * 
100     * @param endDateTimeIn Date
101     */
102    public void setEndDateTime(Date endDateTimeIn)
103    {
104        this.endDateTime = endDateTimeIn;
105    }
106
107    private String registrationCode;
108
109    /**
110     * <html>
111     * <head>
112     * <style>
113     * p {padding:0px; margin:0px;}
114     * </style>
115     * </head>
116     * <body>
117     * <p>
118     * Code d'immatriculation du navire, dans le lieu dans lequel il est
119     * enregistré.
120     * </p>
121     * <p>
122     * Il s'agit dans la plupart des cas de l'immatriculation <b>nationale</b>
123     * du navire, qui peut varier en cas de changement de pays.
124     * </p>
125     * </body>
126     * </html>
127     * @return this.registrationCode String
128     */
129    public String getRegistrationCode()
130    {
131        return this.registrationCode;
132    }
133
134    /**
135     * <html>
136     * <head>
137     * <style>
138     * p {padding:0px; margin:0px;}
139     * </style>
140     * </head>
141     * <body>
142     * <p>
143     * Code d'immatriculation du navire, dans le lieu dans lequel il est
144     * enregistré.
145     * </p>
146     * <p>
147     * Il s'agit dans la plupart des cas de l'immatriculation <b>nationale</b>
148     * du navire, qui peut varier en cas de changement de pays.
149     * </p>
150     * </body>
151     * </html>
152     * @param registrationCodeIn String
153     */
154    public void setRegistrationCode(String registrationCodeIn)
155    {
156        this.registrationCode = registrationCodeIn;
157    }
158
159    private String internationalRegistrationCode;
160
161    /**
162     * Code d'immatriculation international.
163     * Rempli à partir de l'information la plus stable : IMO code si disponible, ou CFR code
164     * ("Community Fishing-Fleet Register").
165     * @return this.internationalRegistrationCode String
166     */
167    public String getInternationalRegistrationCode()
168    {
169        return this.internationalRegistrationCode;
170    }
171
172    /**
173     * Code d'immatriculation international.
174     * Rempli à partir de l'information la plus stable : IMO code si disponible, ou CFR code
175     * ("Community Fishing-Fleet Register").
176     * @param internationalRegistrationCodeIn String
177     */
178    public void setInternationalRegistrationCode(String internationalRegistrationCodeIn)
179    {
180        this.internationalRegistrationCode = internationalRegistrationCodeIn;
181    }
182
183    private Short rankOrder = Short.valueOf("1");
184
185    /**
186     * Ajout pour gérer les regsitre de navires (hors registre consolidé) ou des doublons peuvent
187     * exister.
188     * mantis #14112
189     * @return this.rankOrder Short
190     */
191    public Short getRankOrder()
192    {
193        return this.rankOrder;
194    }
195
196    /**
197     * Ajout pour gérer les regsitre de navires (hors registre consolidé) ou des doublons peuvent
198     * exister.
199     * mantis #14112
200     * @param rankOrderIn Short
201     */
202    public void setRankOrder(Short rankOrderIn)
203    {
204        this.rankOrder = rankOrderIn;
205    }
206
207    // Generate 3 associations
208    private Location registrationLocation;
209
210    /**
211     * Lieu d'immatriculation.
212     * Peut etre un pays (=pavillon), un quartier d'immatriculation (QIM, pour la France), ou port
213     * d'immatriculation (pour le Maroc).
214     * @return this.registrationLocation Location
215     */
216    public Location getRegistrationLocation()
217    {
218        return this.registrationLocation;
219    }
220
221    /**
222     * Lieu d'immatriculation.
223     * Peut etre un pays (=pavillon), un quartier d'immatriculation (QIM, pour la France), ou port
224     * d'immatriculation (pour le Maroc).
225     * @param registrationLocationIn Location
226     */
227    public void setRegistrationLocation(Location registrationLocationIn)
228    {
229        this.registrationLocation = registrationLocationIn;
230    }
231
232    private QualityFlag qualityFlag;
233
234    /**
235     * Flag qualité de la période.
236     * Par défaut = 0 (non qualifié).
237     * Utilisé par exemple pour les périodes d'immatriculation issues d'anciennes sources de données
238     * ne gérant pas l'historiques des modifications.
239     * @return this.qualityFlag QualityFlag
240     */
241    public QualityFlag getQualityFlag()
242    {
243        return this.qualityFlag;
244    }
245
246    /**
247     * Flag qualité de la période.
248     * Par défaut = 0 (non qualifié).
249     * Utilisé par exemple pour les périodes d'immatriculation issues d'anciennes sources de données
250     * ne gérant pas l'historiques des modifications.
251     * @param qualityFlagIn QualityFlag
252     */
253    public void setQualityFlag(QualityFlag qualityFlagIn)
254    {
255        this.qualityFlag = qualityFlagIn;
256    }
257
258    private Vessel vessel;
259
260    /**
261     * Navire, ou plus généralement un usager de la ressource.
262     * Peut etre un navire de peche professionnel ou non, un navire scientifique, un pêcheur à pied,
263     * un
264     * groupement de navires, etc.
265     * @return this.vessel Vessel
266     */
267    public Vessel getVessel()
268    {
269        return this.vessel;
270    }
271
272    /**
273     * Navire, ou plus généralement un usager de la ressource.
274     * Peut etre un navire de peche professionnel ou non, un navire scientifique, un pêcheur à pied,
275     * un
276     * groupement de navires, etc.
277     * @param vesselIn Vessel
278     */
279    public void setVessel(Vessel vesselIn)
280    {
281        this.vessel = vesselIn;
282    }
283
284    /**
285     * Returns <code>true</code> if the argument is an VesselRegistrationPeriod instance and all identifiers for this entity
286     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
287     */
288    @Override
289    public boolean equals(Object object)
290    {
291        if (this == object)
292        {
293            return true;
294        }
295        if (!(object instanceof VesselRegistrationPeriod))
296        {
297            return false;
298        }
299        final VesselRegistrationPeriod that = (VesselRegistrationPeriod)object;
300        if (this.vesselRegistrationPeriodPk == null || that.vesselRegistrationPeriodPk == null || !this.vesselRegistrationPeriodPk.equals(that.vesselRegistrationPeriodPk))
301        {
302            return false;
303        }
304        return true;
305    }
306
307    /**
308     * Returns a hash code based on this entity's identifiers.
309     */
310    @Override
311    public int hashCode()
312    {
313        int hashCode = 0;
314        hashCode = 29 * hashCode + (this.vesselRegistrationPeriodPk == null ? 0 : this.vesselRegistrationPeriodPk.hashCode());
315
316        return hashCode;
317    }
318
319    /**
320     * Constructs new instances of {@link VesselRegistrationPeriod}.
321     */
322    public static final class Factory
323    {
324        /**
325         * Constructs a new instance of {@link VesselRegistrationPeriod}.
326         * @return new VesselRegistrationPeriodImpl()
327         */
328        public static VesselRegistrationPeriod newInstance()
329        {
330            return new VesselRegistrationPeriodImpl();
331        }
332
333        /**
334         * Constructs a new instance of {@link VesselRegistrationPeriod}, taking all required and/or
335         * read-only properties as arguments, except for identifiers.
336         * @param rankOrder Short
337         * @param registrationLocation Location
338         * @param qualityFlag QualityFlag
339         * @param vessel Vessel
340         * @return newInstance
341         */
342        public static VesselRegistrationPeriod newInstance(Short rankOrder, Location registrationLocation, QualityFlag qualityFlag, Vessel vessel)
343        {
344            final VesselRegistrationPeriod entity = new VesselRegistrationPeriodImpl();
345            entity.setRankOrder(rankOrder);
346            entity.setRegistrationLocation(registrationLocation);
347            entity.setQualityFlag(qualityFlag);
348            entity.setVessel(vessel);
349            return entity;
350        }
351
352        /**
353         * Constructs a new instance of {@link VesselRegistrationPeriod}, taking all possible properties
354         * (except the identifier(s))as arguments.
355         * @param endDateTime Date
356         * @param registrationCode String
357         * @param internationalRegistrationCode String
358         * @param rankOrder Short
359         * @param registrationLocation Location
360         * @param qualityFlag QualityFlag
361         * @param vessel Vessel
362         * @return newInstance VesselRegistrationPeriod
363         */
364        public static VesselRegistrationPeriod newInstance(Date endDateTime, String registrationCode, String internationalRegistrationCode, Short rankOrder, Location registrationLocation, QualityFlag qualityFlag, Vessel vessel)
365        {
366            final VesselRegistrationPeriod entity = new VesselRegistrationPeriodImpl();
367            entity.setEndDateTime(endDateTime);
368            entity.setRegistrationCode(registrationCode);
369            entity.setInternationalRegistrationCode(internationalRegistrationCode);
370            entity.setRankOrder(rankOrder);
371            entity.setRegistrationLocation(registrationLocation);
372            entity.setQualityFlag(qualityFlag);
373            entity.setVessel(vessel);
374            return entity;
375        }
376    }
377
378    /**
379     * @see Comparable#compareTo
380     */
381    public int compareTo(VesselRegistrationPeriod o)
382    {
383        int cmp = 0;
384        if (this.getVesselRegistrationPeriodPk() != null)
385        {
386            cmp = this.getVesselRegistrationPeriodPk().compareTo(o.getVesselRegistrationPeriodPk());
387        }
388        else
389        {
390            if (this.getEndDateTime() != null)
391            {
392                cmp = (cmp != 0 ? cmp : this.getEndDateTime().compareTo(o.getEndDateTime()));
393            }
394            if (this.getRegistrationCode() != null)
395            {
396                cmp = (cmp != 0 ? cmp : this.getRegistrationCode().compareTo(o.getRegistrationCode()));
397            }
398            if (this.getInternationalRegistrationCode() != null)
399            {
400                cmp = (cmp != 0 ? cmp : this.getInternationalRegistrationCode().compareTo(o.getInternationalRegistrationCode()));
401            }
402            if (this.getRankOrder() != null)
403            {
404                cmp = (cmp != 0 ? cmp : this.getRankOrder().compareTo(o.getRankOrder()));
405            }
406        }
407        return cmp;
408    }
409// HibernateEntity.vsl merge-point
410// VesselRegistrationPeriod.java merge-point
411}