Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: e546173c by Tony Chemit at 2022-11-11T11:25:01+01:00 Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528 - - - - - 66f80e96 by Tony Chemit at 2022-11-11T11:25:01+01:00 Décoration des devenirs sur formulaire captures - Closes #2527 - - - - - 9 changed files: - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/referential/common/SpeciesFateUI.jaxx - core/api/dto/src/main/i18n/getters/java.getter - core/api/dto/src/main/java/fr/ird/observe/spi/decoration/ObserveDefaultDecoratorRenderer.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DiscardedTargetCatchRecord.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java - core/services/i18n/src/main/i18n/translations/services_en_GB.properties - core/services/i18n/src/main/i18n/translations/services_es_ES.properties - core/services/i18n/src/main/i18n/translations/services_fr_FR.properties - model/src/main/models/Observe/dto/class/decorator.properties Changes: ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/referential/common/SpeciesFateUI.jaxx ===================================== @@ -25,6 +25,7 @@ fr.ird.observe.dto.referential.ps.common.SpeciesFateDto fr.ird.observe.dto.referential.ps.common.SpeciesFateReference io.ultreia.java4all.jaxx.widgets.choice.BooleanEditor + io.ultreia.java4all.jaxx.widgets.choice.BeanCheckBox </import> <BeanValidator id='validator' autoField='true' context='create' errorTableModel='{getErrorTableModel()}' beanClass='fr.ird.observe.dto.referential.ps.common.SpeciesFateDto'/> @@ -44,7 +45,7 @@ <JLabel id='weightRangeAllowedLabel'/> </cell> <cell anchor='east' weightx="1" fill="both"> - <BooleanEditor id='weightRangeAllowed'/> + <BeanCheckBox id='weightRangeAllowed' styleClass="skipI18n"/> </cell> </row> </Table> ===================================== core/api/dto/src/main/i18n/getters/java.getter ===================================== @@ -1,4 +1,5 @@ boolean.false +boolean.null boolean.true observe.Common.haulingIdentifier observe.Common.ocean @@ -63,3 +64,5 @@ observe.referential.common.Vessel.flagCountry observe.referential.common.Vessel.fleetCountry observe.referential.ps.common.AcquisitionStatus.fieldDisabled observe.referential.ps.common.AcquisitionStatus.fieldEnabled +observe.referential.ps.common.SpeciesFate.discardLabel +observe.referential.ps.common.SpeciesFate.weightRangeAllowedLabel ===================================== core/api/dto/src/main/java/fr/ird/observe/spi/decoration/ObserveDefaultDecoratorRenderer.java ===================================== @@ -26,6 +26,8 @@ import io.ultreia.java4all.i18n.I18n; import java.util.Locale; +import static io.ultreia.java4all.i18n.I18n.t; + /** * Created on 19/10/2021. * @@ -51,4 +53,20 @@ public interface ObserveDefaultDecoratorRenderer { default String fieldEnabler(Locale locale, boolean fieldEnabler) { return fieldEnabler ? I18n.l(locale, "observe.referential.ps.common.AcquisitionStatus.fieldEnabled") : I18n.l(locale, "observe.referential.ps.common.AcquisitionStatus.fieldDisabled"); } + + + default String speciesFateDiscard(Locale locale, Boolean discard) { + String value; + if (discard==null) { + value = t("boolean.null"); + } else { + value = discard ? t("boolean.true") : t("boolean.false"); + } + return I18n.l(locale, "observe.referential.ps.common.SpeciesFate.discardLabel", value); + } + + default String speciesFateWeightRangeAllowed(Locale locale, boolean weightRangeAllowed) { + String value = weightRangeAllowed ? t("boolean.true") : t("boolean.false"); + return I18n.l(locale, "observe.referential.ps.common.SpeciesFate.weightRangeAllowedLabel", value); + } } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DiscardedTargetCatchRecord.java ===================================== @@ -53,26 +53,23 @@ public class DiscardedTargetCatchRecord { private final String well; private final long setIdx; private final String weightMeasureMethodId; - //FIXME We are not using this value ? - private final boolean targetdiscardcatchcompositionestimatedbyobserver; public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - " REPLACE(tc.topiaId, '.TargetCatch', '.Catch')," + - " tc.topiaVersion + 1," + - " tc.topiaCreateDate," + - " tc.homeId," + - " tc.catchWeight," + - " tc.weightCategory," + - " tc.comment," + - " tc.reasonForDiscard," + - " tc.set," + - " tc.lastUpdateDate," + - " tc.well," + - " -tc.set_idx," + - " tc.weightMeasureMethod," + - " s.targetdiscardcatchcompositionestimatedbyobserver " + - " FROM ps_observation.TargetCatch tc INNER JOIN ps_observation.set s on s.topiaId = tc.set" + + /* 01 */ " REPLACE(tc.topiaId, '.TargetCatch', '.Catch')," + + /* 02 */ " tc.topiaVersion + 1," + + /* 03 */ " tc.topiaCreateDate," + + /* 04 */ " tc.homeId," + + /* 05 */ " tc.catchWeight," + + /* 06 */ " tc.weightCategory," + + /* 07 */ " tc.comment," + + /* 08 */ " tc.reasonForDiscard," + + /* 09 */ " tc.set," + + /* 10 */ " tc.lastUpdateDate," + + /* 11 */ " tc.well," + + /* 12 */ " -tc.set_idx," + + /* 13 */ " tc.weightMeasureMethod" + + " FROM ps_observation.TargetCatch tc" + " WHERE tc.discarded"); } @@ -90,7 +87,6 @@ public class DiscardedTargetCatchRecord { this.well = resultSet.getString(11); this.setIdx = resultSet.getLong(12); this.weightMeasureMethodId = resultSet.getString(13); - this.targetdiscardcatchcompositionestimatedbyobserver = resultSet.getBoolean(14); } public String toCatchSql(Map<String, WeightCategoryRecord> weightCategoryRecordById, Function<String, String> commentFormat) { @@ -150,7 +146,7 @@ public class DiscardedTargetCatchRecord { /*12*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.SPECIES_FATE_5), /*13*/ DataDtoEntityContext.escapeString(setId), /*14*/ DataDtoEntityContext.timestamp(lastUpdateDate), - /*15*/ DataDtoEntityContext.escapeString(well), + /*15*/ DataDtoEntityContext.escapeString(getWell()), /*16*/ setIdx, /*17*/ DataDtoEntityContext.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), /*18*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_O) @@ -164,4 +160,14 @@ public class DiscardedTargetCatchRecord { return stringFormat.apply(comment + "\n" + weightCategoryRecord.toComment()); } + public String getWell() { + String result = well; + if (result!=null) { + result = well.trim(); + if (well.startsWith("'")) { + result = result.substring(1); + } + } + return result; + } } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java ===================================== @@ -42,22 +42,21 @@ class NotDiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - " REPLACE(tc.topiaId, '.TargetCatch', '.Catch')," + - " tc.topiaVersion + 1," + - " tc.topiaCreateDate," + - " tc.homeId," + - " tc.catchWeight," + - " tc.weightCategory," + - " tc.comment," + - " tc.reasonForDiscard," + - " tc.set," + - " tc.lastUpdateDate," + - " tc.well," + - " -tc.set_idx," + - " tc.weightMeasureMethod," + - " s.targetcatchcompositionestimatedbyobserver " + + /* 01 */ " REPLACE(tc.topiaId, '.TargetCatch', '.Catch')," + + /* 02 */ " tc.topiaVersion + 1," + + /* 03 */ " tc.topiaCreateDate," + + /* 04 */ " tc.homeId," + + /* 05 */ " tc.catchWeight," + + /* 06 */ " tc.weightCategory," + + /* 07 */ " tc.comment," + + /* 08 */ " tc.set," + + /* 09 */ " tc.lastUpdateDate," + + /* 10 */ " tc.well," + + /* 11 */ " -tc.set_idx," + + /* 12 */ " tc.weightMeasureMethod," + + /* 13 */ " s.targetcatchcompositionestimatedbyobserver " + " FROM ps_observation.TargetCatch tc INNER JOIN ps_observation.set s on s.topiaId = tc.set" + - " WHERE NOT tc.discarded AND weightCategory IS NOT NULL AND catchweight IS NOT NULL AND well IS NOT NULL AND broughtondeck IS NOT NULL AND reasonfordiscard IS NOT NULL"); + " WHERE NOT tc.discarded AND NOT ( weightCategory IS NULL AND catchweight IS NULL AND well IS NULL AND broughtondeck IS NULL AND reasonfordiscard IS NULL )"); } private final String id; @@ -72,7 +71,7 @@ class NotDiscardedTargetCatchRecord { private final String well; private final long setIdx; private final String weightMeasureMethodId; - private final boolean targetcatchcompositionestimatedbyobserver; + private final boolean targetCatchCompositionEstimatedByObserver; public NotDiscardedTargetCatchRecord(ResultSet resultSet) throws SQLException { this.id = resultSet.getString(1); @@ -87,7 +86,7 @@ class NotDiscardedTargetCatchRecord { this.well = resultSet.getString(10); this.setIdx = resultSet.getLong(11); this.weightMeasureMethodId = resultSet.getString(12); - this.targetcatchcompositionestimatedbyobserver = resultSet.getBoolean(13); + this.targetCatchCompositionEstimatedByObserver = resultSet.getBoolean(13); } public String toCatchSql(Map<String, WeightCategoryRecord> weightCategoryRecordById, Function<String, String> commentFormat) { @@ -146,10 +145,10 @@ class NotDiscardedTargetCatchRecord { /*12*/ DataDtoEntityContext.escapeString("10".equals(weightCategoryRecord.getCode()) ? DataSourceMigrationForVersion_9_0.SPECIES_FATE_15 : DataSourceMigrationForVersion_9_0.SPECIES_FATE_6), /*13*/ DataDtoEntityContext.escapeString(setId), /*14*/ DataDtoEntityContext.timestamp(lastUpdateDate), - /*15*/ DataDtoEntityContext.escapeString(well), + /*15*/ DataDtoEntityContext.escapeString(getWell()), /*16*/ setIdx, /*17*/ DataDtoEntityContext.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), - /*18*/ DataDtoEntityContext.escapeString(targetcatchcompositionestimatedbyobserver ? DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_P : DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_U) + /*18*/ DataDtoEntityContext.escapeString(targetCatchCompositionEstimatedByObserver ? DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_P : DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_U) ); } @@ -159,4 +158,16 @@ class NotDiscardedTargetCatchRecord { } return stringFormat.apply(comment + "\n" + weightCategoryRecord.toComment()); } + + + public String getWell() { + String result = well; + if (result!=null) { + result = well.trim(); + if (well.startsWith("'")) { + result = result.substring(1); + } + } + return result; + } } ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1702,9 +1702,11 @@ observe.referential.ps.common.SampleType.logbook=Allow in logbook observe.referential.ps.common.SampleType.type=Sample type observe.referential.ps.common.SampleType.validation.atLeastOneSelected=At least one domain must be selected. observe.referential.ps.common.SchoolType.type=School type -observe.referential.ps.common.SpeciesFate.discard=Discard ? +observe.referential.ps.common.SpeciesFate.discard=Discard? +observe.referential.ps.common.SpeciesFate.discardLabel=Discard\: %s observe.referential.ps.common.SpeciesFate.type=Species fate -observe.referential.ps.common.SpeciesFate.weightRangeAllowed=Weight range allowed in catches +observe.referential.ps.common.SpeciesFate.weightRangeAllowed=Individual weight range allowed? +observe.referential.ps.common.SpeciesFate.weightRangeAllowedLabel=Individuals' weight range allowed\: %s observe.referential.ps.common.TransmittingBuoyOperation.type=Transmitting buoy operation observe.referential.ps.common.TransmittingBuoyOwnership.type=Transmitting buoy ownership observe.referential.ps.common.TransmittingBuoyType.technology=Technologies ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1702,9 +1702,11 @@ observe.referential.ps.common.SampleType.logbook=Allow in logbook observe.referential.ps.common.SampleType.type=Sample type \#TODO observe.referential.ps.common.SampleType.validation.atLeastOneSelected=At least one domain must be selected. observe.referential.ps.common.SchoolType.type=Tipo de banco -observe.referential.ps.common.SpeciesFate.discard=Rejeté ? \#TODO +observe.referential.ps.common.SpeciesFate.discard=Rejeté? \#TODO +observe.referential.ps.common.SpeciesFate.discardLabel=Discard\: %s observe.referential.ps.common.SpeciesFate.type=Futuro de la especie -observe.referential.ps.common.SpeciesFate.weightRangeAllowed=Weight range allowed in catches +observe.referential.ps.common.SpeciesFate.weightRangeAllowed=Individual weight range allowed? +observe.referential.ps.common.SpeciesFate.weightRangeAllowedLabel=Individuals' weight range allowed\: %s observe.referential.ps.common.TransmittingBuoyOperation.type=Operación baliza observe.referential.ps.common.TransmittingBuoyOwnership.type=Pertenece de baliza observe.referential.ps.common.TransmittingBuoyType.technology=Tecnologías ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1703,8 +1703,10 @@ observe.referential.ps.common.SampleType.type=Type d'échantillon observe.referential.ps.common.SampleType.validation.atLeastOneSelected=Veuillez sélectionner au moins un sous domaine observe.referential.ps.common.SchoolType.type=Type de banc observe.referential.ps.common.SpeciesFate.discard=Rejeté ? +observe.referential.ps.common.SpeciesFate.discardLabel=Rejeté \: %s observe.referential.ps.common.SpeciesFate.type=Devenir espèce -observe.referential.ps.common.SpeciesFate.weightRangeAllowed=Intervalle de poids autorisé dans les captures +observe.referential.ps.common.SpeciesFate.weightRangeAllowed=Plage de poids individuel autorisée ? +observe.referential.ps.common.SpeciesFate.weightRangeAllowedLabel=Plage de poids individuel autorisée \: %s observe.referential.ps.common.TransmittingBuoyOperation.type=Opération balise observe.referential.ps.common.TransmittingBuoyOwnership.type=Appartenance balise observe.referential.ps.common.TransmittingBuoyType.technology=Technologies ===================================== model/src/main/models/Observe/dto/class/decorator.properties ===================================== @@ -114,6 +114,6 @@ referential.common.Wind=${code}##${this::label}##${this::speedRange}##${this::sw referential.ll.observation.SensorBrand=${code}##${brandName} referential.ps.common.AcquisitionStatus=${code}##${this::label}##${_fieldEnabler::fieldEnabler} referential.ps.common.ObjectMaterial=${code::noCode}##${this::label} -referential.ps.common.SpeciesFate=${code}##${this::label}##${discard}##${_weightRangeAllowed} +referential.ps.common.SpeciesFate=${code}##${this::label}##${discard::speciesFateDiscard}##${_weightRangeAllowed::speciesFateWeightRangeAllowed} referential.ps.common.WeightCategory=${this::label} referential.ps.localmarket.Packaging=${code}##${this::label}##${batchComposition::label}##${batchWeightType::label} View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f772ed31e49b8bc76f8de182c... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f772ed31e49b8bc76f8de182c... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)