1
2
3
4
5
6 package fr.ifremer.quadrige3.core.dao.data.sample;
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.data.samplingoperation.SamplingOperation;
31 import fr.ifremer.quadrige3.core.dao.referential.QualityFlag;
32 import fr.ifremer.quadrige3.core.dao.referential.Unit;
33 import fr.ifremer.quadrige3.core.dao.referential.pmfm.Matrix;
34 import fr.ifremer.quadrige3.core.dao.referential.taxon.ReferenceTaxon;
35 import fr.ifremer.quadrige3.core.dao.referential.taxon.TaxonGroup;
36 import java.io.Serializable;
37 import java.sql.Timestamp;
38 import java.util.Collection;
39 import java.util.Date;
40 import java.util.HashSet;
41
42
43
44
45
46 public abstract class Sample
47 implements Serializable, Comparable<Sample>
48 {
49
50
51
52 private static final long serialVersionUID = -3828429413281029208L;
53
54
55 private Integer sampleId;
56
57
58
59
60
61 public Integer getSampleId()
62 {
63 return this.sampleId;
64 }
65
66
67
68
69
70 public void setSampleId(Integer sampleIdIn)
71 {
72 this.sampleId = sampleIdIn;
73 }
74
75 private String sampleLb;
76
77
78
79
80
81 public String getSampleLb()
82 {
83 return this.sampleLb;
84 }
85
86
87
88
89
90 public void setSampleLb(String sampleLbIn)
91 {
92 this.sampleLb = sampleLbIn;
93 }
94
95 private Integer sampleNumberIndiv;
96
97
98
99
100
101
102 public Integer getSampleNumberIndiv()
103 {
104 return this.sampleNumberIndiv;
105 }
106
107
108
109
110
111
112 public void setSampleNumberIndiv(Integer sampleNumberIndivIn)
113 {
114 this.sampleNumberIndiv = sampleNumberIndivIn;
115 }
116
117 private Float sampleSize;
118
119
120
121
122
123
124 public Float getSampleSize()
125 {
126 return this.sampleSize;
127 }
128
129
130
131
132
133
134 public void setSampleSize(Float sampleSizeIn)
135 {
136 this.sampleSize = sampleSizeIn;
137 }
138
139 private String sampleCm;
140
141
142
143
144
145 public String getSampleCm()
146 {
147 return this.sampleCm;
148 }
149
150
151
152
153
154 public void setSampleCm(String sampleCmIn)
155 {
156 this.sampleCm = sampleCmIn;
157 }
158
159 private Date sampleControlDt;
160
161
162
163
164
165 public Date getSampleControlDt()
166 {
167 return this.sampleControlDt;
168 }
169
170
171
172
173
174 public void setSampleControlDt(Date sampleControlDtIn)
175 {
176 this.sampleControlDt = sampleControlDtIn;
177 }
178
179 private Date sampleValidDt;
180
181
182
183
184
185 public Date getSampleValidDt()
186 {
187 return this.sampleValidDt;
188 }
189
190
191
192
193
194 public void setSampleValidDt(Date sampleValidDtIn)
195 {
196 this.sampleValidDt = sampleValidDtIn;
197 }
198
199 private Date sampleQualifDt;
200
201
202
203
204
205 public Date getSampleQualifDt()
206 {
207 return this.sampleQualifDt;
208 }
209
210
211
212
213
214 public void setSampleQualifDt(Date sampleQualifDtIn)
215 {
216 this.sampleQualifDt = sampleQualifDtIn;
217 }
218
219 private String sampleQualifCm;
220
221
222
223
224
225 public String getSampleQualifCm()
226 {
227 return this.sampleQualifCm;
228 }
229
230
231
232
233
234 public void setSampleQualifCm(String sampleQualifCmIn)
235 {
236 this.sampleQualifCm = sampleQualifCmIn;
237 }
238
239 private String sampleScope;
240
241
242
243
244
245
246 public String getSampleScope()
247 {
248 return this.sampleScope;
249 }
250
251
252
253
254
255
256 public void setSampleScope(String sampleScopeIn)
257 {
258 this.sampleScope = sampleScopeIn;
259 }
260
261 private String sampleHasMeas;
262
263
264
265
266
267 public String getSampleHasMeas()
268 {
269 return this.sampleHasMeas;
270 }
271
272
273
274
275
276 public void setSampleHasMeas(String sampleHasMeasIn)
277 {
278 this.sampleHasMeas = sampleHasMeasIn;
279 }
280
281 private Timestamp updateDt;
282
283
284
285
286
287 public Timestamp getUpdateDt()
288 {
289 return this.updateDt;
290 }
291
292
293
294
295
296 public void setUpdateDt(Timestamp updateDtIn)
297 {
298 this.updateDt = updateDtIn;
299 }
300
301 private Integer remoteId;
302
303
304
305
306
307 public Integer getRemoteId()
308 {
309 return this.remoteId;
310 }
311
312
313
314
315
316 public void setRemoteId(Integer remoteIdIn)
317 {
318 this.remoteId = remoteIdIn;
319 }
320
321
322 private QualityFlag qualityFlag;
323
324
325
326
327
328 public QualityFlag getQualityFlag()
329 {
330 return this.qualityFlag;
331 }
332
333
334
335
336
337 public void setQualityFlag(QualityFlag qualityFlagIn)
338 {
339 this.qualityFlag = qualityFlagIn;
340 }
341
342 private TaxonGroup taxonGroup;
343
344
345
346
347
348 public TaxonGroup getTaxonGroup()
349 {
350 return this.taxonGroup;
351 }
352
353
354
355
356
357 public void setTaxonGroup(TaxonGroup taxonGroupIn)
358 {
359 this.taxonGroup = taxonGroupIn;
360 }
361
362 private Unit sizeUnit;
363
364
365
366
367
368 public Unit getSizeUnit()
369 {
370 return this.sizeUnit;
371 }
372
373
374
375
376
377 public void setSizeUnit(Unit sizeUnitIn)
378 {
379 this.sizeUnit = sizeUnitIn;
380 }
381
382 private Collection<Program> programs = new HashSet<Program>();
383
384
385
386
387
388 public Collection<Program> getPrograms()
389 {
390 return this.programs;
391 }
392
393
394
395
396
397 public void setPrograms(Collection<Program> programsIn)
398 {
399 this.programs = programsIn;
400 }
401
402
403
404
405
406
407
408 public boolean addPrograms(Program elementToAdd)
409 {
410 return this.programs.add(elementToAdd);
411 }
412
413
414
415
416
417
418
419 public boolean removePrograms(Program elementToRemove)
420 {
421 return this.programs.remove(elementToRemove);
422 }
423
424 private Department recorderDepartment;
425
426
427
428
429
430 public Department getRecorderDepartment()
431 {
432 return this.recorderDepartment;
433 }
434
435
436
437
438
439 public void setRecorderDepartment(Department recorderDepartmentIn)
440 {
441 this.recorderDepartment = recorderDepartmentIn;
442 }
443
444 private SamplingOperation samplingOperation;
445
446
447
448
449
450 public SamplingOperation getSamplingOperation()
451 {
452 return this.samplingOperation;
453 }
454
455
456
457
458
459 public void setSamplingOperation(SamplingOperation samplingOperationIn)
460 {
461 this.samplingOperation = samplingOperationIn;
462 }
463
464 private Matrix matrix;
465
466
467
468
469
470 public Matrix getMatrix()
471 {
472 return this.matrix;
473 }
474
475
476
477
478
479 public void setMatrix(Matrix matrixIn)
480 {
481 this.matrix = matrixIn;
482 }
483
484 private ReferenceTaxon referenceTaxon;
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522 public ReferenceTaxon getReferenceTaxon()
523 {
524 return this.referenceTaxon;
525 }
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563 public void setReferenceTaxon(ReferenceTaxon referenceTaxonIn)
564 {
565 this.referenceTaxon = referenceTaxonIn;
566 }
567
568
569
570
571
572 @Override
573 public boolean equals(Object object)
574 {
575 if (this == object)
576 {
577 return true;
578 }
579 if (!(object instanceof Sample))
580 {
581 return false;
582 }
583 final Sample that = (Sample)object;
584 if (this.sampleId == null || that.getSampleId() == null || !this.sampleId.equals(that.getSampleId()))
585 {
586 return false;
587 }
588 return true;
589 }
590
591
592
593
594 @Override
595 public int hashCode()
596 {
597 int hashCode = 0;
598 hashCode = 29 * hashCode + (this.sampleId == null ? 0 : this.sampleId.hashCode());
599
600 return hashCode;
601 }
602
603
604
605
606 public static final class Factory
607 {
608
609
610
611
612 public static Sample newInstance()
613 {
614 return new SampleImpl();
615 }
616
617
618
619
620
621
622
623
624
625
626 public static Sample newInstance(QualityFlag qualityFlag, Department recorderDepartment, SamplingOperation samplingOperation, Matrix matrix)
627 {
628 final Sample entity = new SampleImpl();
629 entity.setQualityFlag(qualityFlag);
630 entity.setRecorderDepartment(recorderDepartment);
631 entity.setSamplingOperation(samplingOperation);
632 entity.setMatrix(matrix);
633 return entity;
634 }
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661 public static Sample newInstance(String sampleLb, Integer sampleNumberIndiv, Float sampleSize, String sampleCm, Date sampleControlDt, Date sampleValidDt, Date sampleQualifDt, String sampleQualifCm, String sampleScope, String sampleHasMeas, Timestamp updateDt, Integer remoteId, QualityFlag qualityFlag, TaxonGroup taxonGroup, Unit sizeUnit, Collection<Program> programs, Department recorderDepartment, SamplingOperation samplingOperation, Matrix matrix, ReferenceTaxon referenceTaxon)
662 {
663 final Sample entity = new SampleImpl();
664 entity.setSampleLb(sampleLb);
665 entity.setSampleNumberIndiv(sampleNumberIndiv);
666 entity.setSampleSize(sampleSize);
667 entity.setSampleCm(sampleCm);
668 entity.setSampleControlDt(sampleControlDt);
669 entity.setSampleValidDt(sampleValidDt);
670 entity.setSampleQualifDt(sampleQualifDt);
671 entity.setSampleQualifCm(sampleQualifCm);
672 entity.setSampleScope(sampleScope);
673 entity.setSampleHasMeas(sampleHasMeas);
674 entity.setUpdateDt(updateDt);
675 entity.setRemoteId(remoteId);
676 entity.setQualityFlag(qualityFlag);
677 entity.setTaxonGroup(taxonGroup);
678 entity.setSizeUnit(sizeUnit);
679 entity.setPrograms(programs);
680 entity.setRecorderDepartment(recorderDepartment);
681 entity.setSamplingOperation(samplingOperation);
682 entity.setMatrix(matrix);
683 entity.setReferenceTaxon(referenceTaxon);
684 return entity;
685 }
686 }
687
688
689
690
691 public int compareTo(Sample o)
692 {
693 int cmp = 0;
694 if (this.getSampleId() != null)
695 {
696 cmp = this.getSampleId().compareTo(o.getSampleId());
697 }
698 else
699 {
700 if (this.getSampleLb() != null)
701 {
702 cmp = (cmp != 0 ? cmp : this.getSampleLb().compareTo(o.getSampleLb()));
703 }
704 if (this.getSampleNumberIndiv() != null)
705 {
706 cmp = (cmp != 0 ? cmp : this.getSampleNumberIndiv().compareTo(o.getSampleNumberIndiv()));
707 }
708 if (this.getSampleSize() != null)
709 {
710 cmp = (cmp != 0 ? cmp : this.getSampleSize().compareTo(o.getSampleSize()));
711 }
712 if (this.getSampleCm() != null)
713 {
714 cmp = (cmp != 0 ? cmp : this.getSampleCm().compareTo(o.getSampleCm()));
715 }
716 if (this.getSampleControlDt() != null)
717 {
718 cmp = (cmp != 0 ? cmp : this.getSampleControlDt().compareTo(o.getSampleControlDt()));
719 }
720 if (this.getSampleValidDt() != null)
721 {
722 cmp = (cmp != 0 ? cmp : this.getSampleValidDt().compareTo(o.getSampleValidDt()));
723 }
724 if (this.getSampleQualifDt() != null)
725 {
726 cmp = (cmp != 0 ? cmp : this.getSampleQualifDt().compareTo(o.getSampleQualifDt()));
727 }
728 if (this.getSampleQualifCm() != null)
729 {
730 cmp = (cmp != 0 ? cmp : this.getSampleQualifCm().compareTo(o.getSampleQualifCm()));
731 }
732 if (this.getSampleScope() != null)
733 {
734 cmp = (cmp != 0 ? cmp : this.getSampleScope().compareTo(o.getSampleScope()));
735 }
736 if (this.getSampleHasMeas() != null)
737 {
738 cmp = (cmp != 0 ? cmp : this.getSampleHasMeas().compareTo(o.getSampleHasMeas()));
739 }
740 if (this.getUpdateDt() != null)
741 {
742 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
743 }
744 if (this.getRemoteId() != null)
745 {
746 cmp = (cmp != 0 ? cmp : this.getRemoteId().compareTo(o.getRemoteId()));
747 }
748 }
749 return cmp;
750 }
751
752
753 }