1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.data.measurement;
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.sample.Sample;
32 import fr.ifremer.quadrige2.core.dao.data.samplingoperation.SamplingOperation;
33 import fr.ifremer.quadrige2.core.dao.data.survey.Survey;
34 import fr.ifremer.quadrige2.core.dao.referential.AnalysisInstrument;
35 import fr.ifremer.quadrige2.core.dao.referential.NumericalPrecision;
36 import fr.ifremer.quadrige2.core.dao.referential.ObjectType;
37 import fr.ifremer.quadrige2.core.dao.referential.PrecisionType;
38 import fr.ifremer.quadrige2.core.dao.referential.QualityFlag;
39 import fr.ifremer.quadrige2.core.dao.referential.pmfm.Pmfm;
40 import fr.ifremer.quadrige2.core.dao.referential.pmfm.QualitativeValue;
41 import java.io.Serializable;
42 import java.sql.Timestamp;
43 import java.util.Collection;
44 import java.util.Date;
45 import java.util.HashSet;
46
47
48
49
50
51 public abstract class Measurement
52 implements Serializable, Comparable<Measurement>
53 {
54
55
56
57 private static final long serialVersionUID = -4789419090814912916L;
58
59
60 private Integer measId;
61
62
63
64
65
66 public Integer getMeasId()
67 {
68 return this.measId;
69 }
70
71
72
73
74
75 public void setMeasId(Integer measIdIn)
76 {
77 this.measId = measIdIn;
78 }
79
80 private Integer objectId;
81
82
83
84
85
86 public Integer getObjectId()
87 {
88 return this.objectId;
89 }
90
91
92
93
94
95 public void setObjectId(Integer objectIdIn)
96 {
97 this.objectId = objectIdIn;
98 }
99
100 private Integer measIndivId;
101
102
103
104
105
106 public Integer getMeasIndivId()
107 {
108 return this.measIndivId;
109 }
110
111
112
113
114
115 public void setMeasIndivId(Integer measIndivIdIn)
116 {
117 this.measIndivId = measIndivIdIn;
118 }
119
120 private Float measNumerValue;
121
122
123
124
125
126 public Float getMeasNumerValue()
127 {
128 return this.measNumerValue;
129 }
130
131
132
133
134
135 public void setMeasNumerValue(Float measNumerValueIn)
136 {
137 this.measNumerValue = measNumerValueIn;
138 }
139
140 private Float measPrecisionValue;
141
142
143
144
145
146 public Float getMeasPrecisionValue()
147 {
148 return this.measPrecisionValue;
149 }
150
151
152
153
154
155 public void setMeasPrecisionValue(Float measPrecisionValueIn)
156 {
157 this.measPrecisionValue = measPrecisionValueIn;
158 }
159
160 private Double measDigitNumber;
161
162
163
164
165
166
167 public Double getMeasDigitNumber()
168 {
169 return this.measDigitNumber;
170 }
171
172
173
174
175
176
177 public void setMeasDigitNumber(Double measDigitNumberIn)
178 {
179 this.measDigitNumber = measDigitNumberIn;
180 }
181
182 private Date measControlDt;
183
184
185
186
187
188 public Date getMeasControlDt()
189 {
190 return this.measControlDt;
191 }
192
193
194
195
196
197 public void setMeasControlDt(Date measControlDtIn)
198 {
199 this.measControlDt = measControlDtIn;
200 }
201
202 private Date measValidDt;
203
204
205
206
207
208 public Date getMeasValidDt()
209 {
210 return this.measValidDt;
211 }
212
213
214
215
216
217 public void setMeasValidDt(Date measValidDtIn)
218 {
219 this.measValidDt = measValidDtIn;
220 }
221
222 private Date measQualifDt;
223
224
225
226
227
228 public Date getMeasQualifDt()
229 {
230 return this.measQualifDt;
231 }
232
233
234
235
236
237 public void setMeasQualifDt(Date measQualifDtIn)
238 {
239 this.measQualifDt = measQualifDtIn;
240 }
241
242 private String measQualifCm;
243
244
245
246
247
248
249 public String getMeasQualifCm()
250 {
251 return this.measQualifCm;
252 }
253
254
255
256
257
258
259 public void setMeasQualifCm(String measQualifCmIn)
260 {
261 this.measQualifCm = measQualifCmIn;
262 }
263
264 private String measCm;
265
266
267
268
269
270 public String getMeasCm()
271 {
272 return this.measCm;
273 }
274
275
276
277
278
279 public void setMeasCm(String measCmIn)
280 {
281 this.measCm = measCmIn;
282 }
283
284 private Timestamp updateDt;
285
286
287
288
289
290 public Timestamp getUpdateDt()
291 {
292 return this.updateDt;
293 }
294
295
296
297
298
299 public void setUpdateDt(Timestamp updateDtIn)
300 {
301 this.updateDt = updateDtIn;
302 }
303
304 private String parCd;
305
306
307
308
309
310 public String getParCd()
311 {
312 return this.parCd;
313 }
314
315
316
317
318
319 public void setParCd(String parCdIn)
320 {
321 this.parCd = parCdIn;
322 }
323
324 private Integer matrixId;
325
326
327
328
329
330 public Integer getMatrixId()
331 {
332 return this.matrixId;
333 }
334
335
336
337
338
339 public void setMatrixId(Integer matrixIdIn)
340 {
341 this.matrixId = matrixIdIn;
342 }
343
344 private Integer fractionId;
345
346
347
348
349
350 public Integer getFractionId()
351 {
352 return this.fractionId;
353 }
354
355
356
357
358
359 public void setFractionId(Integer fractionIdIn)
360 {
361 this.fractionId = fractionIdIn;
362 }
363
364 private Integer methodId;
365
366
367
368
369
370 public Integer getMethodId()
371 {
372 return this.methodId;
373 }
374
375
376
377
378
379 public void setMethodId(Integer methodIdIn)
380 {
381 this.methodId = methodIdIn;
382 }
383
384
385 private Sample sample;
386
387
388
389
390
391 public Sample getSample()
392 {
393 return this.sample;
394 }
395
396
397
398
399
400 public void setSample(Sample sampleIn)
401 {
402 this.sample = sampleIn;
403 }
404
405 private ObjectType objectType;
406
407
408
409
410
411
412
413 public ObjectType getObjectType()
414 {
415 return this.objectType;
416 }
417
418
419
420
421
422
423
424 public void setObjectType(ObjectType objectTypeIn)
425 {
426 this.objectType = objectTypeIn;
427 }
428
429 private Department recorderDepartment;
430
431
432
433
434
435 public Department getRecorderDepartment()
436 {
437 return this.recorderDepartment;
438 }
439
440
441
442
443
444 public void setRecorderDepartment(Department recorderDepartmentIn)
445 {
446 this.recorderDepartment = recorderDepartmentIn;
447 }
448
449 private AnalysisInstrument analysisInstrument;
450
451
452
453
454
455 public AnalysisInstrument getAnalysisInstrument()
456 {
457 return this.analysisInstrument;
458 }
459
460
461
462
463
464 public void setAnalysisInstrument(AnalysisInstrument analysisInstrumentIn)
465 {
466 this.analysisInstrument = analysisInstrumentIn;
467 }
468
469 private Department department;
470
471
472
473
474
475 public Department getDepartment()
476 {
477 return this.department;
478 }
479
480
481
482
483
484 public void setDepartment(Department departmentIn)
485 {
486 this.department = departmentIn;
487 }
488
489 private QualityFlag qualityFlag;
490
491
492
493
494
495 public QualityFlag getQualityFlag()
496 {
497 return this.qualityFlag;
498 }
499
500
501
502
503
504 public void setQualityFlag(QualityFlag qualityFlagIn)
505 {
506 this.qualityFlag = qualityFlagIn;
507 }
508
509 private Pmfm pmfm;
510
511
512
513
514
515 public Pmfm getPmfm()
516 {
517 return this.pmfm;
518 }
519
520
521
522
523
524 public void setPmfm(Pmfm pmfmIn)
525 {
526 this.pmfm = pmfmIn;
527 }
528
529 private PrecisionType precisionType;
530
531
532
533
534
535 public PrecisionType getPrecisionType()
536 {
537 return this.precisionType;
538 }
539
540
541
542
543
544 public void setPrecisionType(PrecisionType precisionTypeIn)
545 {
546 this.precisionType = precisionTypeIn;
547 }
548
549 private Collection<Program> programs = new HashSet<Program>();
550
551
552
553
554
555 public Collection<Program> getPrograms()
556 {
557 return this.programs;
558 }
559
560
561
562
563
564 public void setPrograms(Collection<Program> programsIn)
565 {
566 this.programs = programsIn;
567 }
568
569
570
571
572
573
574
575 public boolean addPrograms(Program elementToAdd)
576 {
577 return this.programs.add(elementToAdd);
578 }
579
580
581
582
583
584
585
586 public boolean removePrograms(Program elementToRemove)
587 {
588 return this.programs.remove(elementToRemove);
589 }
590
591 private NumericalPrecision numericalPrecision;
592
593
594
595
596
597 public NumericalPrecision getNumericalPrecision()
598 {
599 return this.numericalPrecision;
600 }
601
602
603
604
605
606 public void setNumericalPrecision(NumericalPrecision numericalPrecisionIn)
607 {
608 this.numericalPrecision = numericalPrecisionIn;
609 }
610
611 private QualitativeValue qualitativeValue;
612
613
614
615
616
617 public QualitativeValue getQualitativeValue()
618 {
619 return this.qualitativeValue;
620 }
621
622
623
624
625
626 public void setQualitativeValue(QualitativeValue qualitativeValueIn)
627 {
628 this.qualitativeValue = qualitativeValueIn;
629 }
630
631 private Survey survey;
632
633
634
635
636
637
638 public Survey getSurvey()
639 {
640 return this.survey;
641 }
642
643
644
645
646
647
648 public void setSurvey(Survey surveyIn)
649 {
650 this.survey = surveyIn;
651 }
652
653 private SamplingOperation samplingOperation;
654
655
656
657
658
659 public SamplingOperation getSamplingOperation()
660 {
661 return this.samplingOperation;
662 }
663
664
665
666
667
668 public void setSamplingOperation(SamplingOperation samplingOperationIn)
669 {
670 this.samplingOperation = samplingOperationIn;
671 }
672
673
674
675
676
677 @Override
678 public boolean equals(Object object)
679 {
680 if (this == object)
681 {
682 return true;
683 }
684 if (!(object instanceof Measurement))
685 {
686 return false;
687 }
688 final Measurement that = (Measurement)object;
689 if (this.measId == null || that.getMeasId() == null || !this.measId.equals(that.getMeasId()))
690 {
691 return false;
692 }
693 return true;
694 }
695
696
697
698
699 @Override
700 public int hashCode()
701 {
702 int hashCode = 0;
703 hashCode = 29 * hashCode + (this.measId == null ? 0 : this.measId.hashCode());
704
705 return hashCode;
706 }
707
708
709
710
711 public static final class Factory
712 {
713
714
715
716
717 public static Measurement newInstance()
718 {
719 return new MeasurementImpl();
720 }
721
722
723
724
725
726
727
728
729
730
731
732 public static Measurement newInstance(Integer objectId, Timestamp updateDt, ObjectType objectType, QualityFlag qualityFlag, Pmfm pmfm)
733 {
734 final Measurement entity = new MeasurementImpl();
735 entity.setObjectId(objectId);
736 entity.setUpdateDt(updateDt);
737 entity.setObjectType(objectType);
738 entity.setQualityFlag(qualityFlag);
739 entity.setPmfm(pmfm);
740 return entity;
741 }
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776 public static Measurement newInstance(Integer objectId, Integer measIndivId, Float measNumerValue, Float measPrecisionValue, Double measDigitNumber, Date measControlDt, Date measValidDt, Date measQualifDt, String measQualifCm, String measCm, Timestamp updateDt, String parCd, Integer matrixId, Integer fractionId, Integer methodId, Sample sample, ObjectType objectType, Department recorderDepartment, AnalysisInstrument analysisInstrument, Department department, QualityFlag qualityFlag, Pmfm pmfm, PrecisionType precisionType, Collection<Program> programs, NumericalPrecision numericalPrecision, QualitativeValue qualitativeValue, Survey survey, SamplingOperation samplingOperation)
777 {
778 final Measurement entity = new MeasurementImpl();
779 entity.setObjectId(objectId);
780 entity.setMeasIndivId(measIndivId);
781 entity.setMeasNumerValue(measNumerValue);
782 entity.setMeasPrecisionValue(measPrecisionValue);
783 entity.setMeasDigitNumber(measDigitNumber);
784 entity.setMeasControlDt(measControlDt);
785 entity.setMeasValidDt(measValidDt);
786 entity.setMeasQualifDt(measQualifDt);
787 entity.setMeasQualifCm(measQualifCm);
788 entity.setMeasCm(measCm);
789 entity.setUpdateDt(updateDt);
790 entity.setParCd(parCd);
791 entity.setMatrixId(matrixId);
792 entity.setFractionId(fractionId);
793 entity.setMethodId(methodId);
794 entity.setSample(sample);
795 entity.setObjectType(objectType);
796 entity.setRecorderDepartment(recorderDepartment);
797 entity.setAnalysisInstrument(analysisInstrument);
798 entity.setDepartment(department);
799 entity.setQualityFlag(qualityFlag);
800 entity.setPmfm(pmfm);
801 entity.setPrecisionType(precisionType);
802 entity.setPrograms(programs);
803 entity.setNumericalPrecision(numericalPrecision);
804 entity.setQualitativeValue(qualitativeValue);
805 entity.setSurvey(survey);
806 entity.setSamplingOperation(samplingOperation);
807 return entity;
808 }
809 }
810
811
812
813
814 public int compareTo(Measurement o)
815 {
816 int cmp = 0;
817 if (this.getMeasId() != null)
818 {
819 cmp = this.getMeasId().compareTo(o.getMeasId());
820 }
821 else
822 {
823 if (this.getObjectId() != null)
824 {
825 cmp = (cmp != 0 ? cmp : this.getObjectId().compareTo(o.getObjectId()));
826 }
827 if (this.getMeasIndivId() != null)
828 {
829 cmp = (cmp != 0 ? cmp : this.getMeasIndivId().compareTo(o.getMeasIndivId()));
830 }
831 if (this.getMeasNumerValue() != null)
832 {
833 cmp = (cmp != 0 ? cmp : this.getMeasNumerValue().compareTo(o.getMeasNumerValue()));
834 }
835 if (this.getMeasPrecisionValue() != null)
836 {
837 cmp = (cmp != 0 ? cmp : this.getMeasPrecisionValue().compareTo(o.getMeasPrecisionValue()));
838 }
839 if (this.getMeasDigitNumber() != null)
840 {
841 cmp = (cmp != 0 ? cmp : this.getMeasDigitNumber().compareTo(o.getMeasDigitNumber()));
842 }
843 if (this.getMeasControlDt() != null)
844 {
845 cmp = (cmp != 0 ? cmp : this.getMeasControlDt().compareTo(o.getMeasControlDt()));
846 }
847 if (this.getMeasValidDt() != null)
848 {
849 cmp = (cmp != 0 ? cmp : this.getMeasValidDt().compareTo(o.getMeasValidDt()));
850 }
851 if (this.getMeasQualifDt() != null)
852 {
853 cmp = (cmp != 0 ? cmp : this.getMeasQualifDt().compareTo(o.getMeasQualifDt()));
854 }
855 if (this.getMeasQualifCm() != null)
856 {
857 cmp = (cmp != 0 ? cmp : this.getMeasQualifCm().compareTo(o.getMeasQualifCm()));
858 }
859 if (this.getMeasCm() != null)
860 {
861 cmp = (cmp != 0 ? cmp : this.getMeasCm().compareTo(o.getMeasCm()));
862 }
863 if (this.getUpdateDt() != null)
864 {
865 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
866 }
867 if (this.getParCd() != null)
868 {
869 cmp = (cmp != 0 ? cmp : this.getParCd().compareTo(o.getParCd()));
870 }
871 if (this.getMatrixId() != null)
872 {
873 cmp = (cmp != 0 ? cmp : this.getMatrixId().compareTo(o.getMatrixId()));
874 }
875 if (this.getFractionId() != null)
876 {
877 cmp = (cmp != 0 ? cmp : this.getFractionId().compareTo(o.getFractionId()));
878 }
879 if (this.getMethodId() != null)
880 {
881 cmp = (cmp != 0 ? cmp : this.getMethodId().compareTo(o.getMethodId()));
882 }
883 }
884 return cmp;
885 }
886
887
888 }