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.quadrige3.core.dao.referential;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 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 import fr.ifremer.quadrige3.core.dao.administration.user.Department;
29 import fr.ifremer.quadrige3.core.dao.administration.user.Quser;
30 import java.io.Serializable;
31 import java.sql.Timestamp;
32 import java.util.Collection;
33 import java.util.HashSet;
34
35 /**
36 * Ensemble des privilèges utilisateurs.
37 */
38 // HibernateEntity.vsl annotations merge-point
39 public abstract class Privilege
40 implements Serializable, Comparable<Privilege>
41 {
42 /**
43 * The serial version UID of this class. Needed for serialization.
44 */
45 private static final long serialVersionUID = 1511838935936723158L;
46
47 // Generate 4 attributes
48 private String privilegeCd;
49
50 /**
51 * Code unique du profil
52 * @return this.privilegeCd String
53 */
54 public String getPrivilegeCd()
55 {
56 return this.privilegeCd;
57 }
58
59 /**
60 * Code unique du profil
61 * @param privilegeCdIn String
62 */
63 public void setPrivilegeCd(String privilegeCdIn)
64 {
65 this.privilegeCd = privilegeCdIn;
66 }
67
68 private String privilegeNm;
69
70 /**
71 * Llibellé décrivant le profil
72 * @return this.privilegeNm String
73 */
74 public String getPrivilegeNm()
75 {
76 return this.privilegeNm;
77 }
78
79 /**
80 * Llibellé décrivant le profil
81 * @param privilegeNmIn String
82 */
83 public void setPrivilegeNm(String privilegeNmIn)
84 {
85 this.privilegeNm = privilegeNmIn;
86 }
87
88 private String privilegeDc;
89
90 /**
91 * Description du profil
92 * @return this.privilegeDc String
93 */
94 public String getPrivilegeDc()
95 {
96 return this.privilegeDc;
97 }
98
99 /**
100 * Description du profil
101 * @param privilegeDcIn String
102 */
103 public void setPrivilegeDc(String privilegeDcIn)
104 {
105 this.privilegeDc = privilegeDcIn;
106 }
107
108 private Timestamp updateDt;
109
110 /**
111 * Date de modification de l'objet, mise à jour par le système
112 * @return this.updateDt Timestamp
113 */
114 public Timestamp getUpdateDt()
115 {
116 return this.updateDt;
117 }
118
119 /**
120 * Date de modification de l'objet, mise à jour par le système
121 * @param updateDtIn Timestamp
122 */
123 public void setUpdateDt(Timestamp updateDtIn)
124 {
125 this.updateDt = updateDtIn;
126 }
127
128 // Generate 3 associations
129 private Collection<Quser> qusers = new HashSet<Quser>();
130
131 /**
132 * Liste l'ensemble des agents et utilisateurs du système.
133 * @return this.qusers Collection<Quser>
134 */
135 public Collection<Quser> getQusers()
136 {
137 return this.qusers;
138 }
139
140 /**
141 * Liste l'ensemble des agents et utilisateurs du système.
142 * @param qusersIn Collection<Quser>
143 */
144 public void setQusers(Collection<Quser> qusersIn)
145 {
146 this.qusers = qusersIn;
147 }
148
149 /**
150 * Liste l'ensemble des agents et utilisateurs du système.
151 * @param elementToAdd Quser
152 * @return <tt>true</tt> if this collection changed as a result of the
153 * call
154 */
155 public boolean addQusers(Quser elementToAdd)
156 {
157 return this.qusers.add(elementToAdd);
158 }
159
160 /**
161 * Liste l'ensemble des agents et utilisateurs du système.
162 * @param elementToRemove Quser
163 * @return <tt>true</tt> if this collection changed as a result of the
164 * call
165 */
166 public boolean removeQusers(Quser elementToRemove)
167 {
168 return this.qusers.remove(elementToRemove);
169 }
170
171 private Collection<Department> departments = new HashSet<Department>();
172
173 /**
174 * Liste les départements ou services auxquels sont rattachés les agents
175 * @return this.departments Collection<Department>
176 */
177 public Collection<Department> getDepartments()
178 {
179 return this.departments;
180 }
181
182 /**
183 * Liste les départements ou services auxquels sont rattachés les agents
184 * @param departmentsIn Collection<Department>
185 */
186 public void setDepartments(Collection<Department> departmentsIn)
187 {
188 this.departments = departmentsIn;
189 }
190
191 /**
192 * Liste les départements ou services auxquels sont rattachés les agents
193 * @param elementToAdd Department
194 * @return <tt>true</tt> if this collection changed as a result of the
195 * call
196 */
197 public boolean addDepartments(Department elementToAdd)
198 {
199 return this.departments.add(elementToAdd);
200 }
201
202 /**
203 * Liste les départements ou services auxquels sont rattachés les agents
204 * @param elementToRemove Department
205 * @return <tt>true</tt> if this collection changed as a result of the
206 * call
207 */
208 public boolean removeDepartments(Department elementToRemove)
209 {
210 return this.departments.remove(elementToRemove);
211 }
212
213 private Status status;
214
215 /**
216 * Liste des états possibles d'un objet.
217 * @return this.status Status
218 */
219 public Status getStatus()
220 {
221 return this.status;
222 }
223
224 /**
225 * Liste des états possibles d'un objet.
226 * @param statusIn Status
227 */
228 public void setStatus(Status statusIn)
229 {
230 this.status = statusIn;
231 }
232
233 /**
234 * Returns <code>true</code> if the argument is an Privilege instance and all identifiers for this entity
235 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
236 */
237 @Override
238 public boolean equals(Object object)
239 {
240 if (this == object)
241 {
242 return true;
243 }
244 if (!(object instanceof Privilege))
245 {
246 return false;
247 }
248 final Privilege that = (Privilege)object;
249 if (this.privilegeCd == null || that.getPrivilegeCd() == null || !this.privilegeCd.equals(that.getPrivilegeCd()))
250 {
251 return false;
252 }
253 return true;
254 }
255
256 /**
257 * Returns a hash code based on this entity's identifiers.
258 */
259 @Override
260 public int hashCode()
261 {
262 int hashCode = 0;
263 hashCode = 29 * hashCode + (this.privilegeCd == null ? 0 : this.privilegeCd.hashCode());
264
265 return hashCode;
266 }
267
268 /**
269 * Constructs new instances of {@link Privilege}.
270 */
271 public static final class Factory
272 {
273 /**
274 * Constructs a new instance of {@link Privilege}.
275 * @return new PrivilegeImpl()
276 */
277 public static Privilege newInstance()
278 {
279 return new PrivilegeImpl();
280 }
281
282 /**
283 * Constructs a new instance of {@link Privilege}, taking all required and/or
284 * read-only properties as arguments, except for identifiers.
285 * @param privilegeNm String
286 * @param status Status
287 * @return newInstance
288 */
289 public static Privilege newInstance(String privilegeNm, Status status)
290 {
291 final Privilege entity = new PrivilegeImpl();
292 entity.setPrivilegeNm(privilegeNm);
293 entity.setStatus(status);
294 return entity;
295 }
296
297 /**
298 * Constructs a new instance of {@link Privilege}, taking all possible properties
299 * (except the identifier(s))as arguments.
300 * @param privilegeNm String
301 * @param privilegeDc String
302 * @param updateDt Timestamp
303 * @param qusers Collection<Quser>
304 * @param departments Collection<Department>
305 * @param status Status
306 * @return newInstance Privilege
307 */
308 public static Privilege newInstance(String privilegeNm, String privilegeDc, Timestamp updateDt, Collection<Quser> qusers, Collection<Department> departments, Status status)
309 {
310 final Privilege entity = new PrivilegeImpl();
311 entity.setPrivilegeNm(privilegeNm);
312 entity.setPrivilegeDc(privilegeDc);
313 entity.setUpdateDt(updateDt);
314 entity.setQusers(qusers);
315 entity.setDepartments(departments);
316 entity.setStatus(status);
317 return entity;
318 }
319 }
320
321 /**
322 * @see Comparable#compareTo
323 */
324 public int compareTo(Privilege o)
325 {
326 int cmp = 0;
327 if (this.getPrivilegeCd() != null)
328 {
329 cmp = this.getPrivilegeCd().compareTo(o.getPrivilegeCd());
330 }
331 else
332 {
333 if (this.getPrivilegeNm() != null)
334 {
335 cmp = (cmp != 0 ? cmp : this.getPrivilegeNm().compareTo(o.getPrivilegeNm()));
336 }
337 if (this.getPrivilegeDc() != null)
338 {
339 cmp = (cmp != 0 ? cmp : this.getPrivilegeDc().compareTo(o.getPrivilegeDc()));
340 }
341 if (this.getUpdateDt() != null)
342 {
343 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
344 }
345 }
346 return cmp;
347 }
348 // HibernateEntity.vsl merge-point
349 // Privilege.java merge-point
350 }