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 java.io.Serializable;
032import java.util.Date;
033
034/**
035 * Période d'appartenance d'un navire à un armateur (période d'armement).
036 * Nombre de lignes : 25600
037 */
038// HibernateEntity.vsl annotations merge-point
039public abstract class VesselOwnerPeriod
040    implements Serializable, Comparable<VesselOwnerPeriod>
041{
042    /**
043     * The serial version UID of this class. Needed for serialization.
044     */
045    private static final long serialVersionUID = -4523764948850094855L;
046
047    private VesselOwnerPeriodPK vesselOwnerPeriodPk;
048
049    /**
050     * Get the composite primary key identifier class
051     * @return vesselOwnerPeriodPk
052     */
053    public VesselOwnerPeriodPK getVesselOwnerPeriodPk()
054    {
055        return this.vesselOwnerPeriodPk;
056    }
057
058    /**
059     * Set the composite primary key identifier class
060     * @param vesselOwnerPeriodPkIn
061     */
062    public void setVesselOwnerPeriodPk(VesselOwnerPeriodPK vesselOwnerPeriodPkIn) {
063        this.vesselOwnerPeriodPk = vesselOwnerPeriodPkIn;
064    }
065
066    // Generate 2 attributes
067    /**
068     * 
069     * @return this.startDateTime Date
070     */
071    public Date getStartDateTime()
072    {
073        return this.getVesselOwnerPeriodPk().getStartDateTime();
074    }
075
076    /**
077     * 
078     * @param startDateTimeIn Date
079     */
080    public void setStartDateTime(Date startDateTimeIn)
081    {
082        this.getVesselOwnerPeriodPk().setStartDateTime(startDateTimeIn);
083    }
084
085    private Date endDateTime;
086
087    /**
088     * 
089     * @return this.endDateTime Date
090     */
091    public Date getEndDateTime()
092    {
093        return this.endDateTime;
094    }
095
096    /**
097     * 
098     * @param endDateTimeIn Date
099     */
100    public void setEndDateTime(Date endDateTimeIn)
101    {
102        this.endDateTime = endDateTimeIn;
103    }
104
105    // Generate 2 associations
106    private Vessel vessel;
107
108    /**
109     * Navire, ou plus généralement un usager de la ressource.
110     * Peut etre un navire de peche professionnel ou non, un navire scientifique, un pêcheur à pied,
111     * un
112     * groupement de navires, etc.
113     * @return this.vessel Vessel
114     */
115    public Vessel getVessel()
116    {
117        return this.vessel;
118    }
119
120    /**
121     * Navire, ou plus généralement un usager de la ressource.
122     * Peut etre un navire de peche professionnel ou non, un navire scientifique, un pêcheur à pied,
123     * un
124     * groupement de navires, etc.
125     * @param vesselIn Vessel
126     */
127    public void setVessel(Vessel vesselIn)
128    {
129        this.vessel = vesselIn;
130    }
131
132    private VesselOwner vesselOwner;
133
134    /**
135     * <html>
136     * <head>
137     * </head>
138     * <body>
139     * <p>
140     * Armateur (ou propri&#233;taire) de navire(s). Personne physique ou morale.
141     * </p>
142     * <p>
143     * </p>
144     * <p>
145     * Dans le cas de pecheur &#224; pied ou groupement de navires, <i>VesselOwner</i>
146     * permet aussi de porter les informations sur le pecheur &#224; pied, ou sur le
147     * responsable du groupement de navire.
148     * </p>
149     * <p>
150     * </p>
151     * <p>
152     * Nombre de lignes : 20900
153     * </p>
154     * </body>
155     * </html>
156     * @return this.vesselOwner VesselOwner
157     */
158    public VesselOwner getVesselOwner()
159    {
160        return this.vesselOwner;
161    }
162
163    /**
164     * <html>
165     * <head>
166     * </head>
167     * <body>
168     * <p>
169     * Armateur (ou propri&#233;taire) de navire(s). Personne physique ou morale.
170     * </p>
171     * <p>
172     * </p>
173     * <p>
174     * Dans le cas de pecheur &#224; pied ou groupement de navires, <i>VesselOwner</i>
175     * permet aussi de porter les informations sur le pecheur &#224; pied, ou sur le
176     * responsable du groupement de navire.
177     * </p>
178     * <p>
179     * </p>
180     * <p>
181     * Nombre de lignes : 20900
182     * </p>
183     * </body>
184     * </html>
185     * @param vesselOwnerIn VesselOwner
186     */
187    public void setVesselOwner(VesselOwner vesselOwnerIn)
188    {
189        this.vesselOwner = vesselOwnerIn;
190    }
191
192    /**
193     * Returns <code>true</code> if the argument is an VesselOwnerPeriod instance and all identifiers for this entity
194     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
195     */
196    @Override
197    public boolean equals(Object object)
198    {
199        if (this == object)
200        {
201            return true;
202        }
203        if (!(object instanceof VesselOwnerPeriod))
204        {
205            return false;
206        }
207        final VesselOwnerPeriod that = (VesselOwnerPeriod)object;
208        if (this.vesselOwnerPeriodPk == null || that.vesselOwnerPeriodPk == null || !this.vesselOwnerPeriodPk.equals(that.vesselOwnerPeriodPk))
209        {
210            return false;
211        }
212        return true;
213    }
214
215    /**
216     * Returns a hash code based on this entity's identifiers.
217     */
218    @Override
219    public int hashCode()
220    {
221        int hashCode = 0;
222        hashCode = 29 * hashCode + (this.vesselOwnerPeriodPk == null ? 0 : this.vesselOwnerPeriodPk.hashCode());
223
224        return hashCode;
225    }
226
227    /**
228     * Constructs new instances of {@link VesselOwnerPeriod}.
229     */
230    public static final class Factory
231    {
232        /**
233         * Constructs a new instance of {@link VesselOwnerPeriod}.
234         * @return new VesselOwnerPeriodImpl()
235         */
236        public static VesselOwnerPeriod newInstance()
237        {
238            return new VesselOwnerPeriodImpl();
239        }
240
241        /**
242         * Constructs a new instance of {@link VesselOwnerPeriod}, taking all required and/or
243         * read-only properties as arguments, except for identifiers.
244         * @param vessel Vessel
245         * @param vesselOwner VesselOwner
246         * @return newInstance
247         */
248        public static VesselOwnerPeriod newInstance(Vessel vessel, VesselOwner vesselOwner)
249        {
250            final VesselOwnerPeriod entity = new VesselOwnerPeriodImpl();
251            entity.setVessel(vessel);
252            entity.setVesselOwner(vesselOwner);
253            return entity;
254        }
255
256        /**
257         * Constructs a new instance of {@link VesselOwnerPeriod}, taking all possible properties
258         * (except the identifier(s))as arguments.
259         * @param endDateTime Date
260         * @param vessel Vessel
261         * @param vesselOwner VesselOwner
262         * @return newInstance VesselOwnerPeriod
263         */
264        public static VesselOwnerPeriod newInstance(Date endDateTime, Vessel vessel, VesselOwner vesselOwner)
265        {
266            final VesselOwnerPeriod entity = new VesselOwnerPeriodImpl();
267            entity.setEndDateTime(endDateTime);
268            entity.setVessel(vessel);
269            entity.setVesselOwner(vesselOwner);
270            return entity;
271        }
272    }
273
274    /**
275     * @see Comparable#compareTo
276     */
277    public int compareTo(VesselOwnerPeriod o)
278    {
279        int cmp = 0;
280        if (this.getVesselOwnerPeriodPk() != null)
281        {
282            cmp = this.getVesselOwnerPeriodPk().compareTo(o.getVesselOwnerPeriodPk());
283        }
284        else
285        {
286            if (this.getEndDateTime() != null)
287            {
288                cmp = (cmp != 0 ? cmp : this.getEndDateTime().compareTo(o.getEndDateTime()));
289            }
290        }
291        return cmp;
292    }
293// HibernateEntity.vsl merge-point
294// VesselOwnerPeriod.java merge-point
295}