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 java.io.Serializable;
032import java.sql.Timestamp;
033import java.util.Collection;
034import java.util.HashSet;
035
036/**
037 * 
038 */
039// HibernateEntity.vsl annotations merge-point
040public abstract class ProgramPrivilege
041    implements Serializable, Comparable<ProgramPrivilege>
042{
043    /**
044     * The serial version UID of this class. Needed for serialization.
045     */
046    private static final long serialVersionUID = 8512292936227626824L;
047
048    // Generate 4 attributes
049    private Integer id;
050
051    /**
052     * Identifiant interne. généré par le système.
053     * @return this.id Integer
054     */
055    public Integer getId()
056    {
057        return this.id;
058    }
059
060    /**
061     * Identifiant interne. généré par le système.
062     * @param idIn Integer
063     */
064    public void setId(Integer idIn)
065    {
066        this.id = idIn;
067    }
068
069    private String label;
070
071    /**
072     * 
073     * @return this.label String
074     */
075    public String getLabel()
076    {
077        return this.label;
078    }
079
080    /**
081     * 
082     * @param labelIn String
083     */
084    public void setLabel(String labelIn)
085    {
086        this.label = labelIn;
087    }
088
089    private String name;
090
091    /**
092     * 
093     * @return this.name String
094     */
095    public String getName()
096    {
097        return this.name;
098    }
099
100    /**
101     * 
102     * @param nameIn String
103     */
104    public void setName(String nameIn)
105    {
106        this.name = nameIn;
107    }
108
109    private Timestamp updateDate;
110
111    /**
112     * 
113     * @return this.updateDate Timestamp
114     */
115    public Timestamp getUpdateDate()
116    {
117        return this.updateDate;
118    }
119
120    /**
121     * 
122     * @param updateDateIn Timestamp
123     */
124    public void setUpdateDate(Timestamp updateDateIn)
125    {
126        this.updateDate = updateDateIn;
127    }
128
129    // Generate 2 associations
130    private Collection<Program2Person> program2Persons = new HashSet<Program2Person>();
131
132    /**
133     * <html>
134     * <head>
135     * <style>
136     * p {padding:0px; margin:0px;}
137     * </style>
138     * </head>
139     * <body>
140     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
141     * </body>
142     * </html>
143     * @return this.program2Persons Collection<Program2Person>
144     */
145    public Collection<Program2Person> getProgram2Persons()
146    {
147        return this.program2Persons;
148    }
149
150    /**
151     * <html>
152     * <head>
153     * <style>
154     * p {padding:0px; margin:0px;}
155     * </style>
156     * </head>
157     * <body>
158     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
159     * </body>
160     * </html>
161     * @param program2PersonsIn Collection<Program2Person>
162     */
163    public void setProgram2Persons(Collection<Program2Person> program2PersonsIn)
164    {
165        this.program2Persons = program2PersonsIn;
166    }
167
168    /**
169     * <html>
170     * <head>
171     * <style>
172     * p {padding:0px; margin:0px;}
173     * </style>
174     * </head>
175     * <body>
176     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
177     * </body>
178     * </html>
179     * @param elementToAdd Program2Person
180     * @return <tt>true</tt> if this collection changed as a result of the
181     *         call
182     */
183    public boolean addProgram2Persons(Program2Person elementToAdd)
184    {
185        return this.program2Persons.add(elementToAdd);
186    }
187
188    /**
189     * <html>
190     * <head>
191     * <style>
192     * p {padding:0px; margin:0px;}
193     * </style>
194     * </head>
195     * <body>
196     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
197     * </body>
198     * </html>
199     * @param elementToRemove Program2Person
200     * @return <tt>true</tt> if this collection changed as a result of the
201     *         call
202     */
203    public boolean removeProgram2Persons(Program2Person elementToRemove)
204    {
205        return this.program2Persons.remove(elementToRemove);
206    }
207
208    private Collection<Program2Department> program2Departments = new HashSet<Program2Department>();
209
210    /**
211     * Liste des droits d''un service pour un programme particulier
212     * @return this.program2Departments Collection<Program2Department>
213     */
214    public Collection<Program2Department> getProgram2Departments()
215    {
216        return this.program2Departments;
217    }
218
219    /**
220     * Liste des droits d''un service pour un programme particulier
221     * @param program2DepartmentsIn Collection<Program2Department>
222     */
223    public void setProgram2Departments(Collection<Program2Department> program2DepartmentsIn)
224    {
225        this.program2Departments = program2DepartmentsIn;
226    }
227
228    /**
229     * Liste des droits d''un service pour un programme particulier
230     * @param elementToAdd Program2Department
231     * @return <tt>true</tt> if this collection changed as a result of the
232     *         call
233     */
234    public boolean addProgram2Departments(Program2Department elementToAdd)
235    {
236        return this.program2Departments.add(elementToAdd);
237    }
238
239    /**
240     * Liste des droits d''un service pour un programme particulier
241     * @param elementToRemove Program2Department
242     * @return <tt>true</tt> if this collection changed as a result of the
243     *         call
244     */
245    public boolean removeProgram2Departments(Program2Department elementToRemove)
246    {
247        return this.program2Departments.remove(elementToRemove);
248    }
249
250    /**
251     * Returns <code>true</code> if the argument is an ProgramPrivilege instance and all identifiers for this entity
252     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
253     */
254    @Override
255    public boolean equals(Object object)
256    {
257        if (this == object)
258        {
259            return true;
260        }
261        if (!(object instanceof ProgramPrivilege))
262        {
263            return false;
264        }
265        final ProgramPrivilege that = (ProgramPrivilege)object;
266        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
267        {
268            return false;
269        }
270        return true;
271    }
272
273    /**
274     * Returns a hash code based on this entity's identifiers.
275     */
276    @Override
277    public int hashCode()
278    {
279        int hashCode = 0;
280        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
281
282        return hashCode;
283    }
284
285    /**
286     * Constructs new instances of {@link ProgramPrivilege}.
287     */
288    public static final class Factory
289    {
290        /**
291         * Constructs a new instance of {@link ProgramPrivilege}.
292         * @return new ProgramPrivilegeImpl()
293         */
294        public static ProgramPrivilege newInstance()
295        {
296            return new ProgramPrivilegeImpl();
297        }
298
299        /**
300         * Constructs a new instance of {@link ProgramPrivilege}, taking all required and/or
301         * read-only properties as arguments, except for identifiers.
302         * @param label String
303         * @param name String
304         * @param updateDate Timestamp
305         * @return newInstance
306         */
307        public static ProgramPrivilege newInstance(String label, String name, Timestamp updateDate)
308        {
309            final ProgramPrivilege entity = new ProgramPrivilegeImpl();
310            entity.setLabel(label);
311            entity.setName(name);
312            entity.setUpdateDate(updateDate);
313            return entity;
314        }
315
316        /**
317         * Constructs a new instance of {@link ProgramPrivilege}, taking all possible properties
318         * (except the identifier(s))as arguments.
319         * @param label String
320         * @param name String
321         * @param updateDate Timestamp
322         * @param program2Persons Collection<Program2Person>
323         * @param program2Departments Collection<Program2Department>
324         * @return newInstance ProgramPrivilege
325         */
326        public static ProgramPrivilege newInstance(String label, String name, Timestamp updateDate, Collection<Program2Person> program2Persons, Collection<Program2Department> program2Departments)
327        {
328            final ProgramPrivilege entity = new ProgramPrivilegeImpl();
329            entity.setLabel(label);
330            entity.setName(name);
331            entity.setUpdateDate(updateDate);
332            entity.setProgram2Persons(program2Persons);
333            entity.setProgram2Departments(program2Departments);
334            return entity;
335        }
336    }
337
338    /**
339     * @see Comparable#compareTo
340     */
341    public int compareTo(ProgramPrivilege o)
342    {
343        int cmp = 0;
344        if (this.getId() != null)
345        {
346            cmp = this.getId().compareTo(o.getId());
347        }
348        else
349        {
350            if (this.getLabel() != null)
351            {
352                cmp = (cmp != 0 ? cmp : this.getLabel().compareTo(o.getLabel()));
353            }
354            if (this.getName() != null)
355            {
356                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
357            }
358            if (this.getUpdateDate() != null)
359            {
360                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
361            }
362        }
363        return cmp;
364    }
365// HibernateEntity.vsl merge-point
366// ProgramPrivilege.java merge-point
367}