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.administration.user;
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;
033import java.util.Collection;
034import java.util.HashSet;
035
036/**
037 * Tête de grappe de droits calculés pour un utilisateur à partir d'autres entités implémentant la
038 * gestion des droits. Le but est l'amélioration des performances de synchronisation entre bases
039 * locale et distante. Les droits sont calculés en début d'importation des données et n'ont pas à
040 * être recalculés pour chaque donnée pour laquelle des droits sont appliqués.
041 * Créé d'après l'étude sur l'amélioration des performances V3 (cf. mantis 10528).
042 */
043// HibernateEntity.vsl annotations merge-point
044public abstract class PersonSession
045    implements Serializable, Comparable<PersonSession>
046{
047    /**
048     * The serial version UID of this class. Needed for serialization.
049     */
050    private static final long serialVersionUID = 1029951372514017956L;
051
052    // Generate 2 attributes
053    private Integer id;
054
055    /**
056     * 
057     * @return this.id Integer
058     */
059    public Integer getId()
060    {
061        return this.id;
062    }
063
064    /**
065     * 
066     * @param idIn Integer
067     */
068    public void setId(Integer idIn)
069    {
070        this.id = idIn;
071    }
072
073    private Timestamp updateDate;
074
075    /**
076     * 
077     * @return this.updateDate Timestamp
078     */
079    public Timestamp getUpdateDate()
080    {
081        return this.updateDate;
082    }
083
084    /**
085     * 
086     * @param updateDateIn Timestamp
087     */
088    public void setUpdateDate(Timestamp updateDateIn)
089    {
090        this.updateDate = updateDateIn;
091    }
092
093    // Generate 2 associations
094    private Person person;
095
096    /**
097     * <html>
098     * <head>
099     * <style>
100     * p {padding:0px; margin:0px;}
101     * </style>
102     * </head>
103     * <body>
104     * <p>
105     * Personne liées aux données : utilisateur du système, ou observateurs,
106     * responsable de données, etc.
107     * </p>
108     * <p>
109     * </p>
110     * <p>
111     * Les personnes liées aux activités professionnelles de pêche sont plutôt
112     * gérer dans <i>VesselPerson</i>.
113     * </p>
114     * <p>
115     * </p>
116     * <p>
117     * Nombre de lignes : 100
118     * </p>
119     * </body>
120     * </html>
121     * @return this.person Person
122     */
123    public Person getPerson()
124    {
125        return this.person;
126    }
127
128    /**
129     * <html>
130     * <head>
131     * <style>
132     * p {padding:0px; margin:0px;}
133     * </style>
134     * </head>
135     * <body>
136     * <p>
137     * Personne liées aux données : utilisateur du système, ou observateurs,
138     * responsable de données, etc.
139     * </p>
140     * <p>
141     * </p>
142     * <p>
143     * Les personnes liées aux activités professionnelles de pêche sont plutôt
144     * gérer dans <i>VesselPerson</i>.
145     * </p>
146     * <p>
147     * </p>
148     * <p>
149     * Nombre de lignes : 100
150     * </p>
151     * </body>
152     * </html>
153     * @param personIn Person
154     */
155    public void setPerson(Person personIn)
156    {
157        this.person = personIn;
158    }
159
160    private Collection<PersonSessionVessel> personSessionVessels = new HashSet<PersonSessionVessel>();
161
162    /**
163     * Droits calculés pour un utilisateur à partir d'autres entités implémentant la gestion des
164     * droits. Le
165     * but est l'amélioration des performances de synchronisation entre bases locale et distante.
166     * Les
167     * droits sont calculés en début d'importation des données et n'ont pas à être recalculés pour
168     * chaque
169     * donnée pour laquelle des droits sont appliqués.
170     * Créé d'après l'étude sur l'amélioration des performances V3 (cf. mantis 10528).
171     * Remplie à partir de la procédure PL/SQL F_FILL_PERSON_SESSION
172     * @return this.personSessionVessels Collection<PersonSessionVessel>
173     */
174    public Collection<PersonSessionVessel> getPersonSessionVessels()
175    {
176        return this.personSessionVessels;
177    }
178
179    /**
180     * Droits calculés pour un utilisateur à partir d'autres entités implémentant la gestion des
181     * droits. Le
182     * but est l'amélioration des performances de synchronisation entre bases locale et distante.
183     * Les
184     * droits sont calculés en début d'importation des données et n'ont pas à être recalculés pour
185     * chaque
186     * donnée pour laquelle des droits sont appliqués.
187     * Créé d'après l'étude sur l'amélioration des performances V3 (cf. mantis 10528).
188     * Remplie à partir de la procédure PL/SQL F_FILL_PERSON_SESSION
189     * @param personSessionVesselsIn Collection<PersonSessionVessel>
190     */
191    public void setPersonSessionVessels(Collection<PersonSessionVessel> personSessionVesselsIn)
192    {
193        this.personSessionVessels = personSessionVesselsIn;
194    }
195
196    /**
197     * Droits calculés pour un utilisateur à partir d'autres entités implémentant la gestion des
198     * droits. Le
199     * but est l'amélioration des performances de synchronisation entre bases locale et distante.
200     * Les
201     * droits sont calculés en début d'importation des données et n'ont pas à être recalculés pour
202     * chaque
203     * donnée pour laquelle des droits sont appliqués.
204     * Créé d'après l'étude sur l'amélioration des performances V3 (cf. mantis 10528).
205     * Remplie à partir de la procédure PL/SQL F_FILL_PERSON_SESSION
206     * @param elementToAdd PersonSessionVessel
207     * @return <tt>true</tt> if this collection changed as a result of the
208     *         call
209     */
210    public boolean addPersonSessionVessels(PersonSessionVessel elementToAdd)
211    {
212        return this.personSessionVessels.add(elementToAdd);
213    }
214
215    /**
216     * Droits calculés pour un utilisateur à partir d'autres entités implémentant la gestion des
217     * droits. Le
218     * but est l'amélioration des performances de synchronisation entre bases locale et distante.
219     * Les
220     * droits sont calculés en début d'importation des données et n'ont pas à être recalculés pour
221     * chaque
222     * donnée pour laquelle des droits sont appliqués.
223     * Créé d'après l'étude sur l'amélioration des performances V3 (cf. mantis 10528).
224     * Remplie à partir de la procédure PL/SQL F_FILL_PERSON_SESSION
225     * @param elementToRemove PersonSessionVessel
226     * @return <tt>true</tt> if this collection changed as a result of the
227     *         call
228     */
229    public boolean removePersonSessionVessels(PersonSessionVessel elementToRemove)
230    {
231        return this.personSessionVessels.remove(elementToRemove);
232    }
233
234    /**
235     * Returns <code>true</code> if the argument is an PersonSession instance and all identifiers for this entity
236     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
237     */
238    @Override
239    public boolean equals(Object object)
240    {
241        if (this == object)
242        {
243            return true;
244        }
245        if (!(object instanceof PersonSession))
246        {
247            return false;
248        }
249        final PersonSession that = (PersonSession)object;
250        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
251        {
252            return false;
253        }
254        return true;
255    }
256
257    /**
258     * Returns a hash code based on this entity's identifiers.
259     */
260    @Override
261    public int hashCode()
262    {
263        int hashCode = 0;
264        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
265
266        return hashCode;
267    }
268
269    /**
270     * Constructs new instances of {@link PersonSession}.
271     */
272    public static final class Factory
273    {
274        /**
275         * Constructs a new instance of {@link PersonSession}.
276         * @return new PersonSessionImpl()
277         */
278        public static PersonSession newInstance()
279        {
280            return new PersonSessionImpl();
281        }
282
283        /**
284         * Constructs a new instance of {@link PersonSession}, taking all required and/or
285         * read-only properties as arguments, except for identifiers.
286         * @param updateDate Timestamp
287         * @param person Person
288         * @return newInstance
289         */
290        public static PersonSession newInstance(Timestamp updateDate, Person person)
291        {
292            final PersonSession entity = new PersonSessionImpl();
293            entity.setUpdateDate(updateDate);
294            entity.setPerson(person);
295            return entity;
296        }
297
298        /**
299         * Constructs a new instance of {@link PersonSession}, taking all possible properties
300         * (except the identifier(s))as arguments.
301         * @param updateDate Timestamp
302         * @param person Person
303         * @param personSessionVessels Collection<PersonSessionVessel>
304         * @return newInstance PersonSession
305         */
306        public static PersonSession newInstance(Timestamp updateDate, Person person, Collection<PersonSessionVessel> personSessionVessels)
307        {
308            final PersonSession entity = new PersonSessionImpl();
309            entity.setUpdateDate(updateDate);
310            entity.setPerson(person);
311            entity.setPersonSessionVessels(personSessionVessels);
312            return entity;
313        }
314    }
315
316    /**
317     * @see Comparable#compareTo
318     */
319    public int compareTo(PersonSession o)
320    {
321        int cmp = 0;
322        if (this.getId() != null)
323        {
324            cmp = this.getId().compareTo(o.getId());
325        }
326        else
327        {
328            if (this.getUpdateDate() != null)
329            {
330                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
331            }
332        }
333        return cmp;
334    }
335// HibernateEntity.vsl merge-point
336// PersonSession.java merge-point
337}