1 package fr.ifremer.tutti.persistence.service.util.tree;
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.adagio.core.dao.data.batch.CatchBatch;
26 import fr.ifremer.adagio.core.dao.data.batch.SortingBatch;
27 import fr.ifremer.adagio.core.dao.referential.pmfm.PmfmId;
28 import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueId;
29 import org.springframework.stereotype.Component;
30
31 import javax.annotation.Resource;
32
33
34
35
36
37
38
39
40
41 @Component("batchTreeHelper")
42 public class BatchTreeHelper extends BatchTreeHelperSupport {
43
44
45
46
47 @Resource(name = "benthosBatchTreeHelper")
48 protected BenthosBatchTreeHelper benthosBatchTreeHelper;
49
50 @Resource(name = "speciesBatchTreeHelper")
51 protected SpeciesBatchTreeHelper speciesBatchTreeHelper;
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 public SortingBatch getMarineLitterRootBatch(CatchBatch batch) {
74 return getSortingBatch(batch,
75 "Hors Vrac > Marine Litter",
76 PmfmId.SORTED_UNSORTED.getValue(),
77 QualitativeValueId.SORTED_HORS_VRAC.getValue(),
78 SORTING_TYPE_ID,
79 QualitativeValueId.SORTING_TYPE_MARINE_LITTER.getValue());
80 }
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100 public SortingBatch getRejectedBatch(CatchBatch batch) {
101 return getSortingBatch(
102 batch,
103 "Unsorted",
104 PmfmId.SORTED_UNSORTED.getValue(),
105 QualitativeValueId.UNSORTED.getValue()
106 );
107 }
108
109
110
111
112
113 public SortingBatch getSpeciesVracRootBatch(SortingBatch batch) {
114 return speciesBatchTreeHelper.getVracRootBatch(batch);
115 }
116
117 public SortingBatch getBenthosVracRootBatch(SortingBatch batch) {
118 return benthosBatchTreeHelper.getVracRootBatch(batch);
119 }
120
121 public SortingBatch getSpeciesVracAliveNotItemizedRootBatch(SortingBatch batch) {
122 return speciesBatchTreeHelper.getVracAliveNotItemizedRootBatch(batch);
123 }
124
125 public SortingBatch getBenthosVracAliveNotItemizedRootBatch(SortingBatch batch) {
126 return benthosBatchTreeHelper.getVracAliveNotItemizedRootBatch(batch);
127 }
128
129 public SortingBatch getSpeciesVracInertRootBatch(SortingBatch batch) {
130 return speciesBatchTreeHelper.getVracInertRootBatch(batch);
131 }
132
133 public SortingBatch getBenthosVracInertRootBatch(SortingBatch batch) {
134 return benthosBatchTreeHelper.getVracInertRootBatch(batch);
135 }
136
137 public SortingBatch getSpeciesVracAliveItemizedRootBatch(SortingBatch batch) {
138 return speciesBatchTreeHelper.getVracAliveItemizedRootBatch(batch);
139 }
140
141 public SortingBatch getBenthosVracAliveItemizedRootBatch(SortingBatch batch) {
142 return benthosBatchTreeHelper.getVracAliveItemizedRootBatch(batch);
143 }
144
145 public SortingBatch getSpeciesHorsVracRootBatch(SortingBatch batch) {
146 return speciesBatchTreeHelper.getHorsVracRootBatch(batch);
147 }
148
149 public SortingBatch getBenthosHorsVracRootBatch(SortingBatch batch) {
150 return benthosBatchTreeHelper.getHorsVracRootBatch(batch);
151 }
152
153 public SortingBatch getMarineLitterRootBatch(SortingBatch batch) {
154 return getSortingBatch(
155 batch,
156 "Hors Vrac > MarineLitter",
157 SORTING_TYPE_ID,
158 QualitativeValueId.SORTING_TYPE_MARINE_LITTER.getValue());
159 }
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176 public SortingBatch getOrCreateSpeciesVracRootBatch(CatchBatch target, SortingBatch batch, Float totalWeight) {
177 return speciesBatchTreeHelper.getOrCreateVracRootBatch(target, batch, totalWeight);
178
179
180
181
182
183
184
185
186 }
187
188 public SortingBatch getOrCreateSpeciesVracAliveNotItemizedRootBatch(CatchBatch target, SortingBatch batch, Float totalWeight) {
189 return speciesBatchTreeHelper.getOrCreateVracAliveNotItemizedRootBatch(target, batch, totalWeight);
190
191
192
193
194
195
196
197
198
199 }
200
201 public SortingBatch getOrCreateSpeciesVracInertRootBatch(CatchBatch target, SortingBatch batch, Float totalWeight) {
202 return speciesBatchTreeHelper.getOrCreateVracInertRootBatch(target, batch, totalWeight);
203
204
205
206
207
208
209
210
211
212 }
213
214 public SortingBatch getOrCreateSpeciesVracAliveItemizedRootBatch(CatchBatch target, SortingBatch batch) {
215 return speciesBatchTreeHelper.getOrCreateVracAliveItemizedRootBatch(target, batch);
216
217
218
219
220
221
222
223
224 }
225
226 public SortingBatch getOrCreateBenthosVracRootBatch(CatchBatch target, SortingBatch batch, Float totalWeight) {
227 return benthosBatchTreeHelper.getOrCreateVracRootBatch(target, batch, totalWeight);
228
229
230
231
232
233
234
235
236
237 }
238
239 public SortingBatch getOrCreateBenthosVracAliveNotItemizedRootBatch(CatchBatch target, SortingBatch batch, Float totalWeight) {
240 return benthosBatchTreeHelper.getOrCreateVracAliveNotItemizedRootBatch(target, batch, totalWeight);
241
242
243
244
245
246
247
248
249
250 }
251
252 public SortingBatch getOrCreateBenthosVracInertRootBatch(CatchBatch target, SortingBatch batch, Float totalWeight) {
253 return benthosBatchTreeHelper.getOrCreateVracInertRootBatch(target, batch, totalWeight);
254
255
256
257
258
259
260
261
262
263 }
264
265 public SortingBatch getOrCreateBenthosVracAliveItemizedRootBatch(CatchBatch target, SortingBatch batch) {
266 return benthosBatchTreeHelper.getOrCreateVracAliveItemizedRootBatch(target, batch);
267
268
269
270
271
272
273
274
275 }
276
277
278
279
280
281
282
283
284
285
286 public SortingBatch getOrCreateSpeciesHorsVracRootBatch(CatchBatch target, SortingBatch batch) {
287 return speciesBatchTreeHelper.getOrCreateHorsVracRootBatch(target, batch);
288
289
290
291
292
293
294
295
296 }
297
298 public SortingBatch getOrCreateBenthosHorsVracRootBatch(CatchBatch target, SortingBatch batch) {
299 return benthosBatchTreeHelper.getOrCreateHorsVracRootBatch(target, batch);
300
301
302
303
304
305
306
307
308 }
309
310 public SortingBatch getOrCreateMarineLitterRootBatch(CatchBatch target, SortingBatch batch, Float totalWeight) {
311 return getOrCreate(target,
312 batch,
313 "Hors Vrac > Marine Litter",
314 SORTING_TYPE_ID,
315 QualitativeValueId.SORTING_TYPE_MARINE_LITTER.getValue(),
316 totalWeight,
317 (short) 3);
318 }
319
320 public SortingBatch getOrCreateRejectedBatch(CatchBatch batch, Float weight) {
321 return getOrCreate(batch,
322 batch,
323 "Unsorted",
324 PmfmId.SORTED_UNSORTED.getValue(),
325 QualitativeValueId.UNSORTED.getValue(),
326 weight,
327 (short) 3);
328 }
329
330 }