[Git][ultreiaio/ird-t3][develop] [IMPORT] Persister le champ AVDTH MAREE.F_ENQ (closes #314)
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3 Commits: 79a83a2c by Tony CHEMIT at 2018-04-11T16:19:11Z [IMPORT] Persister le champ AVDTH MAREE.F_ENQ (closes #314) - - - - - 13 changed files: - 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/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/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/src/main/java/fr/ird/t3/io/input/avdth/v33/T3AccessEntityMetaProviderAvdth33.java - t3-input-avdthv35/src/main/java/fr/ird/t3/io/input/avdth/v35/T3AccessEntityMetaProviderAvdth35.java - t3-input-avdthv36/src/main/java/fr/ird/t3/io/input/avdth/v36/T3AccessEntityMetaProviderAvdth36.java Changes: ===================================== pom.xml ===================================== --- a/pom.xml +++ b/pom.xml @@ -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-SNAPSHOT</t3-data.version> <lib.version.java4all.i18n>4.0-alpha-11</lib.version.java4all.i18n> <env>dev</env> ===================================== 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 @@ -195,7 +195,7 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati computeThisStratum = false; for (CompleteTrip completeTrip : stratumTrips) { for (Trip trip : completeTrip) { - if (trip.getElementaryCatchTotalWeightRf1(species) == 0) { + 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)); ===================================== 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,7 +36,7 @@ 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.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-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 @@ -43,8 +43,8 @@ t3.level0.computeRF2.nbTrips.for.stratum=Strate [%s/%s/%s/%s] (%s) - %s maré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) - le rf2 ne sera pas calculé, aucun logbook manquant. -t3.level0.computeRF2.skip.missing.species=Strate [%s/%s/???/???] - le rf2 ne sera pas calculé, pas d'espèce trouvé pour la flotte. +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/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() { @@ -147,34 +144,6 @@ 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 (isActivityNotEmpty()) { -// 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; ===================================== 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/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/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/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] View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/79a83a2cc83c9c3929711cd6696d0638d... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/79a83a2cc83c9c3929711cd6696d0638d... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT