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