| ... |
... |
@@ -23,7 +23,6 @@ package fr.ird.t3.actions.data.level0; |
|
23
|
23
|
import com.google.common.collect.ArrayListMultimap;
|
|
24
|
24
|
import com.google.common.collect.ListMultimap;
|
|
25
|
25
|
import com.google.common.collect.Multimap;
|
|
26
|
|
-import com.google.common.collect.TreeMultimap;
|
|
27
|
26
|
import fr.ird.t3.entities.data.CompleteTrip;
|
|
28
|
27
|
import fr.ird.t3.entities.data.RaisingFactor2;
|
|
29
|
28
|
import fr.ird.t3.entities.data.RaisingFactor2TopiaDao;
|
| ... |
... |
@@ -87,7 +86,6 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati |
|
87
|
86
|
private Multimap<Country, Species> speciesByCountry;
|
|
88
|
87
|
/** usable complete trips group by vessel */
|
|
89
|
88
|
private ListMultimap<Vessel, CompleteTrip> completeTripsByVessel;
|
|
90
|
|
- private Multimap<String, String> tripDone;
|
|
91
|
89
|
|
|
92
|
90
|
public ComputeRF2Action() {
|
|
93
|
91
|
super(Level0Step.COMPUTE_RF2);
|
| ... |
... |
@@ -124,9 +122,7 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati |
|
124
|
122
|
fleets = countryDAO.findAll();
|
|
125
|
123
|
}
|
|
126
|
124
|
// get all species usable for rf1 for all selected fleet countries
|
|
127
|
|
- Multimap<Country, Species> result = rF1SpecieForFleetDAO.getSpeciesForCountry(fleets);
|
|
128
|
|
- setSpeciesByCountry(result);
|
|
129
|
|
- tripDone = TreeMultimap.create();
|
|
|
125
|
+ this.speciesByCountry = rF1SpecieForFleetDAO.getSpeciesForCountry(fleets);
|
|
130
|
126
|
List<Trip> tripList = getUsableTrips(landingHarbours, true);
|
|
131
|
127
|
log.info("Trip count: " + tripList.size());
|
|
132
|
128
|
setTrips(tripList);
|
| ... |
... |
@@ -309,14 +305,12 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati |
|
309
|
305
|
// set rf2 to all trips
|
|
310
|
306
|
for (CompleteTrip trip : trips) {
|
|
311
|
307
|
String tripStr = decorate(trip);
|
|
312
|
|
- if (canLog(tripStr,"nbTrips")) {
|
|
313
|
|
- if (rf2 != 1) {
|
|
314
|
|
- nbTripsWithRF2++;
|
|
315
|
|
- }
|
|
316
|
|
- String message = l(locale, "t3.level0.computeRF1.resume.rf2.for.trip", tripStr, rf2);
|
|
317
|
|
- log.info(message);
|
|
318
|
|
- addInfoMessage(message);
|
|
|
308
|
+ if (rf2 != 1) {
|
|
|
309
|
+ nbTripsWithRF2++;
|
|
319
|
310
|
}
|
|
|
311
|
+ String message = l(locale, "t3.level0.computeRF1.resume.rf2.for.trip", tripStr, rf2);
|
|
|
312
|
+ log.info(message);
|
|
|
313
|
+ addInfoMessage(message);
|
|
320
|
314
|
trip.applyRf2(rf2);
|
|
321
|
315
|
markTripAsTreated(trip);
|
|
322
|
316
|
}
|
| ... |
... |
@@ -338,14 +332,10 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati |
|
338
|
332
|
tripCatchWeight = trip.getElementaryCatchTotalWeightRf1(species);
|
|
339
|
333
|
}
|
|
340
|
334
|
totalCatchWeight += tripCatchWeight;
|
|
341
|
|
- if (canLog(tripStr, "compute")) {
|
|
342
|
|
- addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight));
|
|
343
|
|
- }
|
|
|
335
|
+ addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight));
|
|
344
|
336
|
} else {
|
|
345
|
337
|
// this trip does not have any landing catches for given species
|
|
346
|
|
- if (canLog(tripStr, "compute")) {
|
|
347
|
|
- addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr));
|
|
348
|
|
- }
|
|
|
338
|
+ addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr));
|
|
349
|
339
|
}
|
|
350
|
340
|
}
|
|
351
|
341
|
addInfoMessage(l(locale, "t3.level0.computeRF2.resume.total.rf1", totalCatchWeight, totalLandingWeight));
|
| ... |
... |
@@ -363,19 +353,4 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati |
|
363
|
353
|
}
|
|
364
|
354
|
}
|
|
365
|
355
|
|
|
366
|
|
- private boolean canLog(String key, String method) {
|
|
367
|
|
- boolean exist = tripDone.containsEntry(key, method);
|
|
368
|
|
- if (!exist) {
|
|
369
|
|
- tripDone.put(key, method);
|
|
370
|
|
- }
|
|
371
|
|
- return !exist;
|
|
372
|
|
- }
|
|
373
|
|
-
|
|
374
|
|
- public Multimap<Country, Species> getSpeciesByCountry() {
|
|
375
|
|
- return speciesByCountry;
|
|
376
|
|
- }
|
|
377
|
|
-
|
|
378
|
|
- public void setSpeciesByCountry(Multimap<Country, Species> speciesByCountry) {
|
|
379
|
|
- this.speciesByCountry = speciesByCountry;
|
|
380
|
|
- }
|
|
381
|
356
|
}
|