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