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