1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.referential.pmfm;
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.PmfmMor;
30 import fr.ifremer.quadrige2.core.dao.referential.Status;
31 import fr.ifremer.quadrige2.core.dao.sandre.SandreMatrixExp;
32 import fr.ifremer.quadrige2.core.dao.sandre.SandreMatrixImp;
33 import java.io.Serializable;
34 import java.sql.Timestamp;
35 import java.util.Collection;
36 import java.util.Date;
37 import java.util.HashSet;
38
39
40
41
42
43 public abstract class Matrix
44 implements Serializable, Comparable<Matrix>
45 {
46
47
48
49 private static final long serialVersionUID = -463569381304079176L;
50
51
52 private Integer matrixId;
53
54
55
56
57
58 public Integer getMatrixId()
59 {
60 return this.matrixId;
61 }
62
63
64
65
66
67 public void setMatrixId(Integer matrixIdIn)
68 {
69 this.matrixId = matrixIdIn;
70 }
71
72 private String matrixNm;
73
74
75
76
77
78 public String getMatrixNm()
79 {
80 return this.matrixNm;
81 }
82
83
84
85
86
87 public void setMatrixNm(String matrixNmIn)
88 {
89 this.matrixNm = matrixNmIn;
90 }
91
92 private String matrixDc;
93
94
95
96
97
98 public String getMatrixDc()
99 {
100 return this.matrixDc;
101 }
102
103
104
105
106
107 public void setMatrixDc(String matrixDcIn)
108 {
109 this.matrixDc = matrixDcIn;
110 }
111
112 private Date matrixCreationDt;
113
114
115
116
117
118 public Date getMatrixCreationDt()
119 {
120 return this.matrixCreationDt;
121 }
122
123
124
125
126
127 public void setMatrixCreationDt(Date matrixCreationDtIn)
128 {
129 this.matrixCreationDt = matrixCreationDtIn;
130 }
131
132 private Timestamp updateDt;
133
134
135
136
137
138 public Timestamp getUpdateDt()
139 {
140 return this.updateDt;
141 }
142
143
144
145
146
147 public void setUpdateDt(Timestamp updateDtIn)
148 {
149 this.updateDt = updateDtIn;
150 }
151
152
153 private Collection<Pmfm> pmfms = new HashSet<Pmfm>();
154
155
156
157
158
159 public Collection<Pmfm> getPmfms()
160 {
161 return this.pmfms;
162 }
163
164
165
166
167
168 public void setPmfms(Collection<Pmfm> pmfmsIn)
169 {
170 this.pmfms = pmfmsIn;
171 }
172
173
174
175
176
177
178
179 public boolean addPmfms(Pmfm elementToAdd)
180 {
181 return this.pmfms.add(elementToAdd);
182 }
183
184
185
186
187
188
189
190 public boolean removePmfms(Pmfm elementToRemove)
191 {
192 return this.pmfms.remove(elementToRemove);
193 }
194
195 private Collection<SandreMatrixExp> sandreMatrixExpIds = new HashSet<SandreMatrixExp>();
196
197
198
199
200
201 public Collection<SandreMatrixExp> getSandreMatrixExpIds()
202 {
203 return this.sandreMatrixExpIds;
204 }
205
206
207
208
209
210 public void setSandreMatrixExpIds(Collection<SandreMatrixExp> sandreMatrixExpIdsIn)
211 {
212 this.sandreMatrixExpIds = sandreMatrixExpIdsIn;
213 }
214
215
216
217
218
219
220
221 public boolean addSandreMatrixExpIds(SandreMatrixExp elementToAdd)
222 {
223 return this.sandreMatrixExpIds.add(elementToAdd);
224 }
225
226
227
228
229
230
231
232 public boolean removeSandreMatrixExpIds(SandreMatrixExp elementToRemove)
233 {
234 return this.sandreMatrixExpIds.remove(elementToRemove);
235 }
236
237 private Collection<Fraction> fractions = new HashSet<Fraction>();
238
239
240
241
242
243 public Collection<Fraction> getFractions()
244 {
245 return this.fractions;
246 }
247
248
249
250
251
252 public void setFractions(Collection<Fraction> fractionsIn)
253 {
254 this.fractions = fractionsIn;
255 }
256
257
258
259
260
261
262
263 public boolean addFractions(Fraction elementToAdd)
264 {
265 return this.fractions.add(elementToAdd);
266 }
267
268
269
270
271
272
273
274 public boolean removeFractions(Fraction elementToRemove)
275 {
276 return this.fractions.remove(elementToRemove);
277 }
278
279 private Collection<SandreMatrixImp> sandreMatrixImpIds = new HashSet<SandreMatrixImp>();
280
281
282
283
284
285 public Collection<SandreMatrixImp> getSandreMatrixImpIds()
286 {
287 return this.sandreMatrixImpIds;
288 }
289
290
291
292
293
294 public void setSandreMatrixImpIds(Collection<SandreMatrixImp> sandreMatrixImpIdsIn)
295 {
296 this.sandreMatrixImpIds = sandreMatrixImpIdsIn;
297 }
298
299
300
301
302
303
304
305 public boolean addSandreMatrixImpIds(SandreMatrixImp elementToAdd)
306 {
307 return this.sandreMatrixImpIds.add(elementToAdd);
308 }
309
310
311
312
313
314
315
316 public boolean removeSandreMatrixImpIds(SandreMatrixImp elementToRemove)
317 {
318 return this.sandreMatrixImpIds.remove(elementToRemove);
319 }
320
321 private Status status;
322
323
324
325
326
327 public Status getStatus()
328 {
329 return this.status;
330 }
331
332
333
334
335
336 public void setStatus(Status statusIn)
337 {
338 this.status = statusIn;
339 }
340
341 private Collection<PmfmMor> pmfmMors = new HashSet<PmfmMor>();
342
343
344
345
346
347 public Collection<PmfmMor> getPmfmMors()
348 {
349 return this.pmfmMors;
350 }
351
352
353
354
355
356 public void setPmfmMors(Collection<PmfmMor> pmfmMorsIn)
357 {
358 this.pmfmMors = pmfmMorsIn;
359 }
360
361
362
363
364
365
366
367 public boolean addPmfmMors(PmfmMor elementToAdd)
368 {
369 return this.pmfmMors.add(elementToAdd);
370 }
371
372
373
374
375
376
377
378 public boolean removePmfmMors(PmfmMor elementToRemove)
379 {
380 return this.pmfmMors.remove(elementToRemove);
381 }
382
383
384
385
386
387 @Override
388 public boolean equals(Object object)
389 {
390 if (this == object)
391 {
392 return true;
393 }
394 if (!(object instanceof Matrix))
395 {
396 return false;
397 }
398 final Matrix that = (Matrix)object;
399 if (this.matrixId == null || that.getMatrixId() == null || !this.matrixId.equals(that.getMatrixId()))
400 {
401 return false;
402 }
403 return true;
404 }
405
406
407
408
409 @Override
410 public int hashCode()
411 {
412 int hashCode = 0;
413 hashCode = 29 * hashCode + (this.matrixId == null ? 0 : this.matrixId.hashCode());
414
415 return hashCode;
416 }
417
418
419
420
421 public static final class Factory
422 {
423
424
425
426
427 public static Matrix newInstance()
428 {
429 return new MatrixImpl();
430 }
431
432
433
434
435
436
437
438
439
440 public static Matrix newInstance(String matrixNm, Timestamp updateDt, Status status)
441 {
442 final Matrix entity = new MatrixImpl();
443 entity.setMatrixNm(matrixNm);
444 entity.setUpdateDt(updateDt);
445 entity.setStatus(status);
446 return entity;
447 }
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464 public static Matrix newInstance(String matrixNm, String matrixDc, Date matrixCreationDt, Timestamp updateDt, Collection<Pmfm> pmfms, Collection<SandreMatrixExp> sandreMatrixExpIds, Collection<Fraction> fractions, Collection<SandreMatrixImp> sandreMatrixImpIds, Status status, Collection<PmfmMor> pmfmMors)
465 {
466 final Matrix entity = new MatrixImpl();
467 entity.setMatrixNm(matrixNm);
468 entity.setMatrixDc(matrixDc);
469 entity.setMatrixCreationDt(matrixCreationDt);
470 entity.setUpdateDt(updateDt);
471 entity.setPmfms(pmfms);
472 entity.setSandreMatrixExpIds(sandreMatrixExpIds);
473 entity.setFractions(fractions);
474 entity.setSandreMatrixImpIds(sandreMatrixImpIds);
475 entity.setStatus(status);
476 entity.setPmfmMors(pmfmMors);
477 return entity;
478 }
479 }
480
481
482
483
484 public int compareTo(Matrix o)
485 {
486 int cmp = 0;
487 if (this.getMatrixId() != null)
488 {
489 cmp = this.getMatrixId().compareTo(o.getMatrixId());
490 }
491 else
492 {
493 if (this.getMatrixNm() != null)
494 {
495 cmp = (cmp != 0 ? cmp : this.getMatrixNm().compareTo(o.getMatrixNm()));
496 }
497 if (this.getMatrixDc() != null)
498 {
499 cmp = (cmp != 0 ? cmp : this.getMatrixDc().compareTo(o.getMatrixDc()));
500 }
501 if (this.getMatrixCreationDt() != null)
502 {
503 cmp = (cmp != 0 ? cmp : this.getMatrixCreationDt().compareTo(o.getMatrixCreationDt()));
504 }
505 if (this.getUpdateDt() != null)
506 {
507 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
508 }
509 }
510 return cmp;
511 }
512
513
514 }