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.programStrategy;
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.administration.user.Person;
032import fr.ifremer.adagio.core.dao.referential.location.Location;
033import java.io.Serializable;
034import java.util.Collection;
035import java.util.HashSet;
036
037/**
038 * <html>
039 * <head>
040 * <style>
041 * p {padding:0px; margin:0px;}
042 * </style>
043 * </head>
044 * <body>
045 * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
046 * </body>
047 * </html>
048 */
049// HibernateEntity.vsl annotations merge-point
050public abstract class Program2Person
051    implements Serializable, Comparable<Program2Person>
052{
053    /**
054     * The serial version UID of this class. Needed for serialization.
055     */
056    private static final long serialVersionUID = -6292940436118763223L;
057
058    // Generate 1 attributes
059    private Integer id;
060
061    /**
062     * 
063     * @return this.id Integer
064     */
065    public Integer getId()
066    {
067        return this.id;
068    }
069
070    /**
071     * 
072     * @param idIn Integer
073     */
074    public void setId(Integer idIn)
075    {
076        this.id = idIn;
077    }
078
079    // Generate 6 associations
080    private Collection<Program2PersonException> program2PersonExceptions = new HashSet<Program2PersonException>();
081
082    /**
083     * Permet d'inclure ou d'exlure des navires d'un lieu sur lequel un utilisateur à des droits.
084     * @return this.program2PersonExceptions Collection<Program2PersonException>
085     */
086    public Collection<Program2PersonException> getProgram2PersonExceptions()
087    {
088        return this.program2PersonExceptions;
089    }
090
091    /**
092     * Permet d'inclure ou d'exlure des navires d'un lieu sur lequel un utilisateur à des droits.
093     * @param program2PersonExceptionsIn Collection<Program2PersonException>
094     */
095    public void setProgram2PersonExceptions(Collection<Program2PersonException> program2PersonExceptionsIn)
096    {
097        this.program2PersonExceptions = program2PersonExceptionsIn;
098    }
099
100    /**
101     * Permet d'inclure ou d'exlure des navires d'un lieu sur lequel un utilisateur à des droits.
102     * @param elementToAdd Program2PersonException
103     * @return <tt>true</tt> if this collection changed as a result of the
104     *         call
105     */
106    public boolean addProgram2PersonExceptions(Program2PersonException elementToAdd)
107    {
108        return this.program2PersonExceptions.add(elementToAdd);
109    }
110
111    /**
112     * Permet d'inclure ou d'exlure des navires d'un lieu sur lequel un utilisateur à des droits.
113     * @param elementToRemove Program2PersonException
114     * @return <tt>true</tt> if this collection changed as a result of the
115     *         call
116     */
117    public boolean removeProgram2PersonExceptions(Program2PersonException elementToRemove)
118    {
119        return this.program2PersonExceptions.remove(elementToRemove);
120    }
121
122    private Person referencePerson;
123
124    /**
125     * <html>
126     * <head>
127     * <style>
128     * p {padding:0px; margin:0px;}
129     * </style>
130     * </head>
131     * <body>
132     * <p>
133     * Personne liées aux données : utilisateur du système, ou observateurs,
134     * responsable de données, etc.
135     * </p>
136     * <p>
137     * </p>
138     * <p>
139     * Les personnes liées aux activités professionnelles de pêche sont plutôt
140     * gérer dans <i>VesselPerson</i>.
141     * </p>
142     * <p>
143     * </p>
144     * <p>
145     * Nombre de lignes : 100
146     * </p>
147     * </body>
148     * </html>
149     * @return this.referencePerson Person
150     */
151    public Person getReferencePerson()
152    {
153        return this.referencePerson;
154    }
155
156    /**
157     * <html>
158     * <head>
159     * <style>
160     * p {padding:0px; margin:0px;}
161     * </style>
162     * </head>
163     * <body>
164     * <p>
165     * Personne liées aux données : utilisateur du système, ou observateurs,
166     * responsable de données, etc.
167     * </p>
168     * <p>
169     * </p>
170     * <p>
171     * Les personnes liées aux activités professionnelles de pêche sont plutôt
172     * gérer dans <i>VesselPerson</i>.
173     * </p>
174     * <p>
175     * </p>
176     * <p>
177     * Nombre de lignes : 100
178     * </p>
179     * </body>
180     * </html>
181     * @param referencePersonIn Person
182     */
183    public void setReferencePerson(Person referencePersonIn)
184    {
185        this.referencePerson = referencePersonIn;
186    }
187
188    private Person person;
189
190    /**
191     * Utilisateurs saisisseurs sur le programme.
192     * @return this.person Person
193     */
194    public Person getPerson()
195    {
196        return this.person;
197    }
198
199    /**
200     * Utilisateurs saisisseurs sur le programme.
201     * @param personIn Person
202     */
203    public void setPerson(Person personIn)
204    {
205        this.person = personIn;
206    }
207
208    private ProgramPrivilege programPrivilege;
209
210    /**
211     * Identifiant du privilège (droit) sur les programmes
212     * @return this.programPrivilege ProgramPrivilege
213     */
214    public ProgramPrivilege getProgramPrivilege()
215    {
216        return this.programPrivilege;
217    }
218
219    /**
220     * Identifiant du privilège (droit) sur les programmes
221     * @param programPrivilegeIn ProgramPrivilege
222     */
223    public void setProgramPrivilege(ProgramPrivilege programPrivilegeIn)
224    {
225        this.programPrivilege = programPrivilegeIn;
226    }
227
228    private Program program;
229
230    /**
231     * Code unique du programme
232     * @return this.program Program
233     */
234    public Program getProgram()
235    {
236        return this.program;
237    }
238
239    /**
240     * Code unique du programme
241     * @param programIn Program
242     */
243    public void setProgram(Program programIn)
244    {
245        this.program = programIn;
246    }
247
248    private Location location;
249
250    /**
251     * Représente un lieu au sens général du terme. Il peut s'agir d'un lieu ponctuel, linéaire ou
252     * surfacique.
253     * Suivant sa classification et son niveau, il peut s'agir d'un secteur FAO, un port de pêche,
254     * un
255     * quartier maritime, une criée, etc.
256     * Nombre de lignes : lieux terrestre : 4500 + secteurs : 11210 + strates : 1000 + localités :
257     * 200
258     * @return this.location Location
259     */
260    public Location getLocation()
261    {
262        return this.location;
263    }
264
265    /**
266     * Représente un lieu au sens général du terme. Il peut s'agir d'un lieu ponctuel, linéaire ou
267     * surfacique.
268     * Suivant sa classification et son niveau, il peut s'agir d'un secteur FAO, un port de pêche,
269     * un
270     * quartier maritime, une criée, etc.
271     * Nombre de lignes : lieux terrestre : 4500 + secteurs : 11210 + strates : 1000 + localités :
272     * 200
273     * @param locationIn Location
274     */
275    public void setLocation(Location locationIn)
276    {
277        this.location = locationIn;
278    }
279
280    /**
281     * Returns <code>true</code> if the argument is an Program2Person instance and all identifiers for this entity
282     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
283     */
284    @Override
285    public boolean equals(Object object)
286    {
287        if (this == object)
288        {
289            return true;
290        }
291        if (!(object instanceof Program2Person))
292        {
293            return false;
294        }
295        final Program2Person that = (Program2Person)object;
296        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
297        {
298            return false;
299        }
300        return true;
301    }
302
303    /**
304     * Returns a hash code based on this entity's identifiers.
305     */
306    @Override
307    public int hashCode()
308    {
309        int hashCode = 0;
310        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
311
312        return hashCode;
313    }
314
315    /**
316     * Constructs new instances of {@link Program2Person}.
317     */
318    public static final class Factory
319    {
320        /**
321         * Constructs a new instance of {@link Program2Person}.
322         * @return new Program2PersonImpl()
323         */
324        public static Program2Person newInstance()
325        {
326            return new Program2PersonImpl();
327        }
328
329        /**
330         * Constructs a new instance of {@link Program2Person}, taking all required and/or
331         * read-only properties as arguments, except for identifiers.
332         * @param person Person
333         * @param programPrivilege ProgramPrivilege
334         * @param program Program
335         * @return newInstance
336         */
337        public static Program2Person newInstance(Person person, ProgramPrivilege programPrivilege, Program program)
338        {
339            final Program2Person entity = new Program2PersonImpl();
340            entity.setPerson(person);
341            entity.setProgramPrivilege(programPrivilege);
342            entity.setProgram(program);
343            return entity;
344        }
345
346        /**
347         * Constructs a new instance of {@link Program2Person}, taking all possible properties
348         * (except the identifier(s))as arguments.
349         * @param program2PersonExceptions Collection<Program2PersonException>
350         * @param referencePerson Person
351         * @param person Person
352         * @param programPrivilege ProgramPrivilege
353         * @param program Program
354         * @param location Location
355         * @return newInstance Program2Person
356         */
357        public static Program2Person newInstance(Collection<Program2PersonException> program2PersonExceptions, Person referencePerson, Person person, ProgramPrivilege programPrivilege, Program program, Location location)
358        {
359            final Program2Person entity = new Program2PersonImpl();
360            entity.setProgram2PersonExceptions(program2PersonExceptions);
361            entity.setReferencePerson(referencePerson);
362            entity.setPerson(person);
363            entity.setProgramPrivilege(programPrivilege);
364            entity.setProgram(program);
365            entity.setLocation(location);
366            return entity;
367        }
368    }
369
370    /**
371     * @see Comparable#compareTo
372     */
373    public int compareTo(Program2Person o)
374    {
375        int cmp = 0;
376        if (this.getId() != null)
377        {
378            cmp = this.getId().compareTo(o.getId());
379        }
380        
381        return cmp;
382    }
383// HibernateEntity.vsl merge-point
384// Program2Person.java merge-point
385}