Tony CHEMIT pushed to branch master at ultreiaio / ird-t3 Commits: 194c302a by Tony CHEMIT at 2018-04-05T17:01:09Z [jgitflow-maven-plugin]updating poms for 2.7-SNAPSHOT development[skip ci] - - - - - 2d413e07 by Tony CHEMIT at 2018-04-05T17:08:50Z [jgitflow-maven-plugin]updating develop poms to master versions to avoid merge conflicts[skip ci] - - - - - 3001ed31 by Tony CHEMIT at 2018-04-05T17:08:50Z [jgitflow-maven-plugin]merging 'master' into 'develop' - - - - - 77c55a5f by Tony CHEMIT at 2018-04-05T17:08:51Z [jgitflow-maven-plugin]Updating develop poms back to pre merge state[skip ci] - - - - - 7fcfc174 by Tony CHEMIT at 2018-04-05T17:29:17Z update changelog after release 2.6 [skip ci] - - - - - e6a3b4b5 by Tony CHEMIT at 2018-04-05T17:42:01Z Update CHANGELOG.md - - - - - 0b6cb8bd by Tony CHEMIT at 2018-04-11T10:21:02Z Anomalie suite au chargement d'une base dont le nom contient un lettre accentuée (Closes #310) - - - - - d7b705b8 by Tony CHEMIT at 2018-04-11T10:21:04Z [N0.2] Questions sur le log (See #311° - add more logs - - - - - 738aa303 by Tony CHEMIT at 2018-04-11T11:37:58Z [N0.2] Questions sur le log (Closes #311) - - - - - 4ab2024f by Tony CHEMIT at 2018-04-11T12:18:10Z [N0.2] Questions sur le log ( Closes #311 ) - amélioration du log - - - - - da05f1c0 by Tony CHEMIT at 2018-04-11T12:33:33Z [N0.2] Lors du calcul du RF2, utiliser la liste rf1speciesforfleet (closes #313) - - - - - 2ca9ec8e by Tony CHEMIT at 2018-04-11T13:21:13Z [N0.2] Ne calculer le RF2 que si l'une des marées de la strate a un défaut de logbook (See #312) - - - - - f3838753 by Tony CHEMIT at 2018-04-11T13:36:26Z Revert #239 (See #311) - - - - - e6c17532 by Tony CHEMIT at 2018-04-11T14:16:28Z [N0.2] Questions sur le log ( Closes #311 ) - improve log 2 - - - - - 79a83a2c by Tony CHEMIT at 2018-04-11T16:19:11Z [IMPORT] Persister le champ AVDTH MAREE.F_ENQ (closes #314) - - - - - dbd1ae67 by Tony CHEMIT at 2018-04-11T16:42:53Z use last data version - - - - - 2e97aa9d by Tony CHEMIT at 2018-04-12T07:52:44Z [jgitflow-maven-plugin]updating poms for branch'release/2.7' with non-snapshot versions[skip ci] - - - - - 7e0ad51c by Tony CHEMIT at 2018-04-12T07:57:44Z [jgitflow-maven-plugin]merging 'release/2.7' into 'master' - - - - - 26 changed files: - CHANGELOG.md - pom.xml - t3-actions/pom.xml - t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java - t3-actions/src/main/resources/i18n/t3-actions_en_GB.properties - t3-actions/src/main/resources/i18n/t3-actions_fr_FR.properties - t3-domain/pom.xml - t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java - t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java - t3-domain/src/main/java/fr/ird/t3/services/DecoratorService.java - + t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_7.java - + t3-domain/src/main/resources/db/migration/V2_7_01_add-trip-logbookAvailability.sql - t3-domain/src/main/xmi/t3-persistence.properties - t3-domain/src/main/xmi/t3-persistence.zargo - t3-input-avdthv33/pom.xml - t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java - t3-input-avdthv35/pom.xml - t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java - t3-input-avdthv36/pom.xml - t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java - t3-installer/pom.xml - t3-msaccess-importer/pom.xml - t3-output-balbayav32/pom.xml - t3-web/pom.xml - t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java - t3/pom.xml Changes: ===================================== CHANGELOG.md ===================================== --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,22 @@ # T3 changelog * Author [Tony Chemit](mailto:dev@tchemit.fr) - * Last generated at 2018-03-23 18:32. + * Last generated at 2018-04-05 19:27. + +## Version [2.6](https://gitlab.com/ultreiaio/ird-t3/milestones/36) + + **Closed at 2018-04-05.** + + ### Download + * [Installer (t3-2.6.zip)](https://oss.sonatype.org/content/repositories/frirdt3-1018/fr/ird/t3/t3/2.6/...) + * [Application (t3-2.6.war)](https://oss.sonatype.org/content/repositories/frirdt3-1018/fr/ird/t3/t3/2.6/...) + + ### Issues + * [[Evolution 306]](https://gitlab.com/ultreiaio/ird-t3/issues/306) **Mise en page de certains écrans de configuration** (Thanks to Tony CHEMIT) (Reported by Pascal Cauquil) + * [[Evolution 307]](https://gitlab.com/ultreiaio/ird-t3/issues/307) **[N3] Option à supprimer sur le N3** (Thanks to Tony CHEMIT) (Reported by Pascal Cauquil) + * [[Tâche 303]](https://gitlab.com/ultreiaio/ird-t3/issues/303) **Problème avec l'installeur 2.5** (Thanks to Tony CHEMIT) (Reported by Pascal Cauquil) + * [[Tâche 304]](https://gitlab.com/ultreiaio/ird-t3/issues/304) **[IMPORT] Il manque un lien "Importer une autre marée"** (Thanks to Tony CHEMIT) (Reported by Pascal Cauquil) + * [[Tâche 305]](https://gitlab.com/ultreiaio/ird-t3/issues/305) **Pour une base OI 2018, l'assistant import exige un code port a priori non pertinent** (Thanks to Tony CHEMIT) (Reported by Pascal Cauquil) ## Version [2.5](https://gitlab.com/ultreiaio/ird-t3/milestones/35) ===================================== pom.xml ===================================== --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> <packaging>pom</packaging> <name>T3 :: Pom</name> @@ -99,7 +99,7 @@ <projectId>ird-t3</projectId> <stageId>frirdt3</stageId> <applicationName>t3</applicationName> - <t3-data.version>1.8</t3-data.version> + <t3-data.version>1.9</t3-data.version> <lib.version.java4all.i18n>4.0-alpha-11</lib.version.java4all.i18n> <env>dev</env> ===================================== t3-actions/pom.xml ===================================== --- a/t3-actions/pom.xml +++ b/t3-actions/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-actions</artifactId> ===================================== t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java ===================================== --- a/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java +++ b/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java @@ -23,7 +23,6 @@ package fr.ird.t3.actions.data.level0; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Multimap; -import com.google.common.collect.TreeMultimap; import fr.ird.t3.entities.data.CompleteTrip; import fr.ird.t3.entities.data.RaisingFactor2; import fr.ird.t3.entities.data.RaisingFactor2TopiaDao; @@ -33,6 +32,8 @@ import fr.ird.t3.entities.reference.Country; import fr.ird.t3.entities.reference.CountryTopiaDao; import fr.ird.t3.entities.reference.Harbour; import fr.ird.t3.entities.reference.HarbourTopiaDao; +import fr.ird.t3.entities.reference.RF1SpeciesForFleet; +import fr.ird.t3.entities.reference.RF1SpeciesForFleetTopiaDao; import fr.ird.t3.entities.reference.Species; import fr.ird.t3.entities.reference.Vessel; import fr.ird.t3.entities.reference.VesselSimpleType; @@ -41,7 +42,6 @@ import fr.ird.t3.entities.type.T3Date; import fr.ird.t3.services.DecoratorService; import fr.ird.t3.services.ioc.InjectDAO; import fr.ird.t3.services.ioc.InjectEntitiesById; -import fr.ird.t3.services.ioc.InjectFromDAO; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -53,6 +53,7 @@ import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import static org.nuiton.i18n.I18n.l; @@ -69,8 +70,6 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati private static final Log log = LogFactory.getLog(ComputeRF2Action.class); @InjectEntitiesById(entityType = Harbour.class) private List<Harbour> landingHarbours; - @InjectFromDAO(entityType = Species.class) - private List<Species> species; private int nbStratum; private int nbTripsWithRF2; @InjectDAO(entityType = RaisingFactor2.class) @@ -81,9 +80,12 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati private CountryTopiaDao countryDAO; @InjectDAO(entityType = VesselSimpleType.class) private VesselSimpleTypeTopiaDao vesselSimpleTypeDAO; + @InjectDAO(entityType = RF1SpeciesForFleet.class) + private RF1SpeciesForFleetTopiaDao rF1SpecieForFleetDAO; + /** usable species group by country */ + private Multimap<Country, Species> speciesByCountry; /** usable complete trips group by vessel */ private ListMultimap<Vessel, CompleteTrip> completeTripsByVessel; - private Multimap<String, String> tripDone; public ComputeRF2Action() { super(Level0Step.COMPUTE_RF2); @@ -119,18 +121,25 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati // use all fleets fleets = countryDAO.findAll(); } - tripDone = TreeMultimap.create(); + // get all species usable for rf1 for all selected fleet countries + this.speciesByCountry = rF1SpecieForFleetDAO.getSpeciesForCountry(fleets); List<Trip> tripList = getUsableTrips(landingHarbours, true); + log.info("Trip count: " + tripList.size()); setTrips(tripList); completeTripsByVessel = ArrayListMultimap.create(); // get all trips group by the vessel ListMultimap<Vessel, Trip> tripsByVessel = TripTopiaDao.groupByVessel(tripList); + log.info("Trip vessel count: " + tripsByVessel.keySet().size()); + // compute for each vessel list of complete trip - for (Vessel vessel : tripsByVessel.keys()) { - List<Trip> tripsForVessel = new ArrayList<>(tripsByVessel.get(vessel)); + for (Map.Entry<Vessel, Collection<Trip>> entry : tripsByVessel.asMap().entrySet()) { + Vessel vessel = entry.getKey(); + List<Trip> tripsForVessel = new ArrayList<>(entry.getValue()); + log.info("Trip vessel [" + vessel.getLabel1() + "] count: " + tripsForVessel.size()); TripTopiaDao.sortTrips(tripsForVessel); // get all complete trips List<CompleteTrip> completeTrips = tripDAO.toCompleteTrip(tripsForVessel); + log.info("Complete trip vessel [" + vessel.getLabel1() + "] count: " + completeTrips.size()); completeTripsByVessel.putAll(vessel, completeTrips); } @@ -146,11 +155,22 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati boolean result = false; if (CollectionUtils.isNotEmpty(trips)) { setNbSteps(landingHarbours.size() * fleets.size() * vesselSimpleTypes.size()); - boolean computeRf2 = !getConfiguration().isConfigurationEmpty(); + for (Harbour harbour : landingHarbours) { String harbourStr = harbour.getLabel1(); for (Country fleet : fleets) { String countryStr = fleet.getLabel1(); + + Collection<Species> species = speciesByCountry.get(fleet); + + boolean computeRf2 = !getConfiguration().isConfigurationEmpty(); + + if (computeRf2 && species.isEmpty()) { + String message = l(locale, "t3.level0.computeRF2.skip.missing.species", harbourStr, countryStr); + log.info(message); + addInfoMessage(message); + computeRf2 = false; + } for (VesselSimpleType vesselSimpleType : vesselSimpleTypes) { incrementsProgression(); // get all trip usable for this stratum @@ -158,26 +178,48 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati String vesselSimpleTypeStr = vesselSimpleType.getLabel1(); // obtain all trips for harbour / fleet / vesselSimpleType List<CompleteTrip> completeTrips = getStratumCompleteTrips(stratumVessels, harbour); - log.debug(String.format("For [%s/%s/%s] nb trips = %d", harbourStr, countryStr, vesselSimpleTypeStr, completeTrips.size())); + log.info(String.format("For [%s/%s/%s] nb trips = %d", harbourStr, countryStr, vesselSimpleTypeStr, completeTrips.size())); if (completeTrips.isEmpty()) { // no trip for this stratum continue; } Multimap<T3Date, CompleteTrip> tripsByMonth = TripTopiaDao.splitTripsByMonth(completeTrips); - log.debug(String.format("found %d months.", tripsByMonth.size())); - for (T3Date month : tripsByMonth.keySet()) { - Collection<CompleteTrip> stratumTrips = tripsByMonth.get(month); + log.info(String.format("found %d months.", tripsByMonth.keySet().size())); + for (Map.Entry<T3Date, Collection<CompleteTrip>> entry : tripsByMonth.asMap().entrySet()) { + T3Date month = entry.getKey(); + Collection<CompleteTrip> stratumTrips = entry.getValue(); nbStratum++; + boolean computeThisStratum = computeRf2; + if (computeRf2) { + // check that at least on trip miss logbook + computeThisStratum = false; + for (CompleteTrip completeTrip : stratumTrips) { + for (Trip trip : completeTrip) { + if (trip.getLogbookAvailability() == 0) { + // no logbook on this + computeThisStratum = true; + String message = l(locale, "t3.level0.computeRF2.found.missing.logbook", harbourStr, countryStr, vesselSimpleTypeStr, month, nbStratum, decorate(trip)); + log.info(message); + addInfoMessage(message); + } + } + } + if (!computeThisStratum) { + String message = l(locale, "t3.level0.computeRF2.skip.missing.logbook", harbourStr, countryStr, vesselSimpleTypeStr, month, nbStratum); + log.info(message); + addInfoMessage(message); + } + } String message = l(locale, "t3.level0.computeRF2.nbTrips.for.stratum", - stratumTrips.size(), - nbStratum, harbourStr, countryStr, vesselSimpleTypeStr, - month); + month, + nbStratum, + stratumTrips.size()); log.info(message); addInfoMessage(message); - executeForStratum(harbour, fleet, vesselSimpleType, month, species, stratumTrips, computeRf2); + executeForStratum(harbour, fleet, vesselSimpleType, month, species, stratumTrips, computeThisStratum); } } } @@ -222,7 +264,7 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati Country fleet, VesselSimpleType vesselSimpleType, T3Date month, - List<Species> species, + Collection<Species> species, Collection<CompleteTrip> trips, boolean computeRf2) throws TopiaException { @@ -246,7 +288,9 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati } // do the rf2 stratum computation float rf2 = computeRf2 ? computeRF2ForStratum(trips, species) : 1f; - addInfoMessage(l(locale, "t3.level0.computeRF2.computed.rf2.for.stratum", rf2)); + if (computeRf2) { + addInfoMessage(l(locale, "t3.level0.computeRF2.computed.rf2.for.stratum", rf2)); + } // assign rf2 value to the entity raisingFactor.setRaisingFactorValue(rf2); if (!rFCreated) { @@ -256,20 +300,18 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati // set rf2 to all trips for (CompleteTrip trip : trips) { String tripStr = decorate(trip); - if (canLog(tripStr,"nbTrips")) { - if (rf2 != 1) { - nbTripsWithRF2++; - } - String message = l(locale, "t3.level0.computeRF1.resume.rf2.for.trip", tripStr, rf2); - log.info(message); - addInfoMessage(message); + if (rf2 != 1) { + nbTripsWithRF2++; } + String message = l(locale, "t3.level0.computeRF1.resume.rf2.for.trip", tripStr, rf2); + log.info(message); + addInfoMessage(message); trip.applyRf2(rf2); markTripAsTreated(trip); } } - private float computeRF2ForStratum(Collection<CompleteTrip> trips, List<Species> species) { + private float computeRF2ForStratum(Collection<CompleteTrip> trips, Collection<Species> species) { float totalLandingWeight = 0f; float totalCatchWeight = 0f; for (CompleteTrip trip : trips) { @@ -285,14 +327,10 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati tripCatchWeight = trip.getElementaryCatchTotalWeightRf1(species); } totalCatchWeight += tripCatchWeight; - if (canLog(tripStr,"compute")) { - addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight)); - } + addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight)); } else { // this trip does not have any landing catches for given species - if (canLog(tripStr,"compute")) { - addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr)); - } + addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr)); } } addInfoMessage(l(locale, "t3.level0.computeRF2.resume.total.rf1", totalCatchWeight, totalLandingWeight)); @@ -310,12 +348,4 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati } } - private boolean canLog(String key, String method) { - boolean exist = tripDone.containsEntry(key, method); - if (!exist) { - tripDone.put(key, method); - } - return !exist; - } - } ===================================== t3-actions/src/main/resources/i18n/t3-actions_en_GB.properties ===================================== --- a/t3-actions/src/main/resources/i18n/t3-actions_en_GB.properties +++ b/t3-actions/src/main/resources/i18n/t3-actions_en_GB.properties @@ -36,12 +36,15 @@ t3.level0.computeRF1.warning.no.logbook=No log book for trip %s, use a null rf1 t3.level0.computeRF1.warning.no.species.usable.for.country=Could not find usable species fro Raising Factor 1 computation from country %s t3.level0.computeRF1.warning.too.high.rf1=For complete trip %s from %s to %s computed rf1 %s is too high (higher than %s) t3.level0.computeRF1.warning.too.low.rf1=For complete trip %s from %s to %s computed rf1 is too small (less than %s) -t3.level0.computeRF1.warning.trip.is.not.complete=Trip %s is not compelte, can not compute any rf1 for it +t3.level0.computeRF1.warning.trip.is.not.complete=Trip %s is not complete, can not compute any rf1 for it t3.level0.computeRF2.computed.rf2.for.stratum=Computed rf2 for stratum \: %s -t3.level0.computeRF2.nbTrips.for.stratum=%s trip(s) for Stratum (%s) [%s/%s/%s/%s] +t3.level0.computeRF2.found.missing.logbook=Stratum [%s/%s/%s/%s] (%s) - found a trip {%s} without logbook, will compute rf2. +t3.level0.computeRF2.nbTrips.for.stratum=[%s/%s/%s/%s] (%s) - %s complete trip(s) found. t3.level0.computeRF2.resume.rf1.for.trip=Trip %s total rf1 catches weight %s / total landing weight %s t3.level0.computeRF2.resume.skip.for.trip=Trip %s has not elementary landing (trip not used to compute rf2) t3.level0.computeRF2.resume.total.rf1=Sum total rf1 catches weight %s / Sum total landing weight %s +t3.level0.computeRF2.skip.missing.logbook=Stratum [%s/%s/%s/%s] (%s) - won't compute rf2, since no logbook is missing. +t3.level0.computeRF2.skip.missing.species=Strate [%s/%s/???/???] - won't compute rf2, since no species found the fleet. t3.level0.computeSetDurationAndPositiveSetCount.error.noSetDurationFound=SetDuration data not found (ocean %s, fleet %s, school type %s, year %s) t3.level0.computeTripEffort=Trip efforts %s (fishing %s, search %s) t3.level0.computeTripEffortSkipForDay=Trip %s, day without fishing time (only activities of type « at harbour » or « under way without prospection ») ===================================== t3-actions/src/main/resources/i18n/t3-actions_fr_FR.properties ===================================== --- a/t3-actions/src/main/resources/i18n/t3-actions_fr_FR.properties +++ b/t3-actions/src/main/resources/i18n/t3-actions_fr_FR.properties @@ -38,10 +38,13 @@ t3.level0.computeRF1.warning.too.high.rf1=Pour la marée complète %s de %s à % t3.level0.computeRF1.warning.too.low.rf1=Pour la marée complète %s de %s à %s le rf1 calculé %s est trop petit (inférieur à %s) t3.level0.computeRF1.warning.trip.is.not.complete=La marée %s n'est pas complète, calcul du rf1 impossible t3.level0.computeRF2.computed.rf2.for.stratum=Valeur du rf2 calculé pour la strate \: %s -t3.level0.computeRF2.nbTrips.for.stratum=%s marée(s) pour la Strate (%s) [%s/%s/%s/%s] +t3.level0.computeRF2.found.missing.logbook=Strate [%s/%s/%s%s] (%s) - une marée {%s} sans logbook a été trouvée, calcul du rf2 programmé. +t3.level0.computeRF2.nbTrips.for.stratum=Strate [%s/%s/%s/%s] (%s) - %s marée(s) complète(s) trouvée(s). t3.level0.computeRF2.resume.rf1.for.trip=Marée %s Poids total des captures rf1isées %s / Poids total des ventes %s t3.level0.computeRF2.resume.skip.for.trip=La marée %s ne possède pas de lots commerciaux (non prise en compte dans le calcul du rf2) t3.level0.computeRF2.resume.total.rf1=Poids cumulé des captures rf1isées %s / Poids cumulé des ventes %s +t3.level0.computeRF2.skip.missing.logbook=Strate [%s/%s/%s/%s] (%s) - aucun logbook manquant, le rf2 ne sera pas calculé. +t3.level0.computeRF2.skip.missing.species=Strate [%s/%s/???/???] - pas d'espèce trouvé pour la flotte, le rf2 ne sera pas calculé. t3.level0.computeSetDurationAndPositiveSetCount.error.noSetDurationFound=Donnée SetDuration non trouvée (ocean %s, flotte %s, type de banc %s, année %s) t3.level0.computeTripEffort=Efforts de la marée %s (pêche %s, recherche %s) t3.level0.computeTripEffortSkipForDay=Marée %s, jour sans temps de pêche (uniquement des activités « au port » ou « route sans veille ») ===================================== t3-domain/pom.xml ===================================== --- a/t3-domain/pom.xml +++ b/t3-domain/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-domain</artifactId> ===================================== t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java +++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractTripTopiaDao.java @@ -85,7 +85,7 @@ public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao< * @param pKey primary key of this trip */ public static void checkAndSetStandardTripType(Trip trip, Object[] pKey) { - int logBookAvailability = trip.getLogBookAvailability(); + int logBookAvailability = trip.getLogbookAvailability(); switch (logBookAvailability) { case TRIP_WITHOUT_LOGBOOK: if (trip.isActivityNotEmpty()) { @@ -111,7 +111,7 @@ public class AbstractTripTopiaDao<E extends Trip> extends GeneratedTripTopiaDao< * @param pKey primary key of this trip */ public static void checkAndSetLogbookMissingTripType(Trip trip, Object[] pKey) { - int logBookAvailability = trip.getLogBookAvailability(); + int logBookAvailability = trip.getLogbookAvailability(); if (trip.getTripType() == TripType.LOGBOOKMISSING) { if (TRIP_WITH_LOGBOOK == logBookAvailability) { throw new IllegalStateException(String.format("Trip %s has no logBook but logBookAvailability says the opposite, please fix this trip.", Arrays.toString(pKey))); ===================================== t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java +++ b/t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java @@ -31,7 +31,6 @@ import fr.ird.t3.entities.reference.Vessel; import fr.ird.t3.entities.reference.VesselImpl; import org.nuiton.util.DateUtil; -import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.Date; @@ -66,8 +65,6 @@ public class TripImpl extends TripAbstract { private transient Boolean level2Computed; private transient Boolean level3Computed; - // only used for avdth import - private transient int logBookAvailability; @Override public boolean isSomeDataComputed() { @@ -103,7 +100,7 @@ public class TripImpl extends TripAbstract { public boolean isLevel2Computed() { if (level2Computed == null) { level2Computed = false; - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity a : getActivity()) { Boolean b = a.getUseMeanStratumCompositionN2(); if (b != null) { @@ -121,7 +118,7 @@ public class TripImpl extends TripAbstract { public boolean isLevel3Computed() { if (level3Computed == null) { level3Computed = false; - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity a : getActivity()) { Boolean b = a.getUseMeanStratumCompositionN3(); if (b != null) { @@ -147,38 +144,10 @@ public class TripImpl extends TripAbstract { return result; } - // only used for avdth import - @Override - public int getLogBookAvailability() { - return logBookAvailability; - } - - // only used for avdth import - @Override - public void setLogBookAvailability(int logbookAvaibility) { - this.logBookAvailability = logbookAvaibility; - } - - // /** @return the sum of all activities set duration in hours. */ -// @Override -// public float getTotalSetsDuration() { -// float result = 0; -// if (!isActivityEmpty()) { -// for (Activity activity : getActivity()) { -// -// // get the setDuration -// Float setTime = activity.getSetDuration(); -// -// result += setTime == null ? 0f : setTime; -// } -// } -// return result / 60; -// } - @Override public float getElementaryCatchTotalWeight(Collection<Species> species) { float result = 0; - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity activity : getActivity()) { result += activity.getElementaryCatchTotalWeight(species); } @@ -189,7 +158,7 @@ public class TripImpl extends TripAbstract { @Override public float getElementaryCatchTotalWeightRf1(Collection<Species> species) { float result = 0; - if (getRf1() != null && !isActivityEmpty()) { + if (getRf1() != null && isActivityNotEmpty()) { for (Activity activity : getActivity()) { if (activity.isElementaryCatchEmpty()) { @@ -211,7 +180,7 @@ public class TripImpl extends TripAbstract { @Override public float getElementaryCatchTotalWeightRf2(Collection<Species> species) { float result = 0; - if (getRf1() != null && !isActivityEmpty()) { + if (getRf1() != null && isActivityNotEmpty()) { for (Activity activity : getActivity()) { if (activity.isElementaryCatchEmpty()) { @@ -246,7 +215,7 @@ public class TripImpl extends TripAbstract { @Override public float getElementaryLandingTotalWeight(Collection<Species> species) { float result = 0; - if (!isElementaryLandingEmpty()) { + if (isElementaryLandingNotEmpty()) { for (ElementaryLanding elementaryLanding : getElementaryLanding()) { if (species.contains(elementaryLanding.getWeightCategoryLanding().getSpecies())) { result += elementaryLanding.getWeight(); @@ -260,7 +229,7 @@ public class TripImpl extends TripAbstract { @Override public Set<Species> getElementaryCatchSpecies() { Set<Species> result = new HashSet<>(); - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity activity : getActivity()) { if (!activity.isElementaryCatchEmpty()) { for (ElementaryCatch aCatch : activity.getElementaryCatch()) { @@ -275,7 +244,7 @@ public class TripImpl extends TripAbstract { @Override public Set<Species> getElementaryLandingSpecies() { Set<Species> result = new HashSet<>(); - if (!isElementaryLandingEmpty()) { + if (isElementaryLandingNotEmpty()) { for (ElementaryLanding landing : getElementaryLanding()) { result.add(landing.getWeightCategoryLanding().getSpecies()); } @@ -286,7 +255,7 @@ public class TripImpl extends TripAbstract { @Override public Set<Ocean> getAllOceans() { Set<Ocean> result = new HashSet<>(); - if (!isActivityEmpty()) { + if (isActivityNotEmpty()) { for (Activity activity : getActivity()) { result.add(activity.getOcean()); } ===================================== t3-domain/src/main/java/fr/ird/t3/services/DecoratorService.java ===================================== --- a/t3-domain/src/main/java/fr/ird/t3/services/DecoratorService.java +++ b/t3-domain/src/main/java/fr/ird/t3/services/DecoratorService.java @@ -157,10 +157,10 @@ public class DecoratorService extends T3ServiceSupport implements T3ServiceSingl registerJXPathDecorator(locale, Trip.class, WITH_ID, "${vesselLabel}$s - ${landingDate}$td/%2$tm/%2$tY [${topiaId}$s]"); // trip (with topiaid) decorator - registerJXPathDecorator(locale, CompleteTrip.class, "${landingTrip/vesselLabel}$s - ${landingTrip/landingDate}$td/%2$tm/%2$tY (nb trip(s) ${nbTrips}$s)"); + registerJXPathDecorator(locale, CompleteTrip.class, "${landingTrip/vesselLabel}$s - ${departureTrip/departureDate}$td/%2$tm/%2$tY - ${landingTrip/landingDate}$td/%3$tm/%3$tY (nb trip(s) ${nbTrips}$s)"); // trip (with topiaid) decorator - registerJXPathDecorator(locale, CompleteTrip.class, WITH_ID, "${landingTrip/vesselLabel}$s - ${landingTrip/landingDate}$td/%2$tm/%2$tY [${landingTrip/topiaId}$s] (nb trip(s) ${nbTrips}$s)"); + registerJXPathDecorator(locale, CompleteTrip.class, WITH_ID, "${landingTrip/vesselLabel}$s - ${departureTrip/departureDate}$td/%2$tm/%2$tY - ${landingTrip/landingDate}$td/%3$tm/%3$tY [${landingTrip/topiaId}$s] (nb trip(s) ${nbTrips}$s)"); // well (with topiaid) decorator registerJXPathDecorator(locale, Well.class, "Number ${wellNumber}$s - Position ${wellPosition}$s [${topiaId}$s]"); ===================================== t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_7.java ===================================== --- /dev/null +++ b/t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_7.java @@ -0,0 +1,49 @@ +package fr.ird.t3.services.migration; + +/*- + * #%L + * T3 :: Domain + * %% + * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.google.auto.service.AutoService; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG; +import org.nuiton.topia.persistence.TopiaException; +import org.nuiton.topia.persistence.support.TopiaSqlSupport; +import org.nuiton.version.Versions; + +import java.util.List; + +/** + * Created by tchemit on 03/03/2018. + * + * @author Tony Chemit - dev@tchemit.fr + */ +@AutoService(TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion.class) +public class T3MigrationCallbackV2_7 extends T3MigrationCallbackSupport { + + public T3MigrationCallbackV2_7() { + super(Versions.valueOf("2.7")); + } + + @Override + protected void prepareMigrationScript(TopiaSqlSupport sqlSupport, List<String> queries, boolean showSql, boolean showProgression) throws TopiaException { + addScript("01", "add-trip-logbookAvailability", queries); + } + +} ===================================== t3-domain/src/main/resources/db/migration/V2_7_01_add-trip-logbookAvailability.sql ===================================== --- /dev/null +++ b/t3-domain/src/main/resources/db/migration/V2_7_01_add-trip-logbookAvailability.sql @@ -0,0 +1,22 @@ +--- +-- #%L +-- T3 :: Domain +-- %% +-- Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- #L% +--- +ALTER TABLE Trip ADD COLUMN logBookAvailability int default 0 NOT NULL; + ===================================== t3-domain/src/main/xmi/t3-persistence.properties ===================================== --- a/t3-domain/src/main/xmi/t3-persistence.properties +++ b/t3-domain/src/main/xmi/t3-persistence.properties @@ -21,7 +21,7 @@ model.tagValue.notGenerateToString=true model.tagValue.generateOperatorForDAOHelper=true model.tagValue.constantPrefix=PROPERTY_ -model.tagValue.version=2.5 +model.tagValue.version=2.7 model.tagValue.indexForeignKeys=true fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.distributions.stereotype=ordered ===================================== t3-domain/src/main/xmi/t3-persistence.zargo ===================================== Binary files a/t3-domain/src/main/xmi/t3-persistence.zargo and b/t3-domain/src/main/xmi/t3-persistence.zargo differ ===================================== t3-input-avdthv33/pom.xml ===================================== --- a/t3-input-avdthv33/pom.xml +++ b/t3-input-avdthv33/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-input-avdthv33</artifactId> ===================================== t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java ===================================== --- a/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java +++ b/t3-input-avdthv33/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java @@ -276,7 +276,7 @@ public class T3AccessEntityMetaProviderAvdth33 implements T3AccessEntityMetaProv Trip.PROPERTY_FALSE_FISHES_WEIGHT, Float.class, "V_POIDS_FP", Trip.PROPERTY_LANDING_TOTAL_WEIGHT, Float.class, "V_POIDS_DBQ", Trip.PROPERTY_FISH_HOLD_EMPTY, Integer.class, "F_CAL_VID", - Trip.PROPERTY_LOG_BOOK_AVAILABILITY, Integer.class, "F_ENQ" + Trip.PROPERTY_LOGBOOK_AVAILABILITY, Integer.class, "F_ENQ" ); // OPERA : [C_OPERA, L_OP8L, L_OPERA] ===================================== t3-input-avdthv35/pom.xml ===================================== --- a/t3-input-avdthv35/pom.xml +++ b/t3-input-avdthv35/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-input-avdthv35</artifactId> ===================================== t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java ===================================== --- a/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java +++ b/t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java @@ -303,7 +303,7 @@ public class T3AccessEntityMetaProviderAvdth35 implements T3AccessEntityMetaProv Trip.PROPERTY_FALSE_FISHES_WEIGHT, Float.class, "V_POIDS_FP", Trip.PROPERTY_LANDING_TOTAL_WEIGHT, Float.class, "V_POIDS_DBQ", Trip.PROPERTY_FISH_HOLD_EMPTY, Integer.class, "F_CAL_VID", - Trip.PROPERTY_LOG_BOOK_AVAILABILITY, Integer.class, "F_ENQ" + Trip.PROPERTY_LOGBOOK_AVAILABILITY, Integer.class, "F_ENQ" ); // FP_LOT : [C_BAT, D_DBQ, N_LOT, C_ESP, C_COND, , V_POIDS_PESE, L_ORIGINE, L_COM] ===================================== t3-input-avdthv36/pom.xml ===================================== --- a/t3-input-avdthv36/pom.xml +++ b/t3-input-avdthv36/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-input-avdthv36</artifactId> ===================================== t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java ===================================== --- a/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java +++ b/t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java @@ -306,7 +306,7 @@ public class T3AccessEntityMetaProviderAvdth36 implements T3AccessEntityMetaProv Trip.PROPERTY_FALSE_FISHES_WEIGHT, Float.class, "V_POIDS_FP", Trip.PROPERTY_LANDING_TOTAL_WEIGHT, Float.class, "V_POIDS_DBQ", Trip.PROPERTY_FISH_HOLD_EMPTY, Integer.class, "F_CAL_VID", - Trip.PROPERTY_LOG_BOOK_AVAILABILITY, Integer.class, "F_ENQ" + Trip.PROPERTY_LOGBOOK_AVAILABILITY, Integer.class, "F_ENQ" ); // FP_LOT : [C_BAT, D_DBQ, N_LOT, C_ESP, C_COND, , V_POIDS_PESE, L_ORIGINE, L_COM] ===================================== t3-installer/pom.xml ===================================== --- a/t3-installer/pom.xml +++ b/t3-installer/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-installer</artifactId> ===================================== t3-msaccess-importer/pom.xml ===================================== --- a/t3-msaccess-importer/pom.xml +++ b/t3-msaccess-importer/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-msaccess-importer</artifactId> ===================================== t3-output-balbayav32/pom.xml ===================================== --- a/t3-output-balbayav32/pom.xml +++ b/t3-output-balbayav32/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-output-balbayav32</artifactId> ===================================== t3-web/pom.xml ===================================== --- a/t3-web/pom.xml +++ b/t3-web/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3-web</artifactId> ===================================== t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java ===================================== --- a/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java +++ b/t3-web/src/main/java/fr/ird/t3/web/actions/io/input/ConfigureImportDataAction.java @@ -39,6 +39,7 @@ import org.nuiton.util.ZipUtil; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; @@ -154,8 +155,8 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn File targetDirectory = getTreatmentDirectory(); String filename = getSourceToLoadFileName(); if (ZipUtil.isZipFile(upload)) { - // let's decompress input stream it - ZipFile zipfile = new ZipFile(upload); + // let's decompress input stream it (always in iso 8869_1) + ZipFile zipfile = new ZipFile(upload, StandardCharsets.ISO_8859_1); Enumeration<? extends ZipEntry> entries = zipfile.entries(); if (!entries.hasMoreElements()) { String message = t("t3.error.required.one.entry.in.zip.to.upload"); @@ -166,7 +167,7 @@ public class ConfigureImportDataAction extends AbstractConfigureAction<AnalyzeIn // get first entry ZipEntry zipEntry = entries.nextElement(); // keep the filename of the zip entry - filename = zipEntry.getName(); + filename = new String(zipEntry.getName().getBytes(),StandardCharsets.ISO_8859_1); File target = new File(targetDirectory, filename); log.info(String.format("Will copy loaded zipped entry file %s to treatment configuration directory %s", filename, target)); try (InputStream in = zipfile.getInputStream(zipEntry)) { ===================================== t3/pom.xml ===================================== --- a/t3/pom.xml +++ b/t3/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.t3</groupId> <artifactId>ird-t3</artifactId> - <version>2.6</version> + <version>2.7</version> </parent> <artifactId>t3</artifactId> View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/e129e1040944535850f76fa391df0430... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/e129e1040944535850f76fa391df0430... You're receiving this email because of your account on gitlab.com.