1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.administration.strategy;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
40
41
42 public abstract class Strategy
43 implements Serializable, Comparable<Strategy>
44 {
45
46
47
48 private static final long serialVersionUID = -1032764945377952068L;
49
50
51 private Integer stratId;
52
53
54
55
56
57 public Integer getStratId()
58 {
59 return this.stratId;
60 }
61
62
63
64
65
66 public void setStratId(Integer stratIdIn)
67 {
68 this.stratId = stratIdIn;
69 }
70
71 private String stratNm;
72
73
74
75
76
77 public String getStratNm()
78 {
79 return this.stratNm;
80 }
81
82
83
84
85
86 public void setStratNm(String stratNmIn)
87 {
88 this.stratNm = stratNmIn;
89 }
90
91 private String stratDc;
92
93
94
95
96
97 public String getStratDc()
98 {
99 return this.stratDc;
100 }
101
102
103
104
105
106 public void setStratDc(String stratDcIn)
107 {
108 this.stratDc = stratDcIn;
109 }
110
111 private Date stratCreationDt;
112
113
114
115
116
117 public Date getStratCreationDt()
118 {
119 return this.stratCreationDt;
120 }
121
122
123
124
125
126 public void setStratCreationDt(Date stratCreationDtIn)
127 {
128 this.stratCreationDt = stratCreationDtIn;
129 }
130
131 private Timestamp updateDt;
132
133
134
135
136
137 public Timestamp getUpdateDt()
138 {
139 return this.updateDt;
140 }
141
142
143
144
145
146 public void setUpdateDt(Timestamp updateDtIn)
147 {
148 this.updateDt = updateDtIn;
149 }
150
151
152 private Collection<Quser> qusers = new HashSet<Quser>();
153
154
155
156
157
158 public Collection<Quser> getQusers()
159 {
160 return this.qusers;
161 }
162
163
164
165
166
167 public void setQusers(Collection<Quser> qusersIn)
168 {
169 this.qusers = qusersIn;
170 }
171
172
173
174
175
176
177
178 public boolean addQusers(Quser elementToAdd)
179 {
180 return this.qusers.add(elementToAdd);
181 }
182
183
184
185
186
187
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
198
199
200 public Collection<Department> getDepartments()
201 {
202 return this.departments;
203 }
204
205
206
207
208
209 public void setDepartments(Collection<Department> departmentsIn)
210 {
211 this.departments = departmentsIn;
212 }
213
214
215
216
217
218
219
220 public boolean addDepartments(Department elementToAdd)
221 {
222 return this.departments.add(elementToAdd);
223 }
224
225
226
227
228
229
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
240
241
242
243 public Collection<PmfmStrategy> getPmfmStrategies()
244 {
245 return this.pmfmStrategies;
246 }
247
248
249
250
251
252
253 public void setPmfmStrategies(Collection<PmfmStrategy> pmfmStrategiesIn)
254 {
255 this.pmfmStrategies = pmfmStrategiesIn;
256 }
257
258
259
260
261
262
263
264
265 public boolean addPmfmStrategies(PmfmStrategy elementToAdd)
266 {
267 return this.pmfmStrategies.add(elementToAdd);
268 }
269
270
271
272
273
274
275
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
286
287
288 public Collection<AppliedStrategy> getAppliedStrategies()
289 {
290 return this.appliedStrategies;
291 }
292
293
294
295
296
297 public void setAppliedStrategies(Collection<AppliedStrategy> appliedStrategiesIn)
298 {
299 this.appliedStrategies = appliedStrategiesIn;
300 }
301
302
303
304
305
306
307
308 public boolean addAppliedStrategies(AppliedStrategy elementToAdd)
309 {
310 return this.appliedStrategies.add(elementToAdd);
311 }
312
313
314
315
316
317
318
319 public boolean removeAppliedStrategies(AppliedStrategy elementToRemove)
320 {
321 return this.appliedStrategies.remove(elementToRemove);
322 }
323
324 private Program program;
325
326
327
328
329
330 public Program getProgram()
331 {
332 return this.program;
333 }
334
335
336
337
338
339 public void setProgram(Program programIn)
340 {
341 this.program = programIn;
342 }
343
344
345
346
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
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
381
382 public static final class Factory
383 {
384
385
386
387
388 public static Strategy newInstance()
389 {
390 return new StrategyImpl();
391 }
392
393
394
395
396
397
398
399
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
412
413
414
415
416
417
418
419
420
421
422
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
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
472
473 }