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