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.administration.metaprogamme;
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.program.Program;
29 import fr.ifremer.quadrige3.core.dao.administration.user.Department;
30 import fr.ifremer.quadrige3.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 * Programme virtuel (métaprogramme)
38 */
39 // HibernateEntity.vsl annotations merge-point
40 public abstract class Metaprogramme
41 implements Serializable, Comparable<Metaprogramme>
42 {
43 /**
44 * The serial version UID of this class. Needed for serialization.
45 */
46 private static final long serialVersionUID = 442571845093938316L;
47
48 // Generate 4 attributes
49 private String metCd;
50
51 /**
52 * Code unique identifiant le métaprogramme
53 * @return this.metCd String
54 */
55 public String getMetCd()
56 {
57 return this.metCd;
58 }
59
60 /**
61 * Code unique identifiant le métaprogramme
62 * @param metCdIn String
63 */
64 public void setMetCd(String metCdIn)
65 {
66 this.metCd = metCdIn;
67 }
68
69 private String metNm;
70
71 /**
72 * Libellé du métaprogramme
73 * @return this.metNm String
74 */
75 public String getMetNm()
76 {
77 return this.metNm;
78 }
79
80 /**
81 * Libellé du métaprogramme
82 * @param metNmIn String
83 */
84 public void setMetNm(String metNmIn)
85 {
86 this.metNm = metNmIn;
87 }
88
89 private String metDc;
90
91 /**
92 * Description longue
93 * @return this.metDc String
94 */
95 public String getMetDc()
96 {
97 return this.metDc;
98 }
99
100 /**
101 * Description longue
102 * @param metDcIn String
103 */
104 public void setMetDc(String metDcIn)
105 {
106 this.metDc = metDcIn;
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 5 associations
130 private Collection<Program> programs = new HashSet<Program>();
131
132 /**
133 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
134 * @return this.programs Collection<Program>
135 */
136 public Collection<Program> getPrograms()
137 {
138 return this.programs;
139 }
140
141 /**
142 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
143 * @param programsIn Collection<Program>
144 */
145 public void setPrograms(Collection<Program> programsIn)
146 {
147 this.programs = programsIn;
148 }
149
150 /**
151 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
152 * @param elementToAdd Program
153 * @return <tt>true</tt> if this collection changed as a result of the
154 * call
155 */
156 public boolean addPrograms(Program elementToAdd)
157 {
158 return this.programs.add(elementToAdd);
159 }
160
161 /**
162 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
163 * @param elementToRemove Program
164 * @return <tt>true</tt> if this collection changed as a result of the
165 * call
166 */
167 public boolean removePrograms(Program elementToRemove)
168 {
169 return this.programs.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 Collection<Quser> qusers = new HashSet<Quser>();
215
216 /**
217 * Liste l'ensemble des agents et utilisateurs du système.
218 * @return this.qusers Collection<Quser>
219 */
220 public Collection<Quser> getQusers()
221 {
222 return this.qusers;
223 }
224
225 /**
226 * Liste l'ensemble des agents et utilisateurs du système.
227 * @param qusersIn Collection<Quser>
228 */
229 public void setQusers(Collection<Quser> qusersIn)
230 {
231 this.qusers = qusersIn;
232 }
233
234 /**
235 * Liste l'ensemble des agents et utilisateurs du système.
236 * @param elementToAdd Quser
237 * @return <tt>true</tt> if this collection changed as a result of the
238 * call
239 */
240 public boolean addQusers(Quser elementToAdd)
241 {
242 return this.qusers.add(elementToAdd);
243 }
244
245 /**
246 * Liste l'ensemble des agents et utilisateurs du système.
247 * @param elementToRemove Quser
248 * @return <tt>true</tt> if this collection changed as a result of the
249 * call
250 */
251 public boolean removeQusers(Quser elementToRemove)
252 {
253 return this.qusers.remove(elementToRemove);
254 }
255
256 private Collection<PmfmMet> pmfmMets = new HashSet<PmfmMet>();
257
258 /**
259 * Liste des PMFM ou éléments constitutifs associés à un programme
260 * @return this.pmfmMets Collection<PmfmMet>
261 */
262 public Collection<PmfmMet> getPmfmMets()
263 {
264 return this.pmfmMets;
265 }
266
267 /**
268 * Liste des PMFM ou éléments constitutifs associés à un programme
269 * @param pmfmMetsIn Collection<PmfmMet>
270 */
271 public void setPmfmMets(Collection<PmfmMet> pmfmMetsIn)
272 {
273 this.pmfmMets = pmfmMetsIn;
274 }
275
276 /**
277 * Liste des PMFM ou éléments constitutifs associés à un programme
278 * @param elementToAdd PmfmMet
279 * @return <tt>true</tt> if this collection changed as a result of the
280 * call
281 */
282 public boolean addPmfmMets(PmfmMet elementToAdd)
283 {
284 return this.pmfmMets.add(elementToAdd);
285 }
286
287 /**
288 * Liste des PMFM ou éléments constitutifs associés à un programme
289 * @param elementToRemove PmfmMet
290 * @return <tt>true</tt> if this collection changed as a result of the
291 * call
292 */
293 public boolean removePmfmMets(PmfmMet elementToRemove)
294 {
295 return this.pmfmMets.remove(elementToRemove);
296 }
297
298 private Collection<MonLocMet> monLocMets = new HashSet<MonLocMet>();
299
300 /**
301 * Liste des lieux d'un métaprogramme
302 * @return this.monLocMets Collection<MonLocMet>
303 */
304 public Collection<MonLocMet> getMonLocMets()
305 {
306 return this.monLocMets;
307 }
308
309 /**
310 * Liste des lieux d'un métaprogramme
311 * @param monLocMetsIn Collection<MonLocMet>
312 */
313 public void setMonLocMets(Collection<MonLocMet> monLocMetsIn)
314 {
315 this.monLocMets = monLocMetsIn;
316 }
317
318 /**
319 * Liste des lieux d'un métaprogramme
320 * @param elementToAdd MonLocMet
321 * @return <tt>true</tt> if this collection changed as a result of the
322 * call
323 */
324 public boolean addMonLocMets(MonLocMet elementToAdd)
325 {
326 return this.monLocMets.add(elementToAdd);
327 }
328
329 /**
330 * Liste des lieux d'un métaprogramme
331 * @param elementToRemove MonLocMet
332 * @return <tt>true</tt> if this collection changed as a result of the
333 * call
334 */
335 public boolean removeMonLocMets(MonLocMet elementToRemove)
336 {
337 return this.monLocMets.remove(elementToRemove);
338 }
339
340 /**
341 * Returns <code>true</code> if the argument is an Metaprogramme instance and all identifiers for this entity
342 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
343 */
344 @Override
345 public boolean equals(Object object)
346 {
347 if (this == object)
348 {
349 return true;
350 }
351 if (!(object instanceof Metaprogramme))
352 {
353 return false;
354 }
355 final Metaprogramme that = (Metaprogramme)object;
356 if (this.metCd == null || that.getMetCd() == null || !this.metCd.equals(that.getMetCd()))
357 {
358 return false;
359 }
360 return true;
361 }
362
363 /**
364 * Returns a hash code based on this entity's identifiers.
365 */
366 @Override
367 public int hashCode()
368 {
369 int hashCode = 0;
370 hashCode = 29 * hashCode + (this.metCd == null ? 0 : this.metCd.hashCode());
371
372 return hashCode;
373 }
374
375 /**
376 * Constructs new instances of {@link Metaprogramme}.
377 */
378 public static final class Factory
379 {
380 /**
381 * Constructs a new instance of {@link Metaprogramme}.
382 * @return new MetaprogrammeImpl()
383 */
384 public static Metaprogramme newInstance()
385 {
386 return new MetaprogrammeImpl();
387 }
388
389 /**
390 * Constructs a new instance of {@link Metaprogramme}, taking all required and/or
391 * read-only properties as arguments, except for identifiers.
392 * @param metNm String
393 * @return newInstance
394 */
395 public static Metaprogramme newInstance(String metNm)
396 {
397 final Metaprogramme entity = new MetaprogrammeImpl();
398 entity.setMetNm(metNm);
399 return entity;
400 }
401
402 /**
403 * Constructs a new instance of {@link Metaprogramme}, taking all possible properties
404 * (except the identifier(s))as arguments.
405 * @param metNm String
406 * @param metDc String
407 * @param updateDt Timestamp
408 * @param programs Collection<Program>
409 * @param departments Collection<Department>
410 * @param qusers Collection<Quser>
411 * @param pmfmMets Collection<PmfmMet>
412 * @param monLocMets Collection<MonLocMet>
413 * @return newInstance Metaprogramme
414 */
415 public static Metaprogramme newInstance(String metNm, String metDc, Timestamp updateDt, Collection<Program> programs, Collection<Department> departments, Collection<Quser> qusers, Collection<PmfmMet> pmfmMets, Collection<MonLocMet> monLocMets)
416 {
417 final Metaprogramme entity = new MetaprogrammeImpl();
418 entity.setMetNm(metNm);
419 entity.setMetDc(metDc);
420 entity.setUpdateDt(updateDt);
421 entity.setPrograms(programs);
422 entity.setDepartments(departments);
423 entity.setQusers(qusers);
424 entity.setPmfmMets(pmfmMets);
425 entity.setMonLocMets(monLocMets);
426 return entity;
427 }
428 }
429
430 /**
431 * @see Comparable#compareTo
432 */
433 public int compareTo(Metaprogramme o)
434 {
435 int cmp = 0;
436 if (this.getMetCd() != null)
437 {
438 cmp = this.getMetCd().compareTo(o.getMetCd());
439 }
440 else
441 {
442 if (this.getMetNm() != null)
443 {
444 cmp = (cmp != 0 ? cmp : this.getMetNm().compareTo(o.getMetNm()));
445 }
446 if (this.getMetDc() != null)
447 {
448 cmp = (cmp != 0 ? cmp : this.getMetDc().compareTo(o.getMetDc()));
449 }
450 if (this.getUpdateDt() != null)
451 {
452 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
453 }
454 }
455 return cmp;
456 }
457 // HibernateEntity.vsl merge-point
458 // Metaprogramme.java merge-point
459 }