1 package fr.ifremer.tutti.service.protocol;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import fr.ifremer.tutti.persistence.entities.protocol.Rtp;
26 import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
27 import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocols;
28 import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
29 import fr.ifremer.tutti.persistence.entities.referential.Species;
30 import org.apache.commons.lang3.StringUtils;
31
32 import java.io.Serializable;
33 import java.util.List;
34
35
36
37
38
39
40
41 public class SpeciesRow implements Serializable {
42
43 private static final long serialVersionUID = 1L;
44
45 public static final String PROPERTY_SPECIES = "species";
46
47 public static final String PROPERTY_SPECIES_REFERENCE_TAXON_ID = "speciesReferenceTaxonId";
48
49 public static final String PROPERTY_SPECIES_REF_TAX_CODE = "speciesRefTaxCode";
50
51 public static final String PROPERTY_SPECIES_NAME = "speciesName";
52
53 public static final String PROPERTY_SPECIES_SURVEY_CODE = "speciesSurveyCode";
54
55 public static final String PROPERTY_LENGTH_STEP_PMFM = "lengthStepPmfm";
56
57 public static final String PROPERTY_LENGTH_STEP_PMFM_PARAMETER_NAME = "lengthStepPmfmParameterName";
58
59 public static final String PROPERTY_LENGTH_STEP_PMFM_MATRIX_NAME = "lengthStepPmfmMatrixName";
60
61 public static final String PROPERTY_LENGTH_STEP_PMFM_FRACTION_NAME = "lengthStepPmfmFractionName";
62
63 public static final String PROPERTY_LENGTH_STEP_PMFM_METHOD_NAME = "lengthStepPmfmMethodName";
64
65 public static final String PROPERTY_LENGTH_STEP_PMFM_ID = "lengthStepPmfmId";
66
67 public static final String PROPERTY_WEIGHT_ENABLED = "weightEnabled";
68
69 public static final String PROPERTY_COUNT_IF_NO_FREQUENCY_ENABLED = "countIfNoFrequencyEnabled";
70
71 public static final String PROPERTY_CALCIFY_SAMPLE_ENABLED = "calcifySampleEnabled";
72
73 public static final String PROPERTY_MANDATORY_SAMPLE_CATEGORY_ID = "mandatorySampleCategoryId";
74
75 public static final String PROPERTY_RTP_MALE_A = "rtpMaleA";
76
77 public static final String PROPERTY_RTP_MALE_B = "rtpMaleB";
78
79 public static final String PROPERTY_RTP_FEMALE_A = "rtpFemaleA";
80
81 public static final String PROPERTY_RTP_FEMALE_B = "rtpFemaleB";
82
83 public static final String PROPERTY_RTP_UNDEFINED_A = "rtpUndefinedA";
84
85 public static final String PROPERTY_RTP_UNDEFINED_B = "rtpUndefinedB";
86
87 protected final SpeciesProtocol delegate;
88
89 protected Species species;
90
91 protected Caracteristic lengthStepPmfm;
92
93 public SpeciesRow() {
94 delegate = SpeciesProtocols.newSpeciesProtocol();
95 delegate.setMadeFromAReferentTaxon(true);
96 }
97
98 public Species getSpecies() {
99 return species;
100 }
101
102 public Integer getSpeciesReferenceTaxonId() {
103 return species == null ? null : delegate.getSpeciesReferenceTaxonId();
104 }
105
106 public String getSpeciesName() {
107 return species == null ? null : species.getName();
108 }
109
110 public void setSpeciesName(String name) {
111 if (!StringUtils.isEmpty(name)) {
112 boolean madeFromAReferentTaxon = isMadeFromAReferentTaxon();
113 setMadeFromAReferentTaxon(madeFromAReferentTaxon &&
114 species != null && species.getName().equals(name));
115 }
116 }
117
118 public String getSpeciesRefTaxCode() {
119 return species.getRefTaxCode();
120 }
121
122 public void setSpeciesRefTaxCode(String refTaxCode) {
123 if (!StringUtils.isEmpty(refTaxCode)) {
124 boolean madeFromAReferentTaxon = isMadeFromAReferentTaxon();
125 setMadeFromAReferentTaxon(madeFromAReferentTaxon &&
126 species != null && species.getRefTaxCode().equals(refTaxCode));
127 }
128 }
129
130 public void setSpecies(Species species) {
131 this.species = species;
132 delegate.setSpeciesReferenceTaxonId(species == null ? null : species.getReferenceTaxonId());
133 }
134
135 public String getSpeciesSurveyCode() {
136 return delegate.getSpeciesSurveyCode();
137 }
138
139 public void setSpeciesSurveyCode(String speciesSuurveyCode) {
140 delegate.setSpeciesSurveyCode(speciesSuurveyCode);
141 }
142
143 public Caracteristic getLengthStepPmfm() {
144 return lengthStepPmfm;
145 }
146
147 public void setLengthStepPmfm(Caracteristic lengthStepPmfm) {
148 this.lengthStepPmfm = lengthStepPmfm;
149 delegate.setLengthStepPmfmId(lengthStepPmfm == null ? null : lengthStepPmfm.getId());
150 }
151
152 public String getLengthStepPmfmId() {
153 return delegate.getLengthStepPmfmId();
154 }
155
156 public String getLengthStepPmfmParameterName() {
157 return lengthStepPmfm == null ? null : lengthStepPmfm.getParameterName();
158 }
159
160 public String getLengthStepPmfmMethodName() {
161 return lengthStepPmfm == null ? null : lengthStepPmfm.getMethodName();
162 }
163
164 public String getLengthStepPmfmMatrixName() {
165 return lengthStepPmfm == null ? null : lengthStepPmfm.getMatrixName();
166 }
167
168 public String getLengthStepPmfmFractionName() {
169 return lengthStepPmfm == null ? null : lengthStepPmfm.getFractionName();
170 }
171
172 public boolean isWeightEnabled() {
173 return delegate.isWeightEnabled();
174 }
175
176 public void setWeightEnabled(boolean weightEnabled) {
177 delegate.setWeightEnabled(weightEnabled);
178 }
179
180 public boolean isMadeFromAReferentTaxon() {
181 return delegate.isMadeFromAReferentTaxon();
182 }
183
184 public void setMadeFromAReferentTaxon(boolean referent) {
185 delegate.setMadeFromAReferentTaxon(referent);
186 }
187
188 public void setId(String id) {
189 delegate.setId(id);
190 }
191
192 public String getId() {
193 return delegate.getId();
194 }
195
196 public void setMandatorySampleCategoryId(List<Integer> mandatorySampleCategoryId) {
197 delegate.setMandatorySampleCategoryId(mandatorySampleCategoryId);
198 }
199
200 public List<Integer> getMandatorySampleCategoryId() {
201 return delegate.getMandatorySampleCategoryId();
202 }
203
204 public boolean withRtpMale() {
205 return delegate.withRtpMale();
206 }
207
208 public boolean withRtpFemale() {
209 return delegate.withRtpFemale();
210 }
211
212 public boolean withRtpUndefined() {
213 return delegate.withRtpUndefined();
214 }
215
216 public Rtp getRtpMale() {
217 return delegate.getRtpMale();
218 }
219
220 public Rtp getRtpFemale() {
221 return delegate.getRtpFemale();
222 }
223
224 public Rtp getRtpUndefined() {
225 return delegate.getRtpUndefined();
226 }
227
228 public void setRtpMale(Rtp rtpMale) {
229 delegate.setRtpMale(rtpMale);
230 }
231
232 public void setRtpFemale(Rtp rtpFemale) {
233 delegate.setRtpFemale(rtpFemale);
234 }
235
236 public void setRtpUndefined(Rtp rtpUndefined) {
237 delegate.setRtpUndefined(rtpUndefined);
238 }
239
240 public Double getRtpMaleA() {
241 return withRtpMale() ? getRtpMale().getA() : null;
242 }
243
244 public Float getRtpMaleB() {
245 return withRtpMale() ? getRtpMale().getB() : null;
246 }
247
248 public Double getRtpFemaleA() {
249 return withRtpFemale() ? getRtpFemale().getA() : null;
250 }
251
252 public Float getRtpFemaleB() {
253 return withRtpFemale() ? getRtpFemale().getB() : null;
254 }
255
256 public Double getRtpUndefinedA() {
257 return withRtpUndefined() ? getRtpUndefined().getA() : null;
258 }
259
260 public Float getRtpUndefinedB() {
261 return withRtpUndefined() ? getRtpUndefined().getB() : null;
262 }
263
264 public void setRtpMaleA(Double a) {
265 getRtpMale().setA(a);
266 }
267
268 public void setRtpMaleB(Float b) {
269 getRtpMale().setB(b);
270 }
271
272 public void setRtpFemaleA(Double a) {
273 getRtpFemale().setA(a);
274 }
275
276 public void setRtpFemaleB(Float b) {
277 getRtpFemale().setB(b);
278 }
279
280 public void setRtpUndefinedA(Double a) {
281 getRtpUndefined().setA(a);
282 }
283
284 public void setRtpUndefinedB(Float b) {
285 getRtpUndefined().setB(b);
286 }
287
288 }