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