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