View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: Generated code! Do not modify by hand!
4   // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
5   //
6   package fr.ifremer.quadrige2.core.dao.referential;
7   
8   /*-
9    * #%L
10   * Quadrige2 Core :: Server API
11   * %%
12   * Copyright (C) 2017 Ifremer
13   * %%
14   * This program is free software: you can redistribute it and/or modify
15   * it under the terms of the GNU Affero General Public License as published by
16   * the Free Software Foundation, either version 3 of the License, or
17   * (at your option) any later version.
18   * 
19   * This program is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22   * GNU General Public License for more details.
23   * 
24   * You should have received a copy of the GNU Affero General Public License
25   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26   * #L%
27   */
28  
29  import fr.ifremer.quadrige2.core.dao.administration.user.Department;
30  import fr.ifremer.quadrige2.core.dao.administration.user.Quser;
31  import java.io.Serializable;
32  import java.sql.Timestamp;
33  import java.util.Collection;
34  import java.util.HashSet;
35  
36  /**
37   * Ensemble des privilèges utilisateurs.
38   */
39  // HibernateEntity.vsl annotations merge-point
40  public abstract class Privilege
41      implements Serializable, Comparable<Privilege>
42  {
43      /**
44       * The serial version UID of this class. Needed for serialization.
45       */
46      private static final long serialVersionUID = 1511838935936723158L;
47  
48      // Generate 4 attributes
49      private String privilegeCd;
50  
51      /**
52       * Code unique du profil
53       * @return this.privilegeCd String
54       */
55      public String getPrivilegeCd()
56      {
57          return this.privilegeCd;
58      }
59  
60      /**
61       * Code unique du profil
62       * @param privilegeCdIn String
63       */
64      public void setPrivilegeCd(String privilegeCdIn)
65      {
66          this.privilegeCd = privilegeCdIn;
67      }
68  
69      private String privilegeNm;
70  
71      /**
72       * Llibellé décrivant le profil
73       * @return this.privilegeNm String
74       */
75      public String getPrivilegeNm()
76      {
77          return this.privilegeNm;
78      }
79  
80      /**
81       * Llibellé décrivant le profil
82       * @param privilegeNmIn String
83       */
84      public void setPrivilegeNm(String privilegeNmIn)
85      {
86          this.privilegeNm = privilegeNmIn;
87      }
88  
89      private String privilegeDc;
90  
91      /**
92       * Description du profil
93       * @return this.privilegeDc String
94       */
95      public String getPrivilegeDc()
96      {
97          return this.privilegeDc;
98      }
99  
100     /**
101      * Description du profil
102      * @param privilegeDcIn String
103      */
104     public void setPrivilegeDc(String privilegeDcIn)
105     {
106         this.privilegeDc = privilegeDcIn;
107     }
108 
109     private Timestamp updateDt;
110 
111     /**
112      * Date de modification de l'objet, mise à jour par le système
113      * @return this.updateDt Timestamp
114      */
115     public Timestamp getUpdateDt()
116     {
117         return this.updateDt;
118     }
119 
120     /**
121      * Date de modification de l'objet, mise à jour par le système
122      * @param updateDtIn Timestamp
123      */
124     public void setUpdateDt(Timestamp updateDtIn)
125     {
126         this.updateDt = updateDtIn;
127     }
128 
129     // Generate 3 associations
130     private Collection<Quser> qusers = new HashSet<Quser>();
131 
132     /**
133      * Liste l'ensemble des agents et utilisateurs du système.
134      * @return this.qusers Collection<Quser>
135      */
136     public Collection<Quser> getQusers()
137     {
138         return this.qusers;
139     }
140 
141     /**
142      * Liste l'ensemble des agents et utilisateurs du système.
143      * @param qusersIn Collection<Quser>
144      */
145     public void setQusers(Collection<Quser> qusersIn)
146     {
147         this.qusers = qusersIn;
148     }
149 
150     /**
151      * Liste l'ensemble des agents et utilisateurs du système.
152      * @param elementToAdd Quser
153      * @return <tt>true</tt> if this collection changed as a result of the
154      *         call
155      */
156     public boolean addQusers(Quser elementToAdd)
157     {
158         return this.qusers.add(elementToAdd);
159     }
160 
161     /**
162      * Liste l'ensemble des agents et utilisateurs du système.
163      * @param elementToRemove Quser
164      * @return <tt>true</tt> if this collection changed as a result of the
165      *         call
166      */
167     public boolean removeQusers(Quser elementToRemove)
168     {
169         return this.qusers.remove(elementToRemove);
170     }
171 
172     private Collection<Department> departments = new HashSet<Department>();
173 
174     /**
175      * Liste les départements ou services auxquels sont rattachés les agents
176      * @return this.departments Collection<Department>
177      */
178     public Collection<Department> getDepartments()
179     {
180         return this.departments;
181     }
182 
183     /**
184      * Liste les départements ou services auxquels sont rattachés les agents
185      * @param departmentsIn Collection<Department>
186      */
187     public void setDepartments(Collection<Department> departmentsIn)
188     {
189         this.departments = departmentsIn;
190     }
191 
192     /**
193      * Liste les départements ou services auxquels sont rattachés les agents
194      * @param elementToAdd Department
195      * @return <tt>true</tt> if this collection changed as a result of the
196      *         call
197      */
198     public boolean addDepartments(Department elementToAdd)
199     {
200         return this.departments.add(elementToAdd);
201     }
202 
203     /**
204      * Liste les départements ou services auxquels sont rattachés les agents
205      * @param elementToRemove Department
206      * @return <tt>true</tt> if this collection changed as a result of the
207      *         call
208      */
209     public boolean removeDepartments(Department elementToRemove)
210     {
211         return this.departments.remove(elementToRemove);
212     }
213 
214     private Status status;
215 
216     /**
217      * Liste des états possibles d'un objet.
218      * @return this.status Status
219      */
220     public Status getStatus()
221     {
222         return this.status;
223     }
224 
225     /**
226      * Liste des états possibles d'un objet.
227      * @param statusIn Status
228      */
229     public void setStatus(Status statusIn)
230     {
231         this.status = statusIn;
232     }
233 
234     /**
235      * Returns <code>true</code> if the argument is an Privilege 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 Privilege))
246         {
247             return false;
248         }
249         final Privilege that = (Privilege)object;
250         if (this.privilegeCd == null || that.getPrivilegeCd() == null || !this.privilegeCd.equals(that.getPrivilegeCd()))
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.privilegeCd == null ? 0 : this.privilegeCd.hashCode());
265 
266         return hashCode;
267     }
268 
269     /**
270      * Constructs new instances of {@link Privilege}.
271      */
272     public static final class Factory
273     {
274         /**
275          * Constructs a new instance of {@link Privilege}.
276          * @return new PrivilegeImpl()
277          */
278         public static Privilege newInstance()
279         {
280             return new PrivilegeImpl();
281         }
282 
283         /**
284          * Constructs a new instance of {@link Privilege}, taking all required and/or
285          * read-only properties as arguments, except for identifiers.
286          * @param privilegeNm String
287          * @param updateDt Timestamp
288          * @param status Status
289          * @return newInstance
290          */
291         public static Privilege newInstance(String privilegeNm, Timestamp updateDt, Status status)
292         {
293             final Privilege entity = new PrivilegeImpl();
294             entity.setPrivilegeNm(privilegeNm);
295             entity.setUpdateDt(updateDt);
296             entity.setStatus(status);
297             return entity;
298         }
299 
300         /**
301          * Constructs a new instance of {@link Privilege}, taking all possible properties
302          * (except the identifier(s))as arguments.
303          * @param privilegeNm String
304          * @param privilegeDc String
305          * @param updateDt Timestamp
306          * @param qusers Collection<Quser>
307          * @param departments Collection<Department>
308          * @param status Status
309          * @return newInstance Privilege
310          */
311         public static Privilege newInstance(String privilegeNm, String privilegeDc, Timestamp updateDt, Collection<Quser> qusers, Collection<Department> departments, Status status)
312         {
313             final Privilege entity = new PrivilegeImpl();
314             entity.setPrivilegeNm(privilegeNm);
315             entity.setPrivilegeDc(privilegeDc);
316             entity.setUpdateDt(updateDt);
317             entity.setQusers(qusers);
318             entity.setDepartments(departments);
319             entity.setStatus(status);
320             return entity;
321         }
322     }
323 
324     /**
325      * @see Comparable#compareTo
326      */
327     public int compareTo(Privilege o)
328     {
329         int cmp = 0;
330         if (this.getPrivilegeCd() != null)
331         {
332             cmp = this.getPrivilegeCd().compareTo(o.getPrivilegeCd());
333         }
334         else
335         {
336             if (this.getPrivilegeNm() != null)
337             {
338                 cmp = (cmp != 0 ? cmp : this.getPrivilegeNm().compareTo(o.getPrivilegeNm()));
339             }
340             if (this.getPrivilegeDc() != null)
341             {
342                 cmp = (cmp != 0 ? cmp : this.getPrivilegeDc().compareTo(o.getPrivilegeDc()));
343             }
344             if (this.getUpdateDt() != null)
345             {
346                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
347             }
348         }
349         return cmp;
350     }
351 // HibernateEntity.vsl merge-point
352 // Privilege.java merge-point
353 }