mailman.cloud.codelutin.com
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Observe-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2013 -----
  • December
  • November
  • October
  • September
observe-commits@list.forge.codelutin.com

November 2022

  • 1 participants
  • 117 discussions
[Git][ultreiaio/ird-observe][develop-9.0.x] 2 commits: Adaptation de la validation et du formulaire Captures suite à la nouvelle...
by Tony CHEMIT (@tchemit) 13 Nov '22

13 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: ffe04d3e by Tony Chemit at 2022-11-13T10:53:48+01:00 Adaptation de la validation et du formulaire Captures suite à la nouvelle migration v9 - Closes #2526 - - - - - 7c8b227d by Tony Chemit at 2022-11-13T10:53:48+01:00 Revert &quot;FIXME - Do not drop table until release time&quot; This reverts commit 73c88a1f12625a827361ececc852b783e4a0941d. - - - - - 10 changed files: - client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx - core/api/services/src/main/i18n/getters/labels.getter - core/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-H2.sql - core/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-PG.sql - 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/i18nLabels.properties - model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties Changes: ===================================== client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter ===================================== @@ -183,9 +183,12 @@ observe.data.ps.observation.Activity.previousFpaZone observe.data.ps.observation.Activity.surroundingActivity observe.data.ps.observation.Activity.time observe.data.ps.observation.Catch.catchWeight +observe.data.ps.observation.Catch.catchWeightTotalCount observe.data.ps.observation.Catch.maxWeight observe.data.ps.observation.Catch.meanLength observe.data.ps.observation.Catch.meanWeight +observe.data.ps.observation.Catch.meanWeightMeanLength +observe.data.ps.observation.Catch.minMaxWeight observe.data.ps.observation.Catch.minWeight observe.data.ps.observation.Catch.reasonForDiscard observe.data.ps.observation.Catch.totalCount ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx ===================================== @@ -62,8 +62,6 @@ errorTableModel='{getErrorTableModel()}' context='update'/> <Table id='editorPanel' fill='both' insets='1' beanScope="tableEditBean"> - - <!-- species --> <row> <cell> <JLabel id='speciesLabel'/> @@ -72,8 +70,6 @@ <FilterableComboBox id='species' genericType='SpeciesReference'/> </cell> </row> - - <!-- speciesFate --> <row> <cell> <JLabel id='speciesFateLabel'/> @@ -82,8 +78,6 @@ <FilterableComboBox id='speciesFate' genericType='SpeciesFateReference'/> </cell> </row> - - <!-- raison rejet --> <row> <cell> <JLabel id='reasonForDiscardLabel'/> @@ -92,18 +86,17 @@ <FilterableComboBox id='reasonForDiscard' genericType='ReasonForDiscardReference'/> </cell> </row> - - <!-- weight estime --> <row> <cell> - <JLabel id='catchWeightLabel'/> + <JLabel id='catchWeightTotalCountLabel'/> </cell> <cell weightx='1' anchor='east'> - <NumberEditor id='catchWeight' styleClass="float3"/> + <JPanel layout="{new GridLayout()}"> + <NumberEditor id='catchWeight' styleClass="float3"/> + <NumberEditor id='totalCount' styleClass="int6"/> + </JPanel> </cell> </row> - - <!-- weightMeasureMethod --> <row> <cell> <JLabel id='weightMeasureMethodLabel'/> @@ -112,53 +105,28 @@ <FilterableComboBox id='weightMeasureMethod' genericType='WeightMeasureMethodReference'/> </cell> </row> - - <!-- count estime --> <row> <cell> - <JLabel id='totalCountLabel'/> + <JLabel id='minMaxWeightLabel'/> </cell> <cell weightx='1'> - <NumberEditor id='totalCount' styleClass="int6"/> - + <JPanel layout="{new GridLayout()}"> + <NumberEditor id='minWeight' styleClass="float2"/> + <NumberEditor id='maxWeight' styleClass="float2"/> + </JPanel> </cell> </row> <row> <cell> - <JLabel id='minWeightLabel'/> + <JLabel id='meanWeightMeanLengthLabel'/> </cell> <cell weightx='1'> - <NumberEditor id='minWeight' styleClass="float2"/> + <JPanel layout="{new GridLayout()}"> + <NumberEditor id='meanWeight' styleClass="float2"/> + <NumberEditor id='meanLength' styleClass="float2"/> + </JPanel> </cell> </row> - <row> - <cell> - <JLabel id='meanWeightLabel'/> - </cell> - <cell weightx='1'> - <NumberEditor id='meanWeight' styleClass="float2"/> - </cell> - </row> - <row> - <cell> - <JLabel id='maxWeightLabel'/> - </cell> - <cell weightx='1'> - <NumberEditor id='maxWeight' styleClass="float2"/> - </cell> - </row> - - <!-- taille moyenne --> - <row> - <cell> - <JLabel id='meanLengthLabel'/> - </cell> - <cell weightx='1'> - <NumberEditor id='meanLength' styleClass="float2"/> - </cell> - </row> - - <!-- well --> <row> <cell> <JLabel id='wellLabel'/> @@ -167,8 +135,6 @@ <NormalTextEditor id='well'/> </cell> </row> - - <!-- informationSource --> <row> <cell> <JLabel id='informationSourceLabel'/> @@ -177,8 +143,6 @@ <FilterableComboBox id='informationSource' genericType='InformationSourceReference'/> </cell> </row> - - <!-- comment --> <row> <cell columns='3' weighty='1'> <BigTextEditor id="comment"/> ===================================== core/api/services/src/main/i18n/getters/labels.getter ===================================== @@ -1028,6 +1028,7 @@ observe.data.ps.observation.Catch.catchWeight observe.data.ps.observation.Catch.catchWeight.short observe.data.ps.observation.Catch.catchWeightComputed.computed.tip observe.data.ps.observation.Catch.catchWeightComputed.observed.tip +observe.data.ps.observation.Catch.catchWeightTotalCount observe.data.ps.observation.Catch.maxWeight observe.data.ps.observation.Catch.maxWeight.short observe.data.ps.observation.Catch.meanLength @@ -1038,6 +1039,8 @@ observe.data.ps.observation.Catch.meanWeight observe.data.ps.observation.Catch.meanWeight.short observe.data.ps.observation.Catch.meanWeightComputed.computed.tip observe.data.ps.observation.Catch.meanWeightComputed.observed.tip +observe.data.ps.observation.Catch.meanWeightMeanLength +observe.data.ps.observation.Catch.minMaxWeight observe.data.ps.observation.Catch.minWeight observe.data.ps.observation.Catch.minWeight.short observe.data.ps.observation.Catch.reasonForDiscard ===================================== core/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-H2.sql ===================================== @@ -25,12 +25,12 @@ ALTER TABLE ps_observation.Set DROP COLUMN targetdiscardcatchcompositionestimate ALTER TABLE ll_common.Trip DROP COLUMN program; ALTER TABLE ps_common.Trip DROP COLUMN program; --- DROP TABLE ps_observation.NonTargetLength; --- DROP TABLE ps_observation.NonTargetSample; --- DROP TABLE ps_observation.NonTargetCatch; --- DROP TABLE ps_observation.TargetCatch; --- DROP TABLE ps_observation.TargetSample; --- DROP TABLE ps_observation.TargetLength; +DROP TABLE ps_observation.NonTargetLength; +DROP TABLE ps_observation.NonTargetSample; +DROP TABLE ps_observation.NonTargetCatch; +DROP TABLE ps_observation.TargetCatch; +DROP TABLE ps_observation.TargetSample; +DROP TABLE ps_observation.TargetLength; DROP TABLE ps_observation.ReasonForNullSet; DROP TABLE ps_observation.ReasonForNoFishing; DROP TABLE ps_observation.WeightCategory; ===================================== core/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-PG.sql ===================================== @@ -25,12 +25,12 @@ ALTER TABLE ps_observation.Set DROP COLUMN targetdiscardcatchcompositionestimate ALTER TABLE ll_common.Trip DROP COLUMN program CASCADE; ALTER TABLE ps_common.Trip DROP COLUMN program CASCADE; --- DROP TABLE ps_observation.NonTargetLength CASCADE; --- DROP TABLE ps_observation.NonTargetSample CASCADE; --- DROP TABLE ps_observation.NonTargetCatch CASCADE; --- DROP TABLE ps_observation.TargetLength CASCADE; --- DROP TABLE ps_observation.TargetSample CASCADE; --- DROP TABLE ps_observation.TargetCatch CASCADE; +DROP TABLE ps_observation.NonTargetLength CASCADE; +DROP TABLE ps_observation.NonTargetSample CASCADE; +DROP TABLE ps_observation.NonTargetCatch CASCADE; +DROP TABLE ps_observation.TargetLength CASCADE; +DROP TABLE ps_observation.TargetSample CASCADE; +DROP TABLE ps_observation.TargetCatch CASCADE; DROP TABLE ps_observation.ReasonForNullSet CASCADE; DROP TABLE ps_observation.ReasonForNoFishing CASCADE; DROP TABLE ps_observation.WeightCategory CASCADE; ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1232,6 +1232,7 @@ observe.data.ps.observation.Catch.catchWeight.short=Weight observe.data.ps.observation.Catch.catchWeight.validation.required=Weight or estimated count must be filled observe.data.ps.observation.Catch.catchWeightComputed.computed.tip=Catch weight was computed (%s) observe.data.ps.observation.Catch.catchWeightComputed.observed.tip=Catch weight was observed +observe.data.ps.observation.Catch.catchWeightTotalCount=Total weight estimated (in t) / Estimated count observe.data.ps.observation.Catch.maxWeight=Upper weight limit (in kg) observe.data.ps.observation.Catch.maxWeight.short=Max weight (in kg) observe.data.ps.observation.Catch.meanLength=Mean length (in cm) @@ -1244,6 +1245,8 @@ observe.data.ps.observation.Catch.meanWeight.short=Mean weight observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Weight or mean size must be filled. observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Mean weight was computed (%s) observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Mean weight was observed +observe.data.ps.observation.Catch.meanWeightMeanLength=Mean weight (in kg) / Mean length (in cm) +observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg) observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg) observe.data.ps.observation.Catch.minWeight.short=Min weight (in kg) observe.data.ps.observation.Catch.reasonForDiscard=Reason for discard ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1232,6 +1232,7 @@ observe.data.ps.observation.Catch.catchWeight.short=Peso observe.data.ps.observation.Catch.catchWeight.validation.required=Debe seleccionar uno de los dos valores (peso o count) observe.data.ps.observation.Catch.catchWeightComputed.computed.tip=Peso estimado calculado observe.data.ps.observation.Catch.catchWeightComputed.observed.tip=Peso estimado observado +observe.data.ps.observation.Catch.catchWeightTotalCount=Pesos total estimados (en t) / Número estimado observe.data.ps.observation.Catch.maxWeight=Upper weight limit (in kg) TODO observe.data.ps.observation.Catch.maxWeight.short=Max weight (in kg) observe.data.ps.observation.Catch.meanLength=Talla media (en cm) @@ -1244,6 +1245,8 @@ observe.data.ps.observation.Catch.meanWeight.short=Peso medio observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Debe seleccionar uno de los dos valores (peso medio o talla media). observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=El peso medio se calculó observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=El peso medio se observó +observe.data.ps.observation.Catch.meanWeightMeanLength=Peso medio (en kg) / Talla media (en cm) +observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg) TODO observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg) TODO observe.data.ps.observation.Catch.minWeight.short=Max weight (in kg) observe.data.ps.observation.Catch.reasonForDiscard=Razón del descarte ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1232,6 +1232,7 @@ observe.data.ps.observation.Catch.catchWeight.short=Poids observe.data.ps.observation.Catch.catchWeight.validation.required=Une des deux valeurs (poids ou taille moyenne) devrait être renseignée. observe.data.ps.observation.Catch.catchWeightComputed.computed.tip=Le poids estimé a été calculé (%s) observe.data.ps.observation.Catch.catchWeightComputed.observed.tip=Le poids estimé a été observé +observe.data.ps.observation.Catch.catchWeightTotalCount=Poids total estimé (en t) / Nombre estimé observe.data.ps.observation.Catch.maxWeight=Borne de poids supérieure (en kg) observe.data.ps.observation.Catch.maxWeight.short=Poids max (en kg) observe.data.ps.observation.Catch.meanLength=Taille moyenne (en cm) @@ -1244,6 +1245,8 @@ observe.data.ps.observation.Catch.meanWeight.short=Poids moy observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Une des deux valeurs (poids moyen ou taille moyenne) devrait être renseignée. observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Le poids moyen a été calculé (%s) observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Le poids moyen a été observé +observe.data.ps.observation.Catch.meanWeightMeanLength=Poids moyen (en kg) / Taille moyenne (en cm) +observe.data.ps.observation.Catch.minMaxWeight=Borne de poids inférieure / supérieure (en kg) observe.data.ps.observation.Catch.minWeight=Borne de poids inférieure (en kg) observe.data.ps.observation.Catch.minWeight.short=Poids min (en kg) observe.data.ps.observation.Catch.reasonForDiscard=Raison rejet ===================================== model/src/main/models/Observe/dto/class/i18nLabels.properties ===================================== @@ -82,7 +82,7 @@ data.ps.logbook.SampleSpeciesMeasure=count,sizeClass data.ps.logbook.TransmittingBuoy=comment,code,transmittingBuoyOwnership,transmittingBuoyType,transmittingBuoyOperation,country,vessel,latitude,longitude,quadrant data.ps.logbook.WellPlan=activity,species,weight,weightCategory,well,wellSamplingConformity,wellSamplingStatus data.ps.observation.Activity=date,coordinate,observedSystem.available,observedSystem.selected,comment,comment2,currentFpaZone,dataQuality,detectionMode,ersId,floatingObjectEmpty,latitude,longitude,nextFpaZone,nonTargetCatchSpecies,observedSystem,observedSystemDistance,previousFpaZone,quadrant,reasonForNoFishing,seaSurfaceTemperature,surroundingActivity,time,vesselActivity,vesselSpeed,wind,generalTab,error.no.activity.6,measurementsTab,observedSystemTab -data.ps.observation.Catch=catchWeight,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip +data.ps.observation.Catch=catchWeight,catchWeightTotalCount,meanWeightMeanLength,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,minMaxWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip data.ps.observation.FloatingObject=materialsValid,objectOperation,supportVesselName,country,vessel,computedBiodegradable,computedNonEntangling,computedSimplifiedObjectType,computedValues,generalTab,buoysTab,materialsTab,notComputed,type.short data.ps.observation.NonTargetCatchRelease=comment,conformity,count,length,lengthMeasureMethod,releasingTime,sex,status,species,speciesGroupReleaseMode,message.cantAdd data.ps.observation.ObjectObservedSpecies=count,species,speciesStatus ===================================== model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties ===================================== @@ -23,7 +23,7 @@ data.ll.common.Trip=species data.ll.landing.Landing=vessel data.ps.localmarket.Sample=well data.ps.logbook.Catch=weightMeasureMethod.validation.required -data.ps.observation.Catch=minWeight,maxWeight,weightMeasureMethod +data.ps.observation.Catch=minWeight,maxWeight,minMaxWeight,weightMeasureMethod data.ps.observation.SchoolEstimate=species data.ps.observation.Set=startTime,haulingStartTimeStamp,haulingEndTimeStamp,endTimeStamp referential.common.Species=codeAndHomeId View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/df3efb6fa50e0a5cd7c82df9… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/df3efb6fa50e0a5cd7c82df9… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 4 commits: [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs...
by Tony CHEMIT (@tchemit) 12 Nov '22

12 Nov '22
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 7ea06d73 by Tony Chemit at 2022-11-12T14:43:10+01:00 [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs alphanumériques - See #1544 Nettoyage par migration de tous les champs texte - Closes #2529 - - - - - 8f5e68fb by Tony Chemit at 2022-11-12T16:10:50+01:00 Test fixtures - [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs alphanumériques - See #1544 - - - - - c7278943 by Tony Chemit at 2022-11-12T16:10:50+01:00 Test fixtures - Renommage speciesFate - - - - - 247c8c3d by Tony Chemit at 2022-11-12T16:10:50+01:00 SetCatch - MEttre minWeight et maxWeight sur la meme ligne du formulaire - - - - - 20 changed files: - client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx - core/api/services/src/main/i18n/getters/labels.getter - core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripSpi.java - core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/DataWriter.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.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/FixCommentHelper.java - + core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.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 - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-dataResult.json - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-referentialResult.json - model/src/main/models/Observe/dto/class/i18nLabels.properties - model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties - + toolkit/api/src/main/java/fr/ird/observe/dto/StringCleaner.java - toolkit/api/src/main/java/fr/ird/observe/persistence/SqlHelper.java - toolkit/persistence/src/main/java/fr/ird/observe/spi/context/DataDtoEntityContext.java Changes: ===================================== client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter ===================================== @@ -190,6 +190,7 @@ observe.data.ps.observation.Catch.catchWeight observe.data.ps.observation.Catch.maxWeight observe.data.ps.observation.Catch.meanLength observe.data.ps.observation.Catch.meanWeight +observe.data.ps.observation.Catch.minMaxWeight observe.data.ps.observation.Catch.minWeight observe.data.ps.observation.Catch.reasonForDiscard observe.data.ps.observation.Catch.totalCount ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx ===================================== @@ -125,10 +125,13 @@ </row> <row> <cell> - <JLabel id='minWeightLabel'/> + <JLabel id='minMaxWeightLabel'/> </cell> <cell weightx='1'> - <NumberEditor id='minWeight' styleClass="float2"/> + <JPanel layout="{new GridLayout()}"> + <NumberEditor id='minWeight' styleClass="float2"/> + <NumberEditor id='maxWeight' styleClass="float2"/> + </JPanel> </cell> </row> <row> @@ -139,15 +142,6 @@ <NumberEditor id='meanWeight' styleClass="float2"/> </cell> </row> - <row> - <cell> - <JLabel id='maxWeightLabel'/> - </cell> - <cell weightx='1'> - <NumberEditor id='maxWeight' styleClass="float2"/> - </cell> - </row> - <!-- taille moyenne --> <row> <cell> ===================================== core/api/services/src/main/i18n/getters/labels.getter ===================================== @@ -1075,6 +1075,7 @@ observe.data.ps.observation.Catch.meanWeight observe.data.ps.observation.Catch.meanWeight.short observe.data.ps.observation.Catch.meanWeightComputed.computed.tip observe.data.ps.observation.Catch.meanWeightComputed.observed.tip +observe.data.ps.observation.Catch.minMaxWeight observe.data.ps.observation.Catch.minWeight observe.data.ps.observation.Catch.minWeight.short observe.data.ps.observation.Catch.reasonForDiscard ===================================== core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripSpi.java ===================================== @@ -45,6 +45,7 @@ import fr.ird.observe.entities.referential.ps.common.AcquisitionStatus; import fr.ird.observe.entities.referential.ps.common.ObservedSystem; import fr.ird.observe.entities.referential.ps.common.Program; import fr.ird.observe.entities.referential.ps.logbook.WellContentStatus; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.service.ServiceContext; import io.ultreia.java4all.util.Dates; import io.ultreia.java4all.util.sql.SqlScriptWriter; @@ -330,8 +331,8 @@ public class TripSpi extends GeneratedTripSpi { toId(observationsDataQuality), toId(observer), commentFormat.apply(observationsComment), - escapeString(formsUrl), - escapeString(reportsUrl), + SqlHelper.escapeString(formsUrl), + SqlHelper.escapeString(reportsUrl), newId); } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/DataWriter.java ===================================== @@ -77,7 +77,7 @@ public abstract class DataWriter<E extends DataEntity, R extends DataReader<E>> } public static String escapeString(String comment) { - return DataDtoEntityContext.escapeString(comment); + return SqlHelper.escapeString(comment); } public static String roundFloat2(Float comment) { ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java ===================================== @@ -23,7 +23,8 @@ package fr.ird.observe.spi.migration.v9; */ import com.google.auto.service.AutoService; -import fr.ird.observe.spi.context.DataDtoEntityContext; +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.migration.ByMajorMigrationVersionResource; import io.ultreia.java4all.util.Version; import io.ultreia.java4all.util.sql.SqlQuery; @@ -254,6 +255,7 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe executor.addScript("96", "add_referential_ps_common_ObservedSystem_finalize"); } } + private void migrateCatches(MigrationVersionResourceExecutor executor) { Function<String, String> commentFormat = executor.commentFormat(); @@ -395,7 +397,7 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe sample.topiaId, sample.topiaVersion, sample.topiaCreateDate, - DataDtoEntityContext.escapeString(sample.homeId), + SqlHelper.escapeString(StringCleaner.ALL.apply(sample.homeId)), stringFormat.apply(sample.comment), sample.set, sample.lastUpdateDate @@ -564,31 +566,39 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe sampleMeasure.topiaId, sampleMeasure.topiaVersion, sampleMeasure.topiaCreateDate, - DataDtoEntityContext.escapeString(sampleMeasure.homeId == null ? null : sampleMeasure.homeId.replaceAll("'", "")), + SqlHelper.escapeString(sampleMeasure.homeId == null ? null : sampleMeasure.homeId.replaceAll("'", "")), sampleMeasure.length, sampleMeasure.isLengthComputed, - DataDtoEntityContext.escapeString(sampleMeasure.picturesReferences == null ? null : sampleMeasure.picturesReferences.replaceAll("'", "")), + SqlHelper.escapeString(sampleMeasure.picturesReferences == null ? null : sampleMeasure.picturesReferences.replaceAll("'", "")), sampleMeasure.weight, sampleMeasure.isWeightComputed, sampleMeasure.count, sampleMeasure.acquisitionMode, - DataDtoEntityContext.escapeString(sampleMeasure.species), + SqlHelper.escapeString(sampleMeasure.species), sampleId, - DataDtoEntityContext.escapeString(sampleMeasure.sex), + SqlHelper.escapeString(sampleMeasure.sex), sampleMeasure.lastUpdateDate, - DataDtoEntityContext.escapeString(sampleMeasure.sizeMeasureType), - DataDtoEntityContext.escapeString(sampleMeasure.weightMeasureType), - DataDtoEntityContext.escapeString(sampleMeasure.tagNumber), - DataDtoEntityContext.escapeString(sampleMeasure.speciesFate), + SqlHelper.escapeString(sampleMeasure.sizeMeasureType), + SqlHelper.escapeString(sampleMeasure.weightMeasureType), + SqlHelper.escapeString(sampleMeasure.tagNumber), + SqlHelper.escapeString(sampleMeasure.speciesFate), sampleMeasure.sample_idx, - DataDtoEntityContext.escapeString(sampleMeasure.lengthMeasureMethod), - DataDtoEntityContext.escapeString(sampleMeasure.weightMeasureMethod) + SqlHelper.escapeString(sampleMeasure.lengthMeasureMethod), + SqlHelper.escapeString(sampleMeasure.weightMeasureMethod) )); } } @Override public void generateFinalizeSqlScript(MigrationVersionResourceExecutor executor) { + long stringFixedCount = new FixStringHelper(executor).execute(); + if (stringFixedCount > 0) { + log.warn(String.format("Fix %s string rows(s).", stringFixedCount)); + } + long commentFixedCount = new FixCommentHelper(executor).execute(); + if (commentFixedCount > 0) { + log.warn(String.format("Fix %s comment rows(s).", commentFixedCount)); + } migrateIdx(executor, "ps_observation", "catch", "set"); migrateIdx(executor, "ps_observation", "SampleMeasure", "sample"); } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DiscardedTargetCatchRecord.java ===================================== @@ -22,6 +22,8 @@ package fr.ird.observe.spi.migration.v9; * #L% */ +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.context.DataDtoEntityContext; import java.sql.Connection; @@ -56,19 +58,19 @@ public class DiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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" + + /* 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"); } @@ -132,24 +134,24 @@ public class DiscardedTargetCatchRecord { "%17$s, " + "%18$s" + ");", - /*1*/ DataDtoEntityContext.escapeString(id), + /*1*/ SqlHelper.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ SqlHelper.escapeString(StringCleaner.ALL.apply(homeId)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), /*8*/ null, /*9*/ getComment(weightCategoryRecord, commentFormat), - /*10*/ DataDtoEntityContext.escapeString(reasonForDiscardId), - /*11*/ DataDtoEntityContext.escapeString(weightCategoryRecord.getSpeciesId()), - /*12*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.SPECIES_FATE_5), - /*13*/ DataDtoEntityContext.escapeString(setId), + /*10*/ SqlHelper.escapeString(reasonForDiscardId), + /*11*/ SqlHelper.escapeString(weightCategoryRecord.getSpeciesId()), + /*12*/ SqlHelper.escapeString(DataSourceMigrationForVersion_9_0.SPECIES_FATE_5), + /*13*/ SqlHelper.escapeString(setId), /*14*/ DataDtoEntityContext.timestamp(lastUpdateDate), - /*15*/ DataDtoEntityContext.escapeString(getWell()), + /*15*/ SqlHelper.escapeString(StringCleaner.ALL.apply(well)), /*16*/ setIdx, - /*17*/ DataDtoEntityContext.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), - /*18*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_O) + /*17*/ SqlHelper.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), + /*18*/ SqlHelper.escapeString(DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_O) ); } @@ -160,14 +162,4 @@ 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/FixCommentHelper.java ===================================== @@ -0,0 +1,133 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +/** + * To auto-trim string comment fields. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixCommentHelper { + + private static final Logger log = LogManager.getLogger(FixCommentHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + private final Function<String, String> commentFormat; + + public FixCommentHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + commentFormat = executor.commentFormat(); + } + + public long execute() { + + fixField("common.Vessel", "comment"); + + fixField("ll_common.GearUseFeatures", "comment"); + fixField("ll_common.Program", "comment"); + fixField("ll_common.Trip", "generalComment"); + fixField("ll_common.Trip", "logbookComment"); + fixField("ll_common.Trip", "observationsComment"); + + fixField("ll_landing.Landing", "comment"); + + fixField("ll_logbook.Activity", "comment"); + fixField("ll_logbook.Catch", "comment"); + fixField("ll_logbook.Set", "comment"); + fixField("ll_logbook.Sample", "comment"); + + fixField("ll_observation.Activity", "comment"); + fixField("ll_observation.Branchline", "comment"); + fixField("ll_observation.Catch", "comment"); + fixField("ll_observation.Set", "comment"); + + fixField("ps_common.GearUseFeatures", "comment"); + fixField("ps_common.Program", "comment"); + fixField("ps_common.Trip", "generalComment"); + fixField("ps_common.Trip", "logbookComment"); + fixField("ps_common.Trip", "observationsComment"); + + fixField("ps_localmarket.Batch", "origin"); + fixField("ps_localmarket.Sample", "comment"); + fixField("ps_localmarket.SampleSpecies", "comment"); + fixField("ps_localmarket.Survey", "comment"); + + fixField("ps_logbook.Activity", "comment"); + fixField("ps_logbook.Catch", "comment"); + fixField("ps_logbook.FloatingObject", "comment"); + fixField("ps_logbook.Route", "comment"); + fixField("ps_logbook.Sample", "comment"); + fixField("ps_logbook.SampleSpecies", "comment"); + fixField("ps_logbook.TransmittingBuoy", "comment"); + + fixField("ps_observation.Activity", "comment"); + fixField("ps_observation.Catch", "comment"); + fixField("ps_observation.FloatingObject", "comment"); + fixField("ps_observation.NonTargetCatchRelease", "comment"); + fixField("ps_observation.Route", "comment"); + fixField("ps_observation.Set", "comment"); + fixField("ps_observation.TransmittingBuoy", "comment"); + return count.get(); + } + + public void fixField(String gav, String field) { + + executor.doSqlWork(connection -> { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = fieldValue.trim(); + if (!fieldValue.equals(fixFieldValue)) { + if (fixFieldValue.isEmpty()) { + fixFieldValue = null; + } + String id = resultSet.getString(1); + String finalFieldValue = commentFormat.apply(fixFieldValue); + log.info(String.format("Fix comment field %s.%s[%s] from\n[%s]\nto\n[%s]", gav, field, id, fieldValue, fixFieldValue)); + executor.writeSql(String.format("UPDATE %s SET %s = %s WHERE topiaId = '%s';", gav, field, finalFieldValue, id)); + count.incrementAndGet(); + } + } + } + } + }); + + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.java ===================================== @@ -0,0 +1,264 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; +import java.util.concurrent.atomic.AtomicLong; + +/** + * To auto-trim string fields and remove any {@code '} characters inside it. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixStringHelper { + + private static final Logger log = LogManager.getLogger(FixStringHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + + public FixStringHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + } + + static class FixStringEntityModel { + + private final String gav; + private final Map<String, StringCleaner> fieldsActions; + private final Set<String> fieldsDeleteIfNull; + + static FixStringEntityModel on(String gav, StringCleaner cleaner, String firstField, String... fields) { + return new FixStringEntityModel(gav).add(cleaner, firstField, fields); + } + + static FixStringEntityModel onI18n(String gav, StringCleaner cleaner, String firstField, String... fields) { + return on(gav, StringCleaner.TRIM, "label1", "label2", "label3").add(cleaner, firstField, fields); + } + + private FixStringEntityModel(String gav) { + this.gav = gav; + this.fieldsActions = new TreeMap<>(); + this.fieldsDeleteIfNull = new TreeSet<>(); + } + + FixStringEntityModel add(StringCleaner cleaner, String firstField, String... fields) { + fieldsActions.put(firstField, cleaner); + for (String field : fields) { + fieldsActions.put(field, cleaner); + } + return this; + } + + FixStringEntityModel deleteIfNull(String firstField, String... fields) { + fieldsDeleteIfNull.add(firstField); + Collections.addAll(fieldsDeleteIfNull, fields); + return this; + } + + } + + public long execute() { + executor.doSqlWork(connection -> { + execute(connection, FixStringEntityModel.onI18n("common.Country", StringCleaner.ALL, "code", "iso2Code", "iso3Code")); + execute(connection, FixStringEntityModel.onI18n("common.DataQuality", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.FpaZone", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Gear", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.GearCharacteristic", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.GearCharacteristicType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Harbour", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.LengthLengthParameter", StringCleaner.ALL, "coefficients", "inputOutputFormula", "outputInputFormula")); + execute(connection, FixStringEntityModel.onI18n("common.LengthMeasureMethod", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.LengthWeightParameter", StringCleaner.ALL, "coefficients", "lengthWeightFormula", "weightLengthFormula")); + execute(connection, FixStringEntityModel.onI18n("common.Ocean", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Organism", StringCleaner.ALL, "code")); + // not removing single quotes + execute(connection, FixStringEntityModel.on("common.Person", StringCleaner.TRIM, "firstName", "lastName")); + execute(connection, FixStringEntityModel.onI18n("common.Sex", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.ShipOwner", StringCleaner.ALL, "code", "label")); + execute(connection, FixStringEntityModel.onI18n("common.SizeMeasureType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Species", StringCleaner.ALL, "scientificLabel")); + execute(connection, FixStringEntityModel.onI18n("common.SpeciesGroup", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.SpeciesGroupReleaseMode", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.SpeciesList", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Vessel", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.VesselType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.VesselSizeCategory", StringCleaner.ALL, "code", "capacityLabel", "gaugeLabel")); + execute(connection, FixStringEntityModel.onI18n("common.WeightMeasureMethod", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.WeightMeasureType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Wind", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ll_common.BaitSettingStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.BaitType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.CatchFate", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.HealthStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.HookSize", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.HookType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.LightsticksColor", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.LightsticksType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.LineType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.MitigationType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.ObservationMethod", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.OnBoardProcessing", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.Program", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.SettingShape", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.TripType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.VesselActivity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.WeightDeterminationMethod", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ll_landing.Company", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_landing.Conservation", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_landing.DataSource", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ll_observation.BaitHaulingStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.EncounterType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.HookPosition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.ItemHorizontalPosition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.ItemVerticalPosition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.MaturityStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("ll_observation.SensorBrand", StringCleaner.ALL, "brandName", "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.SensorDataFormat", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.SensorType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.StomachFullness", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_common.AcquisitionStatus", StringCleaner.ALL, "code")); + // not set to null if empty (special value FOB has an empty code) + execute(connection, FixStringEntityModel.onI18n("ps_common.ObjectMaterial", StringCleaner.REMOVE_SINGLE_QUOTE_AND_TRIM, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ObjectMaterialType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ObjectOperation", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ObservedSystem", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.Program", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ReasonForNoFishing", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ReasonForNullSet", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.SampleType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.SchoolType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.SpeciesFate", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.TransmittingBuoyOperation", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.TransmittingBuoyOwnership", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.TransmittingBuoyType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.VesselActivity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.WeightCategory", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_landing.Destination", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_landing.Fate", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_localmarket.BatchComposition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_localmarket.BatchWeightType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_localmarket.Packaging", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_logbook.InformationSource", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.SampleQuality", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.SetSuccessStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.WellContentStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.WellSamplingConformity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.WellSamplingStatus", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_observation.DetectionMode", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.InformationSource", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.NonTargetCatchReleaseConformity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.NonTargetCatchReleaseStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.NonTargetCatchReleasingTime", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.ReasonForDiscard", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.SpeciesStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.SurroundingActivity", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.on("ll_common.GearUseFeaturesMeasurement", StringCleaner.ALL, "measurementValue").deleteIfNull("measurementValue")); + execute(connection, FixStringEntityModel.on("ll_common.Trip", StringCleaner.ALL, "ersId", "homeId")); + + execute(connection, FixStringEntityModel.on("ll_logbook.Catch", StringCleaner.ALL, "photoReferences", "tagNumber")); + execute(connection, FixStringEntityModel.on("ll_logbook.SamplePart", StringCleaner.ALL, "tagNumber")); + execute(connection, FixStringEntityModel.on("ll_logbook.Set", StringCleaner.ALL, "homeId")); + + execute(connection, FixStringEntityModel.on("ll_observation.Catch", StringCleaner.ALL, "photoReferences", "tagNumber")); + execute(connection, FixStringEntityModel.on("ll_observation.SensorUsed", StringCleaner.ALL, "sensorSerialNo")); + execute(connection, FixStringEntityModel.on("ll_observation.Set", StringCleaner.ALL, "homeId")); + execute(connection, FixStringEntityModel.on("ll_observation.Tdr", StringCleaner.ALL, "serialNo")); + + execute(connection, FixStringEntityModel.on("ps_common.GearUseFeaturesMeasurement", StringCleaner.ALL, "measurementValue").deleteIfNull("measurementValue")); + execute(connection, FixStringEntityModel.on("ps_common.Trip", StringCleaner.ALL, "ersId", "formsUrl", "homeId", "reportsUrl")); + + execute(connection, FixStringEntityModel.on("ps_localmarket.Sample", StringCleaner.ALL, "number")); + + execute(connection, FixStringEntityModel.on("ps_logbook.Catch", StringCleaner.ALL, "well")); + execute(connection, FixStringEntityModel.on("ps_logbook.FloatingObject", StringCleaner.ALL, "supportVesselName")); + execute(connection, FixStringEntityModel.on("ps_logbook.Sample", StringCleaner.ALL, "well")); + execute(connection, FixStringEntityModel.on("ps_logbook.TransmittingBuoy", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("ps_logbook.WellPlan", StringCleaner.ALL, "well")); + + execute(connection, FixStringEntityModel.on("ps_observation.Activity", StringCleaner.ALL, "ersId")); + execute(connection, FixStringEntityModel.on("ps_observation.FloatingObject", StringCleaner.ALL, "supportVesselName")); + execute(connection, FixStringEntityModel.on("ps_observation.SampleMeasure", StringCleaner.ALL, "picturesReferences", "tagNumber")); + execute(connection, FixStringEntityModel.on("ps_observation.Set", StringCleaner.ALL, "supportVesselName")); + execute(connection, FixStringEntityModel.on("ps_observation.TransmittingBuoy", StringCleaner.ALL, "code")); + }); + return count.get(); + } + + void execute(Connection connection, FixStringEntityModel model) throws SQLException { + for (Map.Entry<String, StringCleaner> entry : model.fieldsActions.entrySet()) { + execute(connection, model.gav, entry.getKey(), entry.getValue(), model.fieldsDeleteIfNull.contains(entry.getKey())); + } + } + + void execute(Connection connection, String gav, String field, StringCleaner cleaner, boolean deleteIfNull) throws SQLException { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = cleaner.apply(fieldValue); + if (!fieldValue.equals(fixFieldValue)) { + String id = resultSet.getString(1); + if (deleteIfNull && fixFieldValue == null) { + log.warn(String.format("Delete row since field is empty %s.%s[%s] (was '%s')", gav, field, id, fieldValue)); + executor.writeSql(String.format("DELETE FROM %1$s WHERE topiaId = '%2$s';", gav, id)); + } else { + log.info(String.format("Fix string field %s.%s[%s] from\n[%s]\n to\n[%s]", gav, field, id, fieldValue, fixFieldValue)); + String finalFieldValue = SqlHelper.escapeString(fixFieldValue); + executor.writeSql(String.format("UPDATE %1$s SET %2$s = %3$s WHERE topiaId = '%4$s';", gav, field, finalFieldValue, id)); + } + count.incrementAndGet(); + } + } + } + } + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java ===================================== @@ -22,6 +22,8 @@ package fr.ird.observe.spi.migration.v9; * #L% */ +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.context.DataDtoEntityContext; import java.sql.Connection; @@ -42,19 +44,19 @@ class NotDiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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 " + + /* 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 NOT ( weightCategory IS NULL AND catchweight IS NULL AND well IS NULL AND broughtondeck IS NULL AND reasonfordiscard IS NULL )"); } @@ -131,24 +133,24 @@ class NotDiscardedTargetCatchRecord { "%16$s, " + "%17$s, " + "%18$s);", - /*1*/ DataDtoEntityContext.escapeString(id), + /*1*/ SqlHelper.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ SqlHelper.escapeString(StringCleaner.ALL.apply(homeId)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), /*8*/ null, /*9*/ getComment(weightCategoryRecord, commentFormat), /*10*/ null, - /*11*/ DataDtoEntityContext.escapeString(weightCategoryRecord.getSpeciesId()), - /*12*/ DataDtoEntityContext.escapeString("10".equals(weightCategoryRecord.getCode()) ? DataSourceMigrationForVersion_9_0.SPECIES_FATE_15 : DataSourceMigrationForVersion_9_0.SPECIES_FATE_6), - /*13*/ DataDtoEntityContext.escapeString(setId), + /*11*/ SqlHelper.escapeString(weightCategoryRecord.getSpeciesId()), + /*12*/ SqlHelper.escapeString("10".equals(weightCategoryRecord.getCode()) ? DataSourceMigrationForVersion_9_0.SPECIES_FATE_15 : DataSourceMigrationForVersion_9_0.SPECIES_FATE_6), + /*13*/ SqlHelper.escapeString(setId), /*14*/ DataDtoEntityContext.timestamp(lastUpdateDate), - /*15*/ DataDtoEntityContext.escapeString(getWell()), + /*15*/ SqlHelper.escapeString(StringCleaner.ALL.apply(well)), /*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) + /*17*/ SqlHelper.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), + /*18*/ SqlHelper.escapeString(targetCatchCompositionEstimatedByObserver ? DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_P : DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_U) ); } @@ -158,16 +160,4 @@ 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 ===================================== @@ -1287,6 +1287,7 @@ observe.data.ps.observation.Catch.meanWeight.short=Mean weight observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Weight or mean size must be filled. observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Mean weight was computed (%s) observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Mean weight was observed +observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg) observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg) observe.data.ps.observation.Catch.minWeight.short=Min weight (in kg) observe.data.ps.observation.Catch.reasonForDiscard=Reason for discard ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1287,6 +1287,7 @@ observe.data.ps.observation.Catch.meanWeight.short=Peso medio observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Debe seleccionar uno de los dos valores (peso medio o talla media). observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=El peso medio se calculó observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=El peso medio se observó +observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg) TODO observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg) TODO observe.data.ps.observation.Catch.minWeight.short=Max weight (in kg) observe.data.ps.observation.Catch.reasonForDiscard=Razón del descarte ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1287,6 +1287,7 @@ observe.data.ps.observation.Catch.meanWeight.short=Poids moy observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Une des deux valeurs (poids moyen ou taille moyenne) devrait être renseignée. observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Le poids moyen a été calculé (%s) observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Le poids moyen a été observé +observe.data.ps.observation.Catch.minMaxWeight=Borne de poids inférieure / supérieure (en kg) observe.data.ps.observation.Catch.minWeight=Borne de poids inférieure (en kg) observe.data.ps.observation.Catch.minWeight.short=Poids min (en kg) observe.data.ps.observation.Catch.reasonForDiscard=Raison rejet ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-dataResult.json ===================================== @@ -43828,7 +43828,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.009Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "2", "id": "fr.ird.data.ps.observation.Catch#1554060786914#0.3899957341641852", @@ -43874,7 +43874,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.004Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "2", "id": "fr.ird.data.ps.observation.Catch#1554060786914#0.455212337619455", @@ -43920,7 +43920,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 16.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228692388#0.40195828823649804", @@ -43966,7 +43966,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228692388#0.5827043409961202", @@ -44012,7 +44012,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 4.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228964667#0.3873882731438876", @@ -44058,7 +44058,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 27.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228964667#0.6898347092973715", @@ -44104,7 +44104,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "4", "id": "fr.ird.data.ps.observation.Catch#1554228964683#0.5525193499129678", @@ -44150,7 +44150,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 39.0, "well": "4", "id": "fr.ird.data.ps.observation.Catch#1554228964683#0.6111969202426193", @@ -44196,7 +44196,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 15.0, "well": "4", "id": "fr.ird.data.ps.observation.Catch#1554229020077#0.06929838028483837", @@ -44242,7 +44242,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 25.0, "well": "2", "id": "fr.ird.data.ps.observation.Catch#1554229020077#0.764944972601716", @@ -44288,7 +44288,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "3", "id": "fr.ird.data.ps.observation.Catch#1554659569269#0.5089206009917716", @@ -44334,7 +44334,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 53.0, "well": "3", "id": "fr.ird.data.ps.observation.Catch#1554659569269#0.9595940690443661", @@ -44470,7 +44470,7 @@ "topiaVersion": 19, "topiaCreateDate": "2009-04-15T00:00:00.005Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 12.0, "well": "3T", "id": "fr.ird.data.ps.observation.Catch#1612860304046#0.051529228859696796", ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-referentialResult.json ===================================== @@ -56940,13 +56940,13 @@ }, { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "wormsId", @@ -62791,13 +62791,13 @@ }, { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "wormsId", @@ -63241,13 +63241,13 @@ "messages": [ { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "wormsId", @@ -68238,12 +68238,12 @@ { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." + "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." }, { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." + "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." }, { "fieldName": "species", @@ -68504,7 +68504,7 @@ { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." + "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." }, { "fieldName": "species", @@ -68514,7 +68514,7 @@ { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." + "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." }, { "fieldName": "species", @@ -142383,13 +142383,13 @@ }, { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "wellRegex", @@ -157800,13 +157800,13 @@ }, { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "vesselSizeCategory", @@ -196593,6 +196593,7 @@ "code": "1", "label": "Echappe du filet (pour requin-baleine et cétacés)", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683618#0.06155887805368032", @@ -196626,6 +196627,7 @@ "code": "3", "label": "Sortie mort du filet (pour requin-baleine et cétacés)", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.11883784875534997", @@ -196659,6 +196661,7 @@ "code": "4", "label": "Rejeté vivant", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5308862132841506", @@ -196682,6 +196685,7 @@ "code": "6", "label": "Conservé à destination de la conserverie", "discard": false, + "weightRangeAllowed": true, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5722739932065866", @@ -196710,6 +196714,7 @@ "code": "5", "label": "Rejeté mort", "discard": true, + "weightRangeAllowed": true, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877", @@ -196733,6 +196738,7 @@ "code": "2", "label": "Sortie vivant du filet (pour requin-baleine et cétacés)", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.9931091059863436", @@ -196765,6 +196771,7 @@ "content": { "code": "7", "label": "Partiellement conservé (ex: ailerons de requin, poisson séché)", + "weightRangeAllowed": false, "needComment": false, "enabled": false, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683620#0.46609703818634485", @@ -196803,6 +196810,7 @@ "code": "8", "label": "Utilisé en cuisine du bord", "discard": false, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683621#0.6728026426066158", @@ -196835,6 +196843,7 @@ "content": { "code": "9", "label": "Autres (à préciser dans les notes)", + "weightRangeAllowed": false, "needComment": true, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683621#0.9099804284263154", @@ -196868,6 +196877,7 @@ "code": "15", "label": "Conservé pour le marché local ou poisson séché/salé à bord", "discard": false, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1464000000000#15", @@ -196895,6 +196905,7 @@ "content": { "code": "10", "label": "Ailerons seulements", + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1467372855729#0.568287924081734", @@ -196918,6 +196929,7 @@ "code": "11", "label": "Rejeté, statut non observé", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1501492537510#0.9210847837998154", @@ -196941,6 +196953,7 @@ "code": "12", "label": "Conservé pour raisons scientifiques", "discard": false, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1501492831539#0.9377232562184147", @@ -196964,6 +196977,7 @@ "code": "13", "label": "Rejeté suffocant", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1544448835551#0.620629930572886", @@ -196987,6 +197001,7 @@ "code": "14", "label": "Rejeté suffocant blessé", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1544448977865#0.24265421995390768", ===================================== model/src/main/models/Observe/dto/class/i18nLabels.properties ===================================== @@ -84,7 +84,7 @@ data.ps.logbook.Well=well,wellVessel,wellFactory,wellSamplingConformity,wellSamp data.ps.logbook.WellActivity=activity,wellActivitySpecies data.ps.logbook.WellActivitySpecies=species,weight,weightCategory,count,setSpeciesNumber data.ps.observation.Activity=date,coordinate,observedSystem.available,observedSystem.selected,comment,comment2,currentFpaZone,dataQuality,detectionMode,ersId,floatingObjectEmpty,latitude,longitude,nextFpaZone,nonTargetCatchSpecies,observedSystem,observedSystemDistance,previousFpaZone,quadrant,reasonForNoFishing,seaSurfaceTemperature,surroundingActivity,time,vesselActivity,vesselSpeed,wind,generalTab,error.no.activity.6,measurementsTab,observedSystemTab -data.ps.observation.Catch=catchWeight,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip +data.ps.observation.Catch=catchWeight,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,minMaxWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip data.ps.observation.FloatingObject=materialsValid,objectOperation,supportVesselName,country,vessel,computedBiodegradable,computedNonEntangling,computedSimplifiedObjectType,computedValues,generalTab,buoysTab,materialsTab,notComputed,type.short data.ps.observation.NonTargetCatchRelease=comment,conformity,count,length,lengthMeasureMethod,releasingTime,sex,status,species,speciesGroupReleaseMode,message.cantAdd data.ps.observation.ObjectObservedSpecies=count,species,speciesStatus ===================================== model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties ===================================== @@ -23,7 +23,7 @@ data.ll.common.Trip=species data.ll.landing.Landing=vessel data.ps.localmarket.Sample=well data.ps.logbook.Catch=weightMeasureMethod.validation.required -data.ps.observation.Catch=minWeight,maxWeight,weightMeasureMethod +data.ps.observation.Catch=minWeight,maxWeight,minMaxWeight,weightMeasureMethod data.ps.observation.SchoolEstimate=species data.ps.observation.Set=startTime,haulingStartTimeStamp,haulingEndTimeStamp,endTimeStamp referential.common.Species=codeAndHomeId ===================================== toolkit/api/src/main/java/fr/ird/observe/dto/StringCleaner.java ===================================== @@ -0,0 +1,82 @@ +package fr.ird.observe.dto; + +/*- + * #%L + * ObServe Toolkit :: API + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import java.util.function.Function; + +/** + * Object to clean a string related to a database field. + * <p> + * Created on 12/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.017 + */ +public class StringCleaner implements Function<String, String> { + + public static final StringCleaner ALL = new StringCleaner(true, true, true); + public static final StringCleaner REMOVE_SINGLE_QUOTE_AND_TRIM = new StringCleaner(true, true, false); + public static final StringCleaner TRIM_AND_REPLACE_EMPTY_BY_NULL = new StringCleaner(false, true, true); + public static final StringCleaner TRIM = new StringCleaner(false, true, false); + + /** + * To remove any single quote in given string. + */ + private final boolean removeSingleQuote; + /** + * To perform a trim on given string. + */ + private final boolean trim; + /** + * To replace the given string value by null if it is empty. + */ + private final boolean replaceEmptyByNull; + + public StringCleaner(boolean removeSingleQuote, boolean trim, boolean replaceEmptyByNull) { + this.removeSingleQuote = removeSingleQuote; + this.trim = trim; + this.replaceEmptyByNull = replaceEmptyByNull; + } + + public static String removeSingleQuote(String string) { + return string.replaceAll("'", ""); + } + + @Override + public String apply(String string) { + if (string == null) { + return null; + } + String result = string; + if (removeSingleQuote) { + result = removeSingleQuote(result); + } + if (trim) { + result = result.trim(); + } + if (replaceEmptyByNull && result.isEmpty()) { + result = null; + } + return result; + } +} ===================================== toolkit/api/src/main/java/fr/ird/observe/persistence/SqlHelper.java ===================================== @@ -64,7 +64,21 @@ public class SqlHelper { if (trim.length() > maxLength) { trim = trim.substring(0, maxLength - 1); } - return "'" + trim.replaceAll("'", "''") + "'"; + return "'" + escapeSingleQuote(trim) + "'"; } + public static String escapeSingleQuote(String string) { + return string.replaceAll("'", "''"); + } + + public static String escapeString(String string) { + if (string == null) { + return "NULL"; + } + String trim = string.trim(); + if (trim.isEmpty()) { + return "NULL"; + } + return "'" + escapeSingleQuote(trim) + "'"; + } } ===================================== toolkit/persistence/src/main/java/fr/ird/observe/spi/context/DataDtoEntityContext.java ===================================== @@ -35,6 +35,7 @@ import fr.ird.observe.dto.referential.ReferentialLocale; import fr.ird.observe.entities.Entity; import fr.ird.observe.entities.data.DataEntity; import fr.ird.observe.entities.data.DataFileAware; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.persistence.request.DeleteRequest; import fr.ird.observe.spi.service.ServiceContext; import fr.ird.observe.spi.usage.UsageHelper; @@ -78,14 +79,7 @@ public abstract class DataDtoEntityContext< } public static String toId(Entity entity) { - return entity == null ? "NULL" : escapeString(entity.getTopiaId()); - } - - public static String escapeString(String string) { - if (string == null) { - return "NULL"; - } - return "'" + string.trim() + "'"; + return entity == null ? "NULL" : SqlHelper.escapeString(entity.getTopiaId()); } public static Blob byteArrayToBlob(byte[] bytes) { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ad0dd0ec7e1a4b1c31e84a56… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ad0dd0ec7e1a4b1c31e84a56… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-9.0.x] 5 commits: [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs...
by Tony CHEMIT (@tchemit) 12 Nov '22

12 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: bca4db5f by Tony Chemit at 2022-11-12T14:41:10+01:00 [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs alphanumériques - See #1544 Nettoyage par migration de tous les champs texte - Closes #2529 - - - - - fbed49a2 by Tony Chemit at 2022-11-12T14:41:10+01:00 Test fixtures - [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs alphanumériques - See #1544 - - - - - 0d869f9d by Tony Chemit at 2022-11-12T14:41:10+01:00 Test fixtures - Renommage speciesFate - - - - - f1d614cd by Tony Chemit at 2022-11-12T14:41:10+01:00 SetCatch - MEttre minWeight et maxWeight sur la meme ligne du formulaire - - - - - df3efb6f by Tony Chemit at 2022-11-12T14:41:10+01:00 Revert &quot;FIXME - Do not drop table until release time&quot; This reverts commit 73c88a1f12625a827361ececc852b783e4a0941d. - - - - - 22 changed files: - client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx - core/api/services/src/main/i18n/getters/labels.getter - core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripSpi.java - core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/DataWriter.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.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/FixCommentHelper.java - + core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java - core/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-H2.sql - core/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-PG.sql - 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 - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-dataResult.json - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-referentialResult.json - model/src/main/models/Observe/dto/class/i18nLabels.properties - model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties - + toolkit/api/src/main/java/fr/ird/observe/dto/StringCleaner.java - toolkit/api/src/main/java/fr/ird/observe/persistence/SqlHelper.java - toolkit/persistence/src/main/java/fr/ird/observe/spi/context/DataDtoEntityContext.java Changes: ===================================== client/datasource/editor/ps/src/main/i18n/getters/jaxx.getter ===================================== @@ -186,6 +186,7 @@ observe.data.ps.observation.Catch.catchWeight observe.data.ps.observation.Catch.maxWeight observe.data.ps.observation.Catch.meanLength observe.data.ps.observation.Catch.meanWeight +observe.data.ps.observation.Catch.minMaxWeight observe.data.ps.observation.Catch.minWeight observe.data.ps.observation.Catch.reasonForDiscard observe.data.ps.observation.Catch.totalCount ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetCatchUI.jaxx ===================================== @@ -125,10 +125,13 @@ </row> <row> <cell> - <JLabel id='minWeightLabel'/> + <JLabel id='minMaxWeightLabel'/> </cell> <cell weightx='1'> - <NumberEditor id='minWeight' styleClass="float2"/> + <JPanel layout="{new GridLayout()}"> + <NumberEditor id='minWeight' styleClass="float2"/> + <NumberEditor id='maxWeight' styleClass="float2"/> + </JPanel> </cell> </row> <row> @@ -139,15 +142,6 @@ <NumberEditor id='meanWeight' styleClass="float2"/> </cell> </row> - <row> - <cell> - <JLabel id='maxWeightLabel'/> - </cell> - <cell weightx='1'> - <NumberEditor id='maxWeight' styleClass="float2"/> - </cell> - </row> - <!-- taille moyenne --> <row> <cell> ===================================== core/api/services/src/main/i18n/getters/labels.getter ===================================== @@ -1038,6 +1038,7 @@ observe.data.ps.observation.Catch.meanWeight observe.data.ps.observation.Catch.meanWeight.short observe.data.ps.observation.Catch.meanWeightComputed.computed.tip observe.data.ps.observation.Catch.meanWeightComputed.observed.tip +observe.data.ps.observation.Catch.minMaxWeight observe.data.ps.observation.Catch.minWeight observe.data.ps.observation.Catch.minWeight.short observe.data.ps.observation.Catch.reasonForDiscard ===================================== core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripSpi.java ===================================== @@ -45,6 +45,7 @@ import fr.ird.observe.entities.referential.ps.common.AcquisitionStatus; import fr.ird.observe.entities.referential.ps.common.ObservedSystem; import fr.ird.observe.entities.referential.ps.common.Program; import fr.ird.observe.entities.referential.ps.logbook.WellContentStatus; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.service.ServiceContext; import io.ultreia.java4all.util.Dates; import io.ultreia.java4all.util.sql.SqlScriptWriter; @@ -330,8 +331,8 @@ public class TripSpi extends GeneratedTripSpi { toId(observationsDataQuality), toId(observer), commentFormat.apply(observationsComment), - escapeString(formsUrl), - escapeString(reportsUrl), + SqlHelper.escapeString(formsUrl), + SqlHelper.escapeString(reportsUrl), newId); } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/DataWriter.java ===================================== @@ -77,7 +77,7 @@ public abstract class DataWriter<E extends DataEntity, R extends DataReader<E>> } public static String escapeString(String comment) { - return DataDtoEntityContext.escapeString(comment); + return SqlHelper.escapeString(comment); } public static String roundFloat2(Float comment) { ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java ===================================== @@ -23,7 +23,8 @@ package fr.ird.observe.spi.migration.v9; */ import com.google.auto.service.AutoService; -import fr.ird.observe.spi.context.DataDtoEntityContext; +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.migration.ByMajorMigrationVersionResource; import io.ultreia.java4all.util.Version; import io.ultreia.java4all.util.sql.SqlQuery; @@ -254,6 +255,7 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe executor.addScript("96", "add_referential_ps_common_ObservedSystem_finalize"); } } + private void migrateCatches(MigrationVersionResourceExecutor executor) { Function<String, String> commentFormat = executor.commentFormat(); @@ -395,7 +397,7 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe sample.topiaId, sample.topiaVersion, sample.topiaCreateDate, - DataDtoEntityContext.escapeString(sample.homeId), + SqlHelper.escapeString(StringCleaner.ALL.apply(sample.homeId)), stringFormat.apply(sample.comment), sample.set, sample.lastUpdateDate @@ -564,31 +566,39 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe sampleMeasure.topiaId, sampleMeasure.topiaVersion, sampleMeasure.topiaCreateDate, - DataDtoEntityContext.escapeString(sampleMeasure.homeId == null ? null : sampleMeasure.homeId.replaceAll("'", "")), + SqlHelper.escapeString(sampleMeasure.homeId == null ? null : sampleMeasure.homeId.replaceAll("'", "")), sampleMeasure.length, sampleMeasure.isLengthComputed, - DataDtoEntityContext.escapeString(sampleMeasure.picturesReferences == null ? null : sampleMeasure.picturesReferences.replaceAll("'", "")), + SqlHelper.escapeString(sampleMeasure.picturesReferences == null ? null : sampleMeasure.picturesReferences.replaceAll("'", "")), sampleMeasure.weight, sampleMeasure.isWeightComputed, sampleMeasure.count, sampleMeasure.acquisitionMode, - DataDtoEntityContext.escapeString(sampleMeasure.species), + SqlHelper.escapeString(sampleMeasure.species), sampleId, - DataDtoEntityContext.escapeString(sampleMeasure.sex), + SqlHelper.escapeString(sampleMeasure.sex), sampleMeasure.lastUpdateDate, - DataDtoEntityContext.escapeString(sampleMeasure.sizeMeasureType), - DataDtoEntityContext.escapeString(sampleMeasure.weightMeasureType), - DataDtoEntityContext.escapeString(sampleMeasure.tagNumber), - DataDtoEntityContext.escapeString(sampleMeasure.speciesFate), + SqlHelper.escapeString(sampleMeasure.sizeMeasureType), + SqlHelper.escapeString(sampleMeasure.weightMeasureType), + SqlHelper.escapeString(sampleMeasure.tagNumber), + SqlHelper.escapeString(sampleMeasure.speciesFate), sampleMeasure.sample_idx, - DataDtoEntityContext.escapeString(sampleMeasure.lengthMeasureMethod), - DataDtoEntityContext.escapeString(sampleMeasure.weightMeasureMethod) + SqlHelper.escapeString(sampleMeasure.lengthMeasureMethod), + SqlHelper.escapeString(sampleMeasure.weightMeasureMethod) )); } } @Override public void generateFinalizeSqlScript(MigrationVersionResourceExecutor executor) { + long stringFixedCount = new FixStringHelper(executor).execute(); + if (stringFixedCount > 0) { + log.warn(String.format("Fix %s string rows(s).", stringFixedCount)); + } + long commentFixedCount = new FixCommentHelper(executor).execute(); + if (commentFixedCount > 0) { + log.warn(String.format("Fix %s comment rows(s).", commentFixedCount)); + } migrateIdx(executor, "ps_observation", "catch", "set"); migrateIdx(executor, "ps_observation", "SampleMeasure", "sample"); } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DiscardedTargetCatchRecord.java ===================================== @@ -22,6 +22,8 @@ package fr.ird.observe.spi.migration.v9; * #L% */ +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.context.DataDtoEntityContext; import java.sql.Connection; @@ -56,19 +58,19 @@ public class DiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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" + + /* 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"); } @@ -132,24 +134,24 @@ public class DiscardedTargetCatchRecord { "%17$s, " + "%18$s" + ");", - /*1*/ DataDtoEntityContext.escapeString(id), + /*1*/ SqlHelper.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ SqlHelper.escapeString(StringCleaner.ALL.apply(homeId)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), /*8*/ null, /*9*/ getComment(weightCategoryRecord, commentFormat), - /*10*/ DataDtoEntityContext.escapeString(reasonForDiscardId), - /*11*/ DataDtoEntityContext.escapeString(weightCategoryRecord.getSpeciesId()), - /*12*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.SPECIES_FATE_5), - /*13*/ DataDtoEntityContext.escapeString(setId), + /*10*/ SqlHelper.escapeString(reasonForDiscardId), + /*11*/ SqlHelper.escapeString(weightCategoryRecord.getSpeciesId()), + /*12*/ SqlHelper.escapeString(DataSourceMigrationForVersion_9_0.SPECIES_FATE_5), + /*13*/ SqlHelper.escapeString(setId), /*14*/ DataDtoEntityContext.timestamp(lastUpdateDate), - /*15*/ DataDtoEntityContext.escapeString(getWell()), + /*15*/ SqlHelper.escapeString(StringCleaner.ALL.apply(well)), /*16*/ setIdx, - /*17*/ DataDtoEntityContext.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), - /*18*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_O) + /*17*/ SqlHelper.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), + /*18*/ SqlHelper.escapeString(DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_O) ); } @@ -160,14 +162,4 @@ 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/FixCommentHelper.java ===================================== @@ -0,0 +1,133 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +/** + * To auto-trim string comment fields. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixCommentHelper { + + private static final Logger log = LogManager.getLogger(FixCommentHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + private final Function<String, String> commentFormat; + + public FixCommentHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + commentFormat = executor.commentFormat(); + } + + public long execute() { + + fixField("common.Vessel", "comment"); + + fixField("ll_common.GearUseFeatures", "comment"); + fixField("ll_common.Program", "comment"); + fixField("ll_common.Trip", "generalComment"); + fixField("ll_common.Trip", "logbookComment"); + fixField("ll_common.Trip", "observationsComment"); + + fixField("ll_landing.Landing", "comment"); + + fixField("ll_logbook.Activity", "comment"); + fixField("ll_logbook.Catch", "comment"); + fixField("ll_logbook.Set", "comment"); + fixField("ll_logbook.Sample", "comment"); + + fixField("ll_observation.Activity", "comment"); + fixField("ll_observation.Branchline", "comment"); + fixField("ll_observation.Catch", "comment"); + fixField("ll_observation.Set", "comment"); + + fixField("ps_common.GearUseFeatures", "comment"); + fixField("ps_common.Program", "comment"); + fixField("ps_common.Trip", "generalComment"); + fixField("ps_common.Trip", "logbookComment"); + fixField("ps_common.Trip", "observationsComment"); + + fixField("ps_localmarket.Batch", "origin"); + fixField("ps_localmarket.Sample", "comment"); + fixField("ps_localmarket.SampleSpecies", "comment"); + fixField("ps_localmarket.Survey", "comment"); + + fixField("ps_logbook.Activity", "comment"); + fixField("ps_logbook.Catch", "comment"); + fixField("ps_logbook.FloatingObject", "comment"); + fixField("ps_logbook.Route", "comment"); + fixField("ps_logbook.Sample", "comment"); + fixField("ps_logbook.SampleSpecies", "comment"); + fixField("ps_logbook.TransmittingBuoy", "comment"); + + fixField("ps_observation.Activity", "comment"); + fixField("ps_observation.Catch", "comment"); + fixField("ps_observation.FloatingObject", "comment"); + fixField("ps_observation.NonTargetCatchRelease", "comment"); + fixField("ps_observation.Route", "comment"); + fixField("ps_observation.Set", "comment"); + fixField("ps_observation.TransmittingBuoy", "comment"); + return count.get(); + } + + public void fixField(String gav, String field) { + + executor.doSqlWork(connection -> { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = fieldValue.trim(); + if (!fieldValue.equals(fixFieldValue)) { + if (fixFieldValue.isEmpty()) { + fixFieldValue = null; + } + String id = resultSet.getString(1); + String finalFieldValue = commentFormat.apply(fixFieldValue); + log.info(String.format("Fix comment field %s.%s[%s] from\n[%s]\nto\n[%s]", gav, field, id, fieldValue, fixFieldValue)); + executor.writeSql(String.format("UPDATE %s SET %s = %s WHERE topiaId = '%s';", gav, field, finalFieldValue, id)); + count.incrementAndGet(); + } + } + } + } + }); + + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.java ===================================== @@ -0,0 +1,264 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; +import java.util.concurrent.atomic.AtomicLong; + +/** + * To auto-trim string fields and remove any {@code '} characters inside it. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixStringHelper { + + private static final Logger log = LogManager.getLogger(FixStringHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + + public FixStringHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + } + + static class FixStringEntityModel { + + private final String gav; + private final Map<String, StringCleaner> fieldsActions; + private final Set<String> fieldsDeleteIfNull; + + static FixStringEntityModel on(String gav, StringCleaner cleaner, String firstField, String... fields) { + return new FixStringEntityModel(gav).add(cleaner, firstField, fields); + } + + static FixStringEntityModel onI18n(String gav, StringCleaner cleaner, String firstField, String... fields) { + return on(gav, StringCleaner.TRIM, "label1", "label2", "label3").add(cleaner, firstField, fields); + } + + private FixStringEntityModel(String gav) { + this.gav = gav; + this.fieldsActions = new TreeMap<>(); + this.fieldsDeleteIfNull = new TreeSet<>(); + } + + FixStringEntityModel add(StringCleaner cleaner, String firstField, String... fields) { + fieldsActions.put(firstField, cleaner); + for (String field : fields) { + fieldsActions.put(field, cleaner); + } + return this; + } + + FixStringEntityModel deleteIfNull(String firstField, String... fields) { + fieldsDeleteIfNull.add(firstField); + Collections.addAll(fieldsDeleteIfNull, fields); + return this; + } + + } + + public long execute() { + executor.doSqlWork(connection -> { + execute(connection, FixStringEntityModel.onI18n("common.Country", StringCleaner.ALL, "code", "iso2Code", "iso3Code")); + execute(connection, FixStringEntityModel.onI18n("common.DataQuality", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.FpaZone", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Gear", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.GearCharacteristic", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.GearCharacteristicType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Harbour", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.LengthLengthParameter", StringCleaner.ALL, "coefficients", "inputOutputFormula", "outputInputFormula")); + execute(connection, FixStringEntityModel.onI18n("common.LengthMeasureMethod", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.LengthWeightParameter", StringCleaner.ALL, "coefficients", "lengthWeightFormula", "weightLengthFormula")); + execute(connection, FixStringEntityModel.onI18n("common.Ocean", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Organism", StringCleaner.ALL, "code")); + // not removing single quotes + execute(connection, FixStringEntityModel.on("common.Person", StringCleaner.TRIM, "firstName", "lastName")); + execute(connection, FixStringEntityModel.onI18n("common.Sex", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.ShipOwner", StringCleaner.ALL, "code", "label")); + execute(connection, FixStringEntityModel.onI18n("common.SizeMeasureType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Species", StringCleaner.ALL, "scientificLabel")); + execute(connection, FixStringEntityModel.onI18n("common.SpeciesGroup", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.SpeciesGroupReleaseMode", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.SpeciesList", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Vessel", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.VesselType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("common.VesselSizeCategory", StringCleaner.ALL, "code", "capacityLabel", "gaugeLabel")); + execute(connection, FixStringEntityModel.onI18n("common.WeightMeasureMethod", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.WeightMeasureType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("common.Wind", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ll_common.BaitSettingStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.BaitType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.CatchFate", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.HealthStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.HookSize", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.HookType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.LightsticksColor", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.LightsticksType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.LineType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.MitigationType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.ObservationMethod", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.OnBoardProcessing", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.Program", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.SettingShape", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.TripType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.VesselActivity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_common.WeightDeterminationMethod", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ll_landing.Company", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_landing.Conservation", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_landing.DataSource", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ll_observation.BaitHaulingStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.EncounterType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.HookPosition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.ItemHorizontalPosition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.ItemVerticalPosition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.MaturityStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("ll_observation.SensorBrand", StringCleaner.ALL, "brandName", "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.SensorDataFormat", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.SensorType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ll_observation.StomachFullness", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_common.AcquisitionStatus", StringCleaner.ALL, "code")); + // not set to null if empty (special value FOB has an empty code) + execute(connection, FixStringEntityModel.onI18n("ps_common.ObjectMaterial", StringCleaner.REMOVE_SINGLE_QUOTE_AND_TRIM, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ObjectMaterialType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ObjectOperation", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ObservedSystem", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.Program", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ReasonForNoFishing", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.ReasonForNullSet", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.SampleType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.SchoolType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.SpeciesFate", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.TransmittingBuoyOperation", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.TransmittingBuoyOwnership", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.TransmittingBuoyType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.VesselActivity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_common.WeightCategory", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_landing.Destination", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_landing.Fate", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_localmarket.BatchComposition", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_localmarket.BatchWeightType", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_localmarket.Packaging", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_logbook.InformationSource", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.SampleQuality", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.SetSuccessStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.WellContentStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.WellSamplingConformity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_logbook.WellSamplingStatus", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.onI18n("ps_observation.DetectionMode", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.InformationSource", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.NonTargetCatchReleaseConformity", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.NonTargetCatchReleaseStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.NonTargetCatchReleasingTime", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.ReasonForDiscard", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.SpeciesStatus", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.onI18n("ps_observation.SurroundingActivity", StringCleaner.ALL, "code")); + + execute(connection, FixStringEntityModel.on("ll_common.GearUseFeaturesMeasurement", StringCleaner.ALL, "measurementValue").deleteIfNull("measurementValue")); + execute(connection, FixStringEntityModel.on("ll_common.Trip", StringCleaner.ALL, "ersId", "homeId")); + + execute(connection, FixStringEntityModel.on("ll_logbook.Catch", StringCleaner.ALL, "photoReferences", "tagNumber")); + execute(connection, FixStringEntityModel.on("ll_logbook.SamplePart", StringCleaner.ALL, "tagNumber")); + execute(connection, FixStringEntityModel.on("ll_logbook.Set", StringCleaner.ALL, "homeId")); + + execute(connection, FixStringEntityModel.on("ll_observation.Catch", StringCleaner.ALL, "photoReferences", "tagNumber")); + execute(connection, FixStringEntityModel.on("ll_observation.SensorUsed", StringCleaner.ALL, "sensorSerialNo")); + execute(connection, FixStringEntityModel.on("ll_observation.Set", StringCleaner.ALL, "homeId")); + execute(connection, FixStringEntityModel.on("ll_observation.Tdr", StringCleaner.ALL, "serialNo")); + + execute(connection, FixStringEntityModel.on("ps_common.GearUseFeaturesMeasurement", StringCleaner.ALL, "measurementValue").deleteIfNull("measurementValue")); + execute(connection, FixStringEntityModel.on("ps_common.Trip", StringCleaner.ALL, "ersId", "formsUrl", "homeId", "reportsUrl")); + + execute(connection, FixStringEntityModel.on("ps_localmarket.Sample", StringCleaner.ALL, "number")); + + execute(connection, FixStringEntityModel.on("ps_logbook.Catch", StringCleaner.ALL, "well")); + execute(connection, FixStringEntityModel.on("ps_logbook.FloatingObject", StringCleaner.ALL, "supportVesselName")); + execute(connection, FixStringEntityModel.on("ps_logbook.Sample", StringCleaner.ALL, "well")); + execute(connection, FixStringEntityModel.on("ps_logbook.TransmittingBuoy", StringCleaner.ALL, "code")); + execute(connection, FixStringEntityModel.on("ps_logbook.WellPlan", StringCleaner.ALL, "well")); + + execute(connection, FixStringEntityModel.on("ps_observation.Activity", StringCleaner.ALL, "ersId")); + execute(connection, FixStringEntityModel.on("ps_observation.FloatingObject", StringCleaner.ALL, "supportVesselName")); + execute(connection, FixStringEntityModel.on("ps_observation.SampleMeasure", StringCleaner.ALL, "picturesReferences", "tagNumber")); + execute(connection, FixStringEntityModel.on("ps_observation.Set", StringCleaner.ALL, "supportVesselName")); + execute(connection, FixStringEntityModel.on("ps_observation.TransmittingBuoy", StringCleaner.ALL, "code")); + }); + return count.get(); + } + + void execute(Connection connection, FixStringEntityModel model) throws SQLException { + for (Map.Entry<String, StringCleaner> entry : model.fieldsActions.entrySet()) { + execute(connection, model.gav, entry.getKey(), entry.getValue(), model.fieldsDeleteIfNull.contains(entry.getKey())); + } + } + + void execute(Connection connection, String gav, String field, StringCleaner cleaner, boolean deleteIfNull) throws SQLException { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = cleaner.apply(fieldValue); + if (!fieldValue.equals(fixFieldValue)) { + String id = resultSet.getString(1); + if (deleteIfNull && fixFieldValue == null) { + log.warn(String.format("Delete row since field is empty %s.%s[%s] (was '%s')", gav, field, id, fieldValue)); + executor.writeSql(String.format("DELETE FROM %1$s WHERE topiaId = '%2$s';", gav, id)); + } else { + log.info(String.format("Fix string field %s.%s[%s] from\n[%s]\n to\n[%s]", gav, field, id, fieldValue, fixFieldValue)); + String finalFieldValue = SqlHelper.escapeString(fixFieldValue); + executor.writeSql(String.format("UPDATE %1$s SET %2$s = %3$s WHERE topiaId = '%4$s';", gav, field, finalFieldValue, id)); + } + count.incrementAndGet(); + } + } + } + } + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java ===================================== @@ -22,6 +22,8 @@ package fr.ird.observe.spi.migration.v9; * #L% */ +import fr.ird.observe.dto.StringCleaner; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.spi.context.DataDtoEntityContext; import java.sql.Connection; @@ -42,19 +44,19 @@ class NotDiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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 " + + /* 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 NOT ( weightCategory IS NULL AND catchweight IS NULL AND well IS NULL AND broughtondeck IS NULL AND reasonfordiscard IS NULL )"); } @@ -131,24 +133,24 @@ class NotDiscardedTargetCatchRecord { "%16$s, " + "%17$s, " + "%18$s);", - /*1*/ DataDtoEntityContext.escapeString(id), + /*1*/ SqlHelper.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ SqlHelper.escapeString(StringCleaner.ALL.apply(homeId)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), /*8*/ null, /*9*/ getComment(weightCategoryRecord, commentFormat), /*10*/ null, - /*11*/ DataDtoEntityContext.escapeString(weightCategoryRecord.getSpeciesId()), - /*12*/ DataDtoEntityContext.escapeString("10".equals(weightCategoryRecord.getCode()) ? DataSourceMigrationForVersion_9_0.SPECIES_FATE_15 : DataSourceMigrationForVersion_9_0.SPECIES_FATE_6), - /*13*/ DataDtoEntityContext.escapeString(setId), + /*11*/ SqlHelper.escapeString(weightCategoryRecord.getSpeciesId()), + /*12*/ SqlHelper.escapeString("10".equals(weightCategoryRecord.getCode()) ? DataSourceMigrationForVersion_9_0.SPECIES_FATE_15 : DataSourceMigrationForVersion_9_0.SPECIES_FATE_6), + /*13*/ SqlHelper.escapeString(setId), /*14*/ DataDtoEntityContext.timestamp(lastUpdateDate), - /*15*/ DataDtoEntityContext.escapeString(getWell()), + /*15*/ SqlHelper.escapeString(StringCleaner.ALL.apply(well)), /*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) + /*17*/ SqlHelper.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), + /*18*/ SqlHelper.escapeString(targetCatchCompositionEstimatedByObserver ? DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_P : DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_U) ); } @@ -158,16 +160,4 @@ 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/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-H2.sql ===================================== @@ -25,12 +25,12 @@ ALTER TABLE ps_observation.Set DROP COLUMN targetdiscardcatchcompositionestimate ALTER TABLE ll_common.Trip DROP COLUMN program; ALTER TABLE ps_common.Trip DROP COLUMN program; --- DROP TABLE ps_observation.NonTargetLength; --- DROP TABLE ps_observation.NonTargetSample; --- DROP TABLE ps_observation.NonTargetCatch; --- DROP TABLE ps_observation.TargetCatch; --- DROP TABLE ps_observation.TargetSample; --- DROP TABLE ps_observation.TargetLength; +DROP TABLE ps_observation.NonTargetLength; +DROP TABLE ps_observation.NonTargetSample; +DROP TABLE ps_observation.NonTargetCatch; +DROP TABLE ps_observation.TargetCatch; +DROP TABLE ps_observation.TargetSample; +DROP TABLE ps_observation.TargetLength; DROP TABLE ps_observation.ReasonForNullSet; DROP TABLE ps_observation.ReasonForNoFishing; DROP TABLE ps_observation.WeightCategory; ===================================== core/persistence/resources/src/main/resources/db/migration/v9/9.0/99_2_drop_tables-PG.sql ===================================== @@ -25,12 +25,12 @@ ALTER TABLE ps_observation.Set DROP COLUMN targetdiscardcatchcompositionestimate ALTER TABLE ll_common.Trip DROP COLUMN program CASCADE; ALTER TABLE ps_common.Trip DROP COLUMN program CASCADE; --- DROP TABLE ps_observation.NonTargetLength CASCADE; --- DROP TABLE ps_observation.NonTargetSample CASCADE; --- DROP TABLE ps_observation.NonTargetCatch CASCADE; --- DROP TABLE ps_observation.TargetLength CASCADE; --- DROP TABLE ps_observation.TargetSample CASCADE; --- DROP TABLE ps_observation.TargetCatch CASCADE; +DROP TABLE ps_observation.NonTargetLength CASCADE; +DROP TABLE ps_observation.NonTargetSample CASCADE; +DROP TABLE ps_observation.NonTargetCatch CASCADE; +DROP TABLE ps_observation.TargetLength CASCADE; +DROP TABLE ps_observation.TargetSample CASCADE; +DROP TABLE ps_observation.TargetCatch CASCADE; DROP TABLE ps_observation.ReasonForNullSet CASCADE; DROP TABLE ps_observation.ReasonForNoFishing CASCADE; DROP TABLE ps_observation.WeightCategory CASCADE; ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1244,6 +1244,7 @@ observe.data.ps.observation.Catch.meanWeight.short=Mean weight observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Weight or mean size must be filled. observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Mean weight was computed (%s) observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Mean weight was observed +observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg) observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg) observe.data.ps.observation.Catch.minWeight.short=Min weight (in kg) observe.data.ps.observation.Catch.reasonForDiscard=Reason for discard ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1244,6 +1244,7 @@ observe.data.ps.observation.Catch.meanWeight.short=Peso medio observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Debe seleccionar uno de los dos valores (peso medio o talla media). observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=El peso medio se calculó observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=El peso medio se observó +observe.data.ps.observation.Catch.minMaxWeight=Lower / upper weight limit (in kg) TODO observe.data.ps.observation.Catch.minWeight=Lower weight limit (in kg) TODO observe.data.ps.observation.Catch.minWeight.short=Max weight (in kg) observe.data.ps.observation.Catch.reasonForDiscard=Razón del descarte ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1244,6 +1244,7 @@ observe.data.ps.observation.Catch.meanWeight.short=Poids moy observe.data.ps.observation.Catch.meanWeight.validation.notFilled=Une des deux valeurs (poids moyen ou taille moyenne) devrait être renseignée. observe.data.ps.observation.Catch.meanWeightComputed.computed.tip=Le poids moyen a été calculé (%s) observe.data.ps.observation.Catch.meanWeightComputed.observed.tip=Le poids moyen a été observé +observe.data.ps.observation.Catch.minMaxWeight=Borne de poids inférieure / supérieure (en kg) observe.data.ps.observation.Catch.minWeight=Borne de poids inférieure (en kg) observe.data.ps.observation.Catch.minWeight.short=Poids min (en kg) observe.data.ps.observation.Catch.reasonForDiscard=Raison rejet ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-dataResult.json ===================================== @@ -43828,7 +43828,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.009Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "2", "id": "fr.ird.data.ps.observation.Catch#1554060786914#0.3899957341641852", @@ -43874,7 +43874,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.004Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "2", "id": "fr.ird.data.ps.observation.Catch#1554060786914#0.455212337619455", @@ -43920,7 +43920,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 16.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228692388#0.40195828823649804", @@ -43966,7 +43966,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228692388#0.5827043409961202", @@ -44012,7 +44012,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 4.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228964667#0.3873882731438876", @@ -44058,7 +44058,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 27.0, "well": "1", "id": "fr.ird.data.ps.observation.Catch#1554228964667#0.6898347092973715", @@ -44104,7 +44104,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "4", "id": "fr.ird.data.ps.observation.Catch#1554228964683#0.5525193499129678", @@ -44150,7 +44150,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 39.0, "well": "4", "id": "fr.ird.data.ps.observation.Catch#1554228964683#0.6111969202426193", @@ -44196,7 +44196,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 15.0, "well": "4", "id": "fr.ird.data.ps.observation.Catch#1554229020077#0.06929838028483837", @@ -44242,7 +44242,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 25.0, "well": "2", "id": "fr.ird.data.ps.observation.Catch#1554229020077#0.764944972601716", @@ -44288,7 +44288,7 @@ "topiaVersion": 15, "topiaCreateDate": "2009-04-15T00:00:00.001Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 1.0, "well": "3", "id": "fr.ird.data.ps.observation.Catch#1554659569269#0.5089206009917716", @@ -44334,7 +44334,7 @@ "topiaVersion": 16, "topiaCreateDate": "2009-04-15T00:00:00.010Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 53.0, "well": "3", "id": "fr.ird.data.ps.observation.Catch#1554659569269#0.9595940690443661", @@ -44470,7 +44470,7 @@ "topiaVersion": 19, "topiaCreateDate": "2009-04-15T00:00:00.005Z" }, - "speciesFateLabel": "Conservé (en cuve, poisson séché ou salé)", + "speciesFateLabel": "Conservé à destination de la conserverie", "catchWeight": 12.0, "well": "3T", "id": "fr.ird.data.ps.observation.Catch#1612860304046#0.051529228859696796", ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-referentialResult.json ===================================== @@ -10711,7 +10711,7 @@ }, "startDate": "1970-01-01T00:00:00.000Z", "lengthWeightFormula": "a * Math.pow(L, b)", - "weightLengthFormula": "Math.pow(P/a, 1/b) ", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "DW", "label": "Disk Width", @@ -10751,9 +10751,9 @@ "sexLabel": "Indéterminé", "species": { "code": "248", - "label": "Mantes, diables de mer nca ", + "label": "Mantes, diables de mer nca", "faoCode": "MAN", - "scientificLabel": "Mobulidae ", + "scientificLabel": "Mobulidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1445863056144#0.9820877553253712", @@ -10771,7 +10771,7 @@ }, "startDate": "1970-01-01T00:00:00.000Z", "lengthWeightFormula": "a * Math.pow(L, b)", - "weightLengthFormula": " Math.pow(P/a, 1/b) ", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "DW", "label": "Disk Width", @@ -10831,7 +10831,7 @@ }, "startDate": "1970-01-01T00:00:00.000Z", "lengthWeightFormula": "a * Math.pow(L, b)", - "weightLengthFormula": "Math.pow(P/a, 1/b) ", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "FL", "label": "Fork Length", @@ -10871,7 +10871,7 @@ "sexLabel": "Indéterminé", "species": { "code": "376", - "label": "Rémora des espadons ", + "label": "Rémora des espadons", "faoCode": "REY", "scientificLabel": "Remora brachyptera", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -10890,7 +10890,7 @@ "topiaCreateDate": "2010-07-24T00:00:00.161Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", @@ -10931,7 +10931,7 @@ "sexLabel": "Indéterminé", "species": { "code": "375", - "label": "Rémora des marlins ", + "label": "Rémora des marlins", "faoCode": "REZ", "scientificLabel": "Remora osteochir", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -10950,8 +10950,8 @@ "topiaCreateDate": "2010-07-24T00:00:00.164Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", - "weightLengthFormula": "Math.pow(P/a, 1/b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", "label": "Total Length", @@ -11010,8 +11010,8 @@ "topiaCreateDate": "2010-07-24T00:00:00.160Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", - "weightLengthFormula": "Math.pow(P/a, 1/b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "FL", "label": "Fork Length", @@ -11071,7 +11071,7 @@ }, "startDate": "1970-01-01T00:00:00.000Z", "lengthWeightFormula": "a * Math.pow(L, b)", - "weightLengthFormula": "Math.pow(P/a, 1/b) ", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "FL", "label": "Fork Length", @@ -11173,7 +11173,7 @@ "code": "0", "label": "Famille Clupeidae", "faoCode": "CLP", - "scientificLabel": "Clupeidae ", + "scientificLabel": "Clupeidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -11231,7 +11231,7 @@ "code": "0", "label": "Famille Clupeidae", "faoCode": "CLP", - "scientificLabel": "Clupeidae ", + "scientificLabel": "Clupeidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -11306,7 +11306,7 @@ "topiaCreateDate": "2012-06-14T00:00:00.193Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "FL", @@ -11366,7 +11366,7 @@ "topiaCreateDate": "2012-06-14T00:00:00.193Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "FL", @@ -11422,8 +11422,8 @@ "topiaCreateDate": "2011-06-22T00:00:00.188Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", - "weightLengthFormula": "Math.pow(P/a, 1/b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", "label": "Total Length", @@ -11478,8 +11478,8 @@ "topiaCreateDate": "2011-06-22T00:00:00.188Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", - "weightLengthFormula": "Math.pow(P/a, 1/b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", + "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", "label": "Total Length", @@ -11519,7 +11519,7 @@ "sexLabel": "Indéterminé", "species": { "code": "0", - "label": "Rémora commun ", + "label": "Rémora commun", "faoCode": "EHN", "scientificLabel": "Echeneis naucrates", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -11534,7 +11534,7 @@ "topiaCreateDate": "2011-06-22T00:00:00.080Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", @@ -11575,7 +11575,7 @@ "sexLabel": "Indéterminé", "species": { "code": "0", - "label": "Rémora commun ", + "label": "Rémora commun", "faoCode": "EHN", "scientificLabel": "Echeneis naucrates", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -11590,7 +11590,7 @@ "topiaCreateDate": "2011-06-22T00:00:00.080Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", @@ -11648,7 +11648,7 @@ "topiaCreateDate": "2011-06-22T00:00:00.142Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", @@ -11706,7 +11706,7 @@ "topiaCreateDate": "2011-06-22T00:00:00.142Z" }, "startDate": "1970-01-01T00:00:00.000Z", - "lengthWeightFormula": "a * Math.pow(L, b) ", + "lengthWeightFormula": "a * Math.pow(L, b)", "weightLengthFormula": "Math.pow(P/a, 1/b)", "sizeMeasureType": { "code": "TL", @@ -11747,7 +11747,7 @@ "sexLabel": "Indéterminé", "species": { "code": "321", - "label": "Porc-épic boubou ", + "label": "Porc-épic boubou", "faoCode": "DIY", "scientificLabel": "Diodon hystrix", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -13489,7 +13489,7 @@ "sexLabel": "Indéterminé", "species": { "code": "340", - "label": "Calicagère bleue ", + "label": "Calicagère bleue", "faoCode": "KYC", "scientificLabel": "Kyphosus cinerascens", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -13549,7 +13549,7 @@ "sexLabel": "Indéterminé", "species": { "code": "334", - "label": "Kyphosus calicagères nca ", + "label": "Kyphosus calicagères nca", "faoCode": "KYP", "scientificLabel": "Kyphosus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -13609,7 +13609,7 @@ "sexLabel": "Indéterminé", "species": { "code": "334", - "label": "Kyphosus calicagères nca ", + "label": "Kyphosus calicagères nca", "faoCode": "KYP", "scientificLabel": "Kyphosus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -13729,7 +13729,7 @@ "sexLabel": "Indéterminé", "species": { "code": "359", - "label": "Sériole limon ", + "label": "Sériole limon", "faoCode": "YTL", "scientificLabel": "Seriola rivoliana", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -13789,7 +13789,7 @@ "sexLabel": "Indéterminé", "species": { "code": "359", - "label": "Sériole limon ", + "label": "Sériole limon", "faoCode": "YTL", "scientificLabel": "Seriola rivoliana", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -13909,7 +13909,7 @@ "sexLabel": "Indéterminé", "species": { "code": "312", - "label": "Comète maquereau ", + "label": "Comète maquereau", "faoCode": "MSD", "scientificLabel": "Decapterus macarellus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -13969,7 +13969,7 @@ "sexLabel": "Indéterminé", "species": { "code": "312", - "label": "Comète maquereau ", + "label": "Comète maquereau", "faoCode": "MSD", "scientificLabel": "Decapterus macarellus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -14389,7 +14389,7 @@ "sexLabel": "Indéterminé", "species": { "code": "367", - "label": "Carangue paia ", + "label": "Carangue paia", "faoCode": "URU", "scientificLabel": "Uraspis uraspis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -14749,7 +14749,7 @@ "sexLabel": "Indéterminé", "species": { "code": "315", - "label": "Carangue des îles ", + "label": "Carangue des îles", "faoCode": "NGT", "scientificLabel": "Carangoides orthogrammus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -15049,7 +15049,7 @@ "sexLabel": "Indéterminé", "species": { "code": "345", - "label": "Compère océanique ", + "label": "Compère océanique", "faoCode": "LGH", "scientificLabel": "Lagocephalus lagocephalus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -15109,7 +15109,7 @@ "sexLabel": "Indéterminé", "species": { "code": "345", - "label": "Compère océanique ", + "label": "Compère océanique", "faoCode": "LGH", "scientificLabel": "Lagocephalus lagocephalus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -15289,7 +15289,7 @@ "sexLabel": "Indéterminé", "species": { "code": "346", - "label": "Croupia roche ", + "label": "Croupia roche", "faoCode": "LOB", "scientificLabel": "Lobotes surinamensis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -15409,7 +15409,7 @@ "sexLabel": "Indéterminé", "species": { "code": "346", - "label": "Croupia roche ", + "label": "Croupia roche", "faoCode": "LOB", "scientificLabel": "Lobotes surinamensis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -17682,7 +17682,7 @@ "sexLabel": "Indéterminé", "species": { "code": "321", - "label": "Porc-épic boubou ", + "label": "Porc-épic boubou", "faoCode": "DIY", "scientificLabel": "Diodon hystrix", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -17982,7 +17982,7 @@ "sexLabel": "Indéterminé", "species": { "code": "316", - "label": "Carangue vorace ", + "label": "Carangue vorace", "faoCode": "CXS", "scientificLabel": "Caranx sexfasciatus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -18343,7 +18343,7 @@ "sexLabel": "Indéterminé", "species": { "code": "304", - "label": "Baliste cabri ", + "label": "Baliste cabri", "faoCode": "TRG", "scientificLabel": "Balistes carolinensis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -18403,7 +18403,7 @@ "sexLabel": "Indéterminé", "species": { "code": "341", - "label": "Calicagère blanche ", + "label": "Calicagère blanche", "faoCode": "KYS", "scientificLabel": "Kyphosus sectatrix", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -18463,7 +18463,7 @@ "sexLabel": "Indéterminé", "species": { "code": "352", - "label": "Poules d\u0027eau ", + "label": "Poules d\u0027eau", "faoCode": "BAT", "scientificLabel": "Platax spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -19903,7 +19903,7 @@ "sexLabel": "Indéterminé", "species": { "code": "309", - "label": "Orphie plate ", + "label": "Orphie plate", "faoCode": "BAF", "scientificLabel": "Ablennes hians", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -19963,7 +19963,7 @@ "sexLabel": "Indéterminé", "species": { "code": "309", - "label": "Orphie plate ", + "label": "Orphie plate", "faoCode": "BAF", "scientificLabel": "Ablennes hians", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -20263,7 +20263,7 @@ "sexLabel": "Indéterminé", "species": { "code": "364", - "label": "Aiguille crocodile ", + "label": "Aiguille crocodile", "faoCode": "BTS", "scientificLabel": "Tylosurus crocodilus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -20323,7 +20323,7 @@ "sexLabel": "Indéterminé", "species": { "code": "364", - "label": "Aiguille crocodile ", + "label": "Aiguille crocodile", "faoCode": "BTS", "scientificLabel": "Tylosurus crocodilus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -20813,9 +20813,9 @@ "sexLabel": "Indéterminé", "species": { "code": "324", - "label": "Rémora ", + "label": "Rémora", "faoCode": "HTL", - "scientificLabel": "Phtheirichthys lineatus ", + "scientificLabel": "Phtheirichthys lineatus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -20933,9 +20933,9 @@ "sexLabel": "Indéterminé", "species": { "code": "324", - "label": "Rémora ", + "label": "Rémora", "faoCode": "HTL", - "scientificLabel": "Phtheirichthys lineatus ", + "scientificLabel": "Phtheirichthys lineatus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -20993,7 +20993,7 @@ "sexLabel": "Indéterminé", "species": { "code": "331", - "label": "Demi-bec volant ", + "label": "Demi-bec volant", "faoCode": "EXQ", "scientificLabel": "Euleptorhamphus velox", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -21353,7 +21353,7 @@ "sexLabel": "Indéterminé", "species": { "code": "368", - "label": "Comètes nca ", + "label": "Comètes nca", "faoCode": "SDX", "scientificLabel": "Decapterus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -21413,7 +21413,7 @@ "sexLabel": "Indéterminé", "species": { "code": "368", - "label": "Comètes nca ", + "label": "Comètes nca", "faoCode": "SDX", "scientificLabel": "Decapterus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -30074,7 +30074,7 @@ "sexLabel": "Indéterminé", "species": { "code": "210", - "label": "Renards de mer nca ", + "label": "Renards de mer nca", "faoCode": "THR", "scientificLabel": "Alopias spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -30134,7 +30134,7 @@ "sexLabel": "Indéterminé", "species": { "code": "210", - "label": "Renards de mer nca ", + "label": "Renards de mer nca", "faoCode": "THR", "scientificLabel": "Alopias spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -31346,7 +31346,7 @@ "sexLabel": "Indéterminé", "species": { "code": "230", - "label": "Requins-scies nca ", + "label": "Requins-scies nca", "faoCode": "PWS", "scientificLabel": "Pristiophorus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -31406,7 +31406,7 @@ "sexLabel": "Indéterminé", "species": { "code": "230", - "label": "Requins-scies nca ", + "label": "Requins-scies nca", "faoCode": "PWS", "scientificLabel": "Pristiophorus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -31466,7 +31466,7 @@ "sexLabel": "Indéterminé", "species": { "code": "232", - "label": "Anges de mer nca ", + "label": "Anges de mer nca", "faoCode": "ASK", "scientificLabel": "Squatinidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", @@ -31526,7 +31526,7 @@ "sexLabel": "Indéterminé", "species": { "code": "232", - "label": "Anges de mer nca ", + "label": "Anges de mer nca", "faoCode": "ASK", "scientificLabel": "Squatinidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", @@ -32006,7 +32006,7 @@ "sexLabel": "Indéterminé", "species": { "code": "372", - "label": "Luvar ", + "label": "Luvar", "faoCode": "LVM", "scientificLabel": "Luvarus imperialis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -32066,7 +32066,7 @@ "sexLabel": "Indéterminé", "species": { "code": "376", - "label": "Rémora des espadons ", + "label": "Rémora des espadons", "faoCode": "REY", "scientificLabel": "Remora brachyptera", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -32126,7 +32126,7 @@ "sexLabel": "Indéterminé", "species": { "code": "375", - "label": "Rémora des marlins ", + "label": "Rémora des marlins", "faoCode": "REZ", "scientificLabel": "Remora osteochir", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -32366,9 +32366,9 @@ "sexLabel": "Indéterminé", "species": { "code": "248", - "label": "Mantes, diables de mer nca ", + "label": "Mantes, diables de mer nca", "faoCode": "MAN", - "scientificLabel": "Mobulidae ", + "scientificLabel": "Mobulidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1445863056144#0.9820877553253712", @@ -35440,7 +35440,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Alicia ", + "firstName": "Alicia", "lastName": "Moreno", "captain": false, "observer": true, @@ -35521,7 +35521,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "J. ", + "firstName": "J.", "lastName": "Quinquis", "captain": false, "observer": true, @@ -35548,7 +35548,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Cristina ", + "firstName": "Cristina", "lastName": "Ortiz", "captain": false, "observer": true, @@ -35602,7 +35602,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Laura ", + "firstName": "Laura", "lastName": "Quintero", "captain": false, "observer": true, @@ -35629,7 +35629,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "P. ", + "firstName": "P.", "lastName": "Ragot", "captain": false, "observer": true, @@ -35683,7 +35683,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Susana ", + "firstName": "Susana", "lastName": "Razquin", "captain": false, "observer": true, @@ -35710,7 +35710,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "F. ", + "firstName": "F.", "lastName": "Ruchon", "captain": false, "observer": true, @@ -35737,7 +35737,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Rafael Sánchez ", + "firstName": "Rafael Sánchez", "lastName": "Robles", "captain": false, "observer": true, @@ -35791,7 +35791,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Miriam ", + "firstName": "Miriam", "lastName": "Rodriguez", "captain": false, "observer": true, @@ -35818,7 +35818,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "V. ", + "firstName": "V.", "lastName": "Rigolet", "captain": false, "observer": true, @@ -35953,7 +35953,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Sonia ", + "firstName": "Sonia", "lastName": "Vega", "captain": false, "observer": true, @@ -35980,7 +35980,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Eva Mº del Rio ", + "firstName": "Eva Mº del Rio", "lastName": "Zarraga", "captain": false, "observer": true, @@ -36007,7 +36007,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Virgilia ", + "firstName": "Virgilia", "lastName": "Yance", "captain": false, "observer": true, @@ -36061,7 +36061,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Razquin ", + "firstName": "Razquin", "lastName": "Urdiain", "captain": false, "observer": true, @@ -36088,7 +36088,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "T. ", + "firstName": "T.", "lastName": "Vanhoutte", "captain": false, "observer": true, @@ -38410,7 +38410,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "David ", + "firstName": "David", "lastName": "Acuña", "captain": false, "observer": true, @@ -38437,7 +38437,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Patricia ", + "firstName": "Patricia", "lastName": "Arbona", "captain": false, "observer": true, @@ -38518,7 +38518,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Beatriz ", + "firstName": "Beatriz", "lastName": "Bastos", "captain": false, "observer": true, @@ -38599,7 +38599,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Mª Carmen ", + "firstName": "Mª Carmen", "lastName": "Arenas", "captain": false, "observer": true, @@ -38653,7 +38653,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Raquel ", + "firstName": "Raquel", "lastName": "Bello", "captain": false, "observer": true, @@ -38680,7 +38680,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "P. ", + "firstName": "P.", "lastName": "Corler", "captain": false, "observer": true, @@ -38707,7 +38707,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Rosa ", + "firstName": "Rosa", "lastName": "Delgado de Molina Acevedo", "captain": false, "observer": true, @@ -38761,7 +38761,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Alejandro ", + "firstName": "Alejandro", "lastName": "Cruz Reyes", "captain": false, "observer": true, @@ -38788,7 +38788,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Mª Jose Bayarri ", + "firstName": "Mª Jose Bayarri", "lastName": "Clariana", "captain": false, "observer": true, @@ -38815,7 +38815,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Eugenia Pia ", + "firstName": "Eugenia Pia", "lastName": "Fernández", "captain": false, "observer": true, @@ -38842,7 +38842,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "E. ", + "firstName": "E.", "lastName": "Devaux", "captain": false, "observer": true, @@ -38896,7 +38896,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Carmen ", + "firstName": "Carmen", "lastName": "Gutierrez", "captain": false, "observer": true, @@ -38923,7 +38923,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Ricardo ", + "firstName": "Ricardo", "lastName": "Iglesias", "captain": false, "observer": true, @@ -38950,7 +38950,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Rut ", + "firstName": "Rut", "lastName": "Hernández", "captain": false, "observer": true, @@ -38977,7 +38977,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Celso A. ", + "firstName": "Celso A.", "lastName": "Hernández Díaz", "captain": false, "observer": true, @@ -39004,7 +39004,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Alfonso ", + "firstName": "Alfonso", "lastName": "Gonzalez", "captain": false, "observer": true, @@ -39085,7 +39085,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Raquel ", + "firstName": "Raquel", "lastName": "Maestre", "captain": false, "observer": true, @@ -39112,7 +39112,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Ph. ", + "firstName": "Ph.", "lastName": "Le Niliot", "captain": false, "observer": true, @@ -39139,7 +39139,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Iñigo ", + "firstName": "Iñigo", "lastName": "Labarga", "captain": false, "observer": true, @@ -39166,7 +39166,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "C. ", + "firstName": "C.", "lastName": "Labaisse", "captain": false, "observer": true, @@ -39193,7 +39193,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Noemí ", + "firstName": "Noemí", "lastName": "Martinez", "captain": false, "observer": true, @@ -39247,7 +39247,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Laura Entrambasaguas ", + "firstName": "Laura Entrambasaguas", "lastName": "Monsell", "captain": false, "observer": true, @@ -43653,7 +43653,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": " Benoit", + "firstName": "Benoit", "lastName": "Dumeau ", "captain": false, "observer": true, @@ -44220,7 +44220,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Damenéko Jean-Marc ", + "firstName": "Damenéko Jean-Marc", "lastName": "Zouhoury", "captain": false, "observer": true, @@ -48216,7 +48216,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.common.PersonReference", "content": { - "firstName": "Zegbehi Magloire ", + "firstName": "Zegbehi Magloire", "lastName": "Gnadou", "captain": false, "observer": false, @@ -56754,7 +56754,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "210", - "label": "Renards de mer nca ", + "label": "Renards de mer nca", "faoCode": "THR", "scientificLabel": "Alopias spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -56940,13 +56940,13 @@ }, { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "wormsId", @@ -57520,7 +57520,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "230", - "label": "Requins-scies nca ", + "label": "Requins-scies nca", "faoCode": "PWS", "scientificLabel": "Pristiophorus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -57594,7 +57594,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "232", - "label": "Anges de mer nca ", + "label": "Anges de mer nca", "faoCode": "ASK", "scientificLabel": "Squatinidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", @@ -58217,7 +58217,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "304", - "label": "Baliste cabri ", + "label": "Baliste cabri", "faoCode": "TRG", "scientificLabel": "Balistes carolinensis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -58402,7 +58402,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "309", - "label": "Orphie plate ", + "label": "Orphie plate", "faoCode": "BAF", "scientificLabel": "Ablennes hians", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -58518,7 +58518,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "312", - "label": "Comète maquereau ", + "label": "Comète maquereau", "faoCode": "MSD", "scientificLabel": "Decapterus macarellus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -58629,7 +58629,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "315", - "label": "Carangue des îles ", + "label": "Carangue des îles", "faoCode": "NGT", "scientificLabel": "Carangoides orthogrammus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -58666,7 +58666,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "316", - "label": "Carangue vorace ", + "label": "Carangue vorace", "faoCode": "CXS", "scientificLabel": "Caranx sexfasciatus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -58851,7 +58851,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "321", - "label": "Porc-épic boubou ", + "label": "Porc-épic boubou", "faoCode": "DIY", "scientificLabel": "Diodon hystrix", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -58962,9 +58962,9 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "324", - "label": "Rémora ", + "label": "Rémora", "faoCode": "HTL", - "scientificLabel": "Phtheirichthys lineatus ", + "scientificLabel": "Phtheirichthys lineatus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -59221,7 +59221,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "331", - "label": "Demi-bec volant ", + "label": "Demi-bec volant", "faoCode": "EXQ", "scientificLabel": "Euleptorhamphus velox", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -59332,7 +59332,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "334", - "label": "Kyphosus calicagères nca ", + "label": "Kyphosus calicagères nca", "faoCode": "KYP", "scientificLabel": "Kyphosus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -59564,7 +59564,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "340", - "label": "Calicagère bleue ", + "label": "Calicagère bleue", "faoCode": "KYC", "scientificLabel": "Kyphosus cinerascens", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -59601,7 +59601,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "341", - "label": "Calicagère blanche ", + "label": "Calicagère blanche", "faoCode": "KYS", "scientificLabel": "Kyphosus sectatrix", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -59764,7 +59764,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "345", - "label": "Compère océanique ", + "label": "Compère océanique", "faoCode": "LGH", "scientificLabel": "Lagocephalus lagocephalus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -59801,7 +59801,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "346", - "label": "Croupia roche ", + "label": "Croupia roche", "faoCode": "LOB", "scientificLabel": "Lobotes surinamensis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -59949,7 +59949,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "350", - "label": "Poissons marins nca ", + "label": "Poissons marins nca", "faoCode": "MZZ", "scientificLabel": "Osteichthyes", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1464000000000#99", @@ -60028,7 +60028,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "352", - "label": "Poules d\u0027eau ", + "label": "Poules d\u0027eau", "faoCode": "BAT", "scientificLabel": "Platax spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -60292,7 +60292,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "359", - "label": "Sériole limon ", + "label": "Sériole limon", "faoCode": "YTL", "scientificLabel": "Seriola rivoliana", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -60482,7 +60482,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "364", - "label": "Aiguille crocodile ", + "label": "Aiguille crocodile", "faoCode": "BTS", "scientificLabel": "Tylosurus crocodilus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -62686,7 +62686,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "0", - "label": "Thon rouge de l\u0027Atlantique ", + "label": "Thon rouge de l\u0027Atlantique", "faoCode": "BFT", "scientificLabel": "Thunnus thynnus", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -62719,9 +62719,9 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "0", - "label": "Mobula coilloti ", + "label": "Mobula coilloti", "faoCode": "RMC", - "scientificLabel": "Mobula coilloti ", + "scientificLabel": "Mobula coilloti", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1445863056144#0.9820877553253712", @@ -62791,13 +62791,13 @@ }, { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "wormsId", @@ -62811,9 +62811,9 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "0", - "label": "Sergent-major ", + "label": "Sergent-major", "faoCode": "ABU", - "scientificLabel": "Abudefduf saxatilis ", + "scientificLabel": "Abudefduf saxatilis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -62850,7 +62850,7 @@ "code": "0", "label": "Famille Clupeidae", "faoCode": "CLP", - "scientificLabel": "Clupeidae ", + "scientificLabel": "Clupeidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -62916,7 +62916,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "0", - "label": "Rémora commun ", + "label": "Rémora commun", "faoCode": "EHN", "scientificLabel": "Echeneis naucrates", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -62994,9 +62994,9 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "0", - "label": "Oreosoma atlanticum ", + "label": "Oreosoma atlanticum", "faoCode": "OOT", - "scientificLabel": "Oreosoma atlanticum ", + "scientificLabel": "Oreosoma atlanticum", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1239832683689#0.12092280503502995", @@ -63241,13 +63241,13 @@ "messages": [ { "fieldName": "uri", - "scope": "WARNING", - "message": "Le champ n\u0027est pas renseigné." + "scope": "ERROR", + "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." }, { "fieldName": "uri", - "scope": "ERROR", - "message": "Le champ (s\u0027il est renseigné) ne doit pas être consituté que d\u0027espaces." + "scope": "WARNING", + "message": "Le champ n\u0027est pas renseigné." }, { "fieldName": "wormsId", @@ -66923,7 +66923,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "111", - "label": "Makaire bleu indo-pacifique ", + "label": "Makaire bleu indo-pacifique", "faoCode": "1BUM", "scientificLabel": "Makaira mazara", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499467326#0.537910396233201", @@ -67076,9 +67076,9 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "248", - "label": "Mantes, diables de mer nca ", + "label": "Mantes, diables de mer nca", "faoCode": "MAN", - "scientificLabel": "Mobulidae ", + "scientificLabel": "Mobulidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", "weightMeasureTypeId": "fr.ird.referential.common.WeightMeasureType#1239832686139#0.2", "speciesGroupId": "fr.ird.referential.common.SpeciesGroup#1445863056144#0.9820877553253712", @@ -67155,7 +67155,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "250", - "label": "Torpilles, raies électriq. nca ", + "label": "Torpilles, raies électriq. nca", "faoCode": "TOD", "scientificLabel": "Torpedinidae", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499468646#0.710986209334806", @@ -67188,7 +67188,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "367", - "label": "Carangue paia ", + "label": "Carangue paia", "faoCode": "URU", "scientificLabel": "Uraspis uraspis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -67225,7 +67225,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "368", - "label": "Comètes nca ", + "label": "Comètes nca", "faoCode": "SDX", "scientificLabel": "Decapterus spp", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -67373,7 +67373,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "372", - "label": "Luvar ", + "label": "Luvar", "faoCode": "LVM", "scientificLabel": "Luvarus imperialis", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499465700#0.0902433863375336", @@ -67494,7 +67494,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "375", - "label": "Rémora des marlins ", + "label": "Rémora des marlins", "faoCode": "REZ", "scientificLabel": "Remora osteochir", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -67531,7 +67531,7 @@ "type": "fr.ird.observe.dto.referential.common.SpeciesReference", "content": { "code": "376", - "label": "Rémora des espadons ", + "label": "Rémora des espadons", "faoCode": "REY", "scientificLabel": "Remora brachyptera", "sizeMeasureTypeId": "fr.ird.referential.common.SizeMeasureType#1433499466532#0.844473292818293", @@ -68238,17 +68238,17 @@ { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." + "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." }, { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." + "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." }, { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «1BUM - Makaira mazara - Makaire bleu indo-pacifique » (à la position 191) est désactivé." + "message": "Le référentiel sélectionné «1BUM - Makaira mazara - Makaire bleu indo-pacifique» (à la position 191) est désactivé." }, { "fieldName": "uri", @@ -68504,7 +68504,7 @@ { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." + "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." }, { "fieldName": "species", @@ -68514,12 +68514,12 @@ { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «LKY - Lepidochelys kempii - Tortue de Kemp» (à la position 120) est désactivé." + "message": "Le référentiel sélectionné «1BUM - Makaira mazara - Makaire bleu indo-pacifique» (à la position 208) est désactivé." }, { "fieldName": "species", "scope": "ERROR", - "message": "Le référentiel sélectionné «1BUM - Makaira mazara - Makaire bleu indo-pacifique » (à la position 208) est désactivé." + "message": "Le référentiel sélectionné «SPY - Sphyrnidae - Famille Sphyrnidae» (à la position 24) est désactivé." }, { "fieldName": "uri", @@ -112051,7 +112051,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -117500,7 +117500,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselReference", "content": { "code": "550", - "label": "ALACRAN ", + "label": "ALACRAN", "wellRegex": "^(1A|([1-9]{1}[B;T]{1}|(1{1}[0-9]{1}[B;T]{1}))){1}$", "vesselType": { "code": "6", @@ -118326,7 +118326,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -118419,7 +118419,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -119239,7 +119239,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -119322,7 +119322,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -119405,7 +119405,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -120093,7 +120093,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -120797,7 +120797,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -121069,7 +121069,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -123297,7 +123297,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -123857,7 +123857,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -124596,7 +124596,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -124938,7 +124938,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -128722,7 +128722,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -129240,7 +129240,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -129664,7 +129664,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -132014,7 +132014,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselReference", "content": { "code": "713", - "label": "ALACRAN ", + "label": "ALACRAN", "wellRegex": "^(1A|([1-9]{1}[B;T]{1}|(1{1}[0-9]{1}[B;T]{1}))){1}$", "vesselType": { "code": "6", @@ -132889,7 +132889,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -134232,7 +134232,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -134480,7 +134480,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -134563,7 +134563,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -134738,7 +134738,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -134987,7 +134987,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -135162,7 +135162,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -136060,7 +136060,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -136226,7 +136226,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -137184,7 +137184,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -137857,7 +137857,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -137945,7 +137945,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -143082,7 +143082,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselReference", "content": { "code": "842", - "label": "PANOFI PATHFINDER ", + "label": "PANOFI PATHFINDER", "wellRegex": "^(1A|([1-9]{1}[B;T]{1}|(1{1}[0-9]{1}[B;T]{1}))){1}$", "vesselType": { "code": "6", @@ -145713,7 +145713,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -148123,7 +148123,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -150347,7 +150347,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -153236,7 +153236,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselReference", "content": { "code": "1014", - "label": "LE CHINOIS 2 ", + "label": "LE CHINOIS 2", "vesselType": { "code": "7", "label": "Palangrier", @@ -156190,7 +156190,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -156273,7 +156273,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -157081,7 +157081,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -159379,7 +159379,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -161228,7 +161228,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -163816,7 +163816,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -164658,7 +164658,7 @@ }, "vesselSizeCategory": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -179501,7 +179501,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselSizeCategoryReference", "content": { "code": "8", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 1200 tonnes", "needComment": false, "enabled": true, @@ -179524,7 +179524,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselSizeCategoryReference", "content": { "code": "10", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "1601 - 1800 tonnes", "needComment": false, "enabled": false, @@ -179575,7 +179575,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselSizeCategoryReference", "content": { "code": "11", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "1801 - 2000 tonnes", "needComment": false, "enabled": false, @@ -179603,7 +179603,7 @@ "type": "fr.ird.observe.dto.referential.common.VesselSizeCategoryReference", "content": { "code": "12", - "gaugeLabel": " + 2300 TX", + "gaugeLabel": "+ 2300 TX", "capacityLabel": "\u003e 2000 tonnes", "needComment": false, "enabled": false, @@ -186793,7 +186793,7 @@ "reference": { "type": "fr.ird.observe.dto.referential.ll.landing.CompanyReference", "content": { - "code": "OCEAN ", + "code": "OCEAN", "label": "[type: Unknown] OCEAN LONG LINERS LTD [id:n/a]", "needComment": false, "enabled": true, @@ -196042,7 +196042,7 @@ "type": "fr.ird.observe.dto.referential.ps.common.ReasonForNoFishingReference", "content": { "code": "14", - "label": "Règlementation (absence de licence, moratoire, etc) ", + "label": "Règlementation (absence de licence, moratoire, etc)", "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.ReasonForNoFishing#1561013070351#0.6641824426682489", @@ -196593,6 +196593,7 @@ "code": "1", "label": "Echappe du filet (pour requin-baleine et cétacés)", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683618#0.06155887805368032", @@ -196626,6 +196627,7 @@ "code": "3", "label": "Sortie mort du filet (pour requin-baleine et cétacés)", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.11883784875534997", @@ -196659,6 +196661,7 @@ "code": "4", "label": "Rejeté vivant", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5308862132841506", @@ -196682,6 +196685,7 @@ "code": "6", "label": "Conservé à destination de la conserverie", "discard": false, + "weightRangeAllowed": true, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.5722739932065866", @@ -196710,6 +196714,7 @@ "code": "5", "label": "Rejeté mort", "discard": true, + "weightRangeAllowed": true, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.6250731662108877", @@ -196733,6 +196738,7 @@ "code": "2", "label": "Sortie vivant du filet (pour requin-baleine et cétacés)", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683619#0.9931091059863436", @@ -196765,6 +196771,7 @@ "content": { "code": "7", "label": "Partiellement conservé (ex: ailerons de requin, poisson séché)", + "weightRangeAllowed": false, "needComment": false, "enabled": false, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683620#0.46609703818634485", @@ -196803,6 +196810,7 @@ "code": "8", "label": "Utilisé en cuisine du bord", "discard": false, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683621#0.6728026426066158", @@ -196835,6 +196843,7 @@ "content": { "code": "9", "label": "Autres (à préciser dans les notes)", + "weightRangeAllowed": false, "needComment": true, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1239832683621#0.9099804284263154", @@ -196868,6 +196877,7 @@ "code": "15", "label": "Conservé pour le marché local ou poisson séché/salé à bord", "discard": false, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1464000000000#15", @@ -196895,6 +196905,7 @@ "content": { "code": "10", "label": "Ailerons seulements", + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1467372855729#0.568287924081734", @@ -196918,6 +196929,7 @@ "code": "11", "label": "Rejeté, statut non observé", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1501492537510#0.9210847837998154", @@ -196941,6 +196953,7 @@ "code": "12", "label": "Conservé pour raisons scientifiques", "discard": false, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1501492831539#0.9377232562184147", @@ -196964,6 +196977,7 @@ "code": "13", "label": "Rejeté suffocant", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1544448835551#0.620629930572886", @@ -196987,6 +197001,7 @@ "code": "14", "label": "Rejeté suffocant blessé", "discard": true, + "weightRangeAllowed": false, "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.SpeciesFate#1544448977865#0.24265421995390768", @@ -197605,7 +197620,7 @@ "type": "fr.ird.observe.dto.referential.ps.common.TransmittingBuoyTypeReference", "content": { "code": "98", - "label": "Balise inconnue ou indéterminée ", + "label": "Balise inconnue ou indéterminée", "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.common.TransmittingBuoyType#1339685555050#0.2640694245556756", @@ -203767,7 +203782,7 @@ "type": "fr.ird.observe.dto.referential.ps.common.WeightCategoryReference", "content": { "code": "C-YFT-12", - "label": "YFT de 10 à 30 kg ", + "label": "YFT de 10 à 30 kg", "species": { "code": "1", "label": "Albacore, thon à nageoires jaunes", @@ -204950,7 +204965,7 @@ "type": "fr.ird.observe.dto.referential.ps.common.WeightCategoryReference", "content": { "code": "C-BET-12", - "label": "BET de 10 à 30 kg ", + "label": "BET de 10 à 30 kg", "species": { "code": "3", "label": "Patudo, thon obèse, thon gros yeux", @@ -205660,7 +205675,7 @@ "type": "fr.ird.observe.dto.referential.ps.common.WeightCategoryReference", "content": { "code": "C-ALB-12", - "label": "ALB de 10 à 30 kg ", + "label": "ALB de 10 à 30 kg", "species": { "code": "4", "label": "Germon", @@ -207542,7 +207557,7 @@ "type": "fr.ird.observe.dto.referential.ps.common.WeightCategoryReference", "content": { "code": "C-LOT-12", - "label": "LOT de 10 à 30 kg ", + "label": "LOT de 10 à 30 kg", "species": { "code": "12", "label": "Thon mignon", @@ -214167,7 +214182,7 @@ "type": "fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleasingTimeReference", "content": { "code": "I", - "label": " Relache immédiate", + "label": "Relache immédiate", "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.observation.NonTargetCatchReleasingTime#0#1", @@ -214189,7 +214204,7 @@ "type": "fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleasingTimeReference", "content": { "code": "B", - "label": " Avant la salabarde suivante", + "label": "Avant la salabarde suivante", "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.observation.NonTargetCatchReleasingTime#0#2", @@ -214211,7 +214226,7 @@ "type": "fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleasingTimeReference", "content": { "code": "D", - "label": " Pendant la calée", + "label": "Pendant la calée", "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.observation.NonTargetCatchReleasingTime#0#3", @@ -214233,7 +214248,7 @@ "type": "fr.ird.observe.dto.referential.ps.observation.NonTargetCatchReleasingTimeReference", "content": { "code": "A", - "label": " À la fin de la calée", + "label": "À la fin de la calée", "needComment": false, "enabled": true, "id": "fr.ird.referential.ps.observation.NonTargetCatchReleasingTime#0#4", ===================================== model/src/main/models/Observe/dto/class/i18nLabels.properties ===================================== @@ -82,7 +82,7 @@ data.ps.logbook.SampleSpeciesMeasure=count,sizeClass data.ps.logbook.TransmittingBuoy=comment,code,transmittingBuoyOwnership,transmittingBuoyType,transmittingBuoyOperation,country,vessel,latitude,longitude,quadrant data.ps.logbook.WellPlan=activity,species,weight,weightCategory,well,wellSamplingConformity,wellSamplingStatus data.ps.observation.Activity=date,coordinate,observedSystem.available,observedSystem.selected,comment,comment2,currentFpaZone,dataQuality,detectionMode,ersId,floatingObjectEmpty,latitude,longitude,nextFpaZone,nonTargetCatchSpecies,observedSystem,observedSystemDistance,previousFpaZone,quadrant,reasonForNoFishing,seaSurfaceTemperature,surroundingActivity,time,vesselActivity,vesselSpeed,wind,generalTab,error.no.activity.6,measurementsTab,observedSystemTab -data.ps.observation.Catch=catchWeight,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip +data.ps.observation.Catch=catchWeight,comment,informationSource,lengthMeasureMethod,meanLength,minWeight,maxWeight,meanWeight,minMaxWeight,reasonForDiscard,species,speciesFate,totalCount,weightMeasureMethod,well,catchWeightComputed.computed.tip,catchWeightComputed.observed.tip,meanLengthComputed.computed.tip,meanLengthComputed.observed.tip,meanWeightComputed.computed.tip,meanWeightComputed.observed.tip,totalCountComputed.computed.tip,totalCountComputed.observed.tip data.ps.observation.FloatingObject=materialsValid,objectOperation,supportVesselName,country,vessel,computedBiodegradable,computedNonEntangling,computedSimplifiedObjectType,computedValues,generalTab,buoysTab,materialsTab,notComputed,type.short data.ps.observation.NonTargetCatchRelease=comment,conformity,count,length,lengthMeasureMethod,releasingTime,sex,status,species,speciesGroupReleaseMode,message.cantAdd data.ps.observation.ObjectObservedSpecies=count,species,speciesStatus ===================================== model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties ===================================== @@ -23,7 +23,7 @@ data.ll.common.Trip=species data.ll.landing.Landing=vessel data.ps.localmarket.Sample=well data.ps.logbook.Catch=weightMeasureMethod.validation.required -data.ps.observation.Catch=minWeight,maxWeight,weightMeasureMethod +data.ps.observation.Catch=minWeight,maxWeight,minMaxWeight,weightMeasureMethod data.ps.observation.SchoolEstimate=species data.ps.observation.Set=startTime,haulingStartTimeStamp,haulingEndTimeStamp,endTimeStamp referential.common.Species=codeAndHomeId ===================================== toolkit/api/src/main/java/fr/ird/observe/dto/StringCleaner.java ===================================== @@ -0,0 +1,82 @@ +package fr.ird.observe.dto; + +/*- + * #%L + * ObServe Toolkit :: API + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import java.util.function.Function; + +/** + * Object to clean a string related to a database field. + * <p> + * Created on 12/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.017 + */ +public class StringCleaner implements Function<String, String> { + + public static final StringCleaner ALL = new StringCleaner(true, true, true); + public static final StringCleaner REMOVE_SINGLE_QUOTE_AND_TRIM = new StringCleaner(true, true, false); + public static final StringCleaner TRIM_AND_REPLACE_EMPTY_BY_NULL = new StringCleaner(false, true, true); + public static final StringCleaner TRIM = new StringCleaner(false, true, false); + + /** + * To remove any single quote in given string. + */ + private final boolean removeSingleQuote; + /** + * To perform a trim on given string. + */ + private final boolean trim; + /** + * To replace the given string value by null if it is empty. + */ + private final boolean replaceEmptyByNull; + + public StringCleaner(boolean removeSingleQuote, boolean trim, boolean replaceEmptyByNull) { + this.removeSingleQuote = removeSingleQuote; + this.trim = trim; + this.replaceEmptyByNull = replaceEmptyByNull; + } + + public static String removeSingleQuote(String string) { + return string.replaceAll("'", ""); + } + + @Override + public String apply(String string) { + if (string == null) { + return null; + } + String result = string; + if (removeSingleQuote) { + result = removeSingleQuote(result); + } + if (trim) { + result = result.trim(); + } + if (replaceEmptyByNull && result.isEmpty()) { + result = null; + } + return result; + } +} ===================================== toolkit/api/src/main/java/fr/ird/observe/persistence/SqlHelper.java ===================================== @@ -64,7 +64,21 @@ public class SqlHelper { if (trim.length() > maxLength) { trim = trim.substring(0, maxLength - 1); } - return "'" + trim.replaceAll("'", "''") + "'"; + return "'" + escapeSingleQuote(trim) + "'"; } + public static String escapeSingleQuote(String string) { + return string.replaceAll("'", "''"); + } + + public static String escapeString(String string) { + if (string == null) { + return "NULL"; + } + String trim = string.trim(); + if (trim.isEmpty()) { + return "NULL"; + } + return "'" + escapeSingleQuote(trim) + "'"; + } } ===================================== toolkit/persistence/src/main/java/fr/ird/observe/spi/context/DataDtoEntityContext.java ===================================== @@ -35,6 +35,7 @@ import fr.ird.observe.dto.referential.ReferentialLocale; import fr.ird.observe.entities.Entity; import fr.ird.observe.entities.data.DataEntity; import fr.ird.observe.entities.data.DataFileAware; +import fr.ird.observe.persistence.SqlHelper; import fr.ird.observe.persistence.request.DeleteRequest; import fr.ird.observe.spi.service.ServiceContext; import fr.ird.observe.spi.usage.UsageHelper; @@ -78,14 +79,7 @@ public abstract class DataDtoEntityContext< } public static String toId(Entity entity) { - return entity == null ? "NULL" : escapeString(entity.getTopiaId()); - } - - public static String escapeString(String string) { - if (string == null) { - return "NULL"; - } - return "'" + string.trim() + "'"; + return entity == null ? "NULL" : SqlHelper.escapeString(entity.getTopiaId()); } public static Blob byteArrayToBlob(byte[] bytes) { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/a6c294ab0136e38013cd9d45… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/a6c294ab0136e38013cd9d45… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-9.0.x] [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs...
by Tony CHEMIT (@tchemit) 11 Nov '22

11 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: a6c294ab by Tony Chemit at 2022-11-11T15:20:33+01:00 [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs alphanumériques - See #1544 - - - - - 5 changed files: - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.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/FixCommentHelper.java - + core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java Changes: ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java ===================================== @@ -254,6 +254,7 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe executor.addScript("96", "add_referential_ps_common_ObservedSystem_finalize"); } } + private void migrateCatches(MigrationVersionResourceExecutor executor) { Function<String, String> commentFormat = executor.commentFormat(); @@ -589,6 +590,14 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe @Override public void generateFinalizeSqlScript(MigrationVersionResourceExecutor executor) { + long stringFixedCount = new FixStringHelper(executor).execute(); + if (stringFixedCount > 0) { + log.warn(String.format("Fix %s string rows(s).", stringFixedCount)); + } + long commentFixedCount = new FixCommentHelper(executor).execute(); + if (commentFixedCount > 0) { + log.warn(String.format("Fix %s comment rows(s).", commentFixedCount)); + } migrateIdx(executor, "ps_observation", "catch", "set"); migrateIdx(executor, "ps_observation", "SampleMeasure", "sample"); } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DiscardedTargetCatchRecord.java ===================================== @@ -56,19 +56,19 @@ public class DiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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" + + /* 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"); } @@ -135,7 +135,7 @@ public class DiscardedTargetCatchRecord { /*1*/ DataDtoEntityContext.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(homeId, true)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), @@ -146,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(getWell()), + /*15*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(well, true)), /*16*/ setIdx, /*17*/ DataDtoEntityContext.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), /*18*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_O) @@ -160,14 +160,4 @@ 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/FixCommentHelper.java ===================================== @@ -0,0 +1,133 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +/** + * To auto-trim string comment fields. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixCommentHelper { + + private static final Logger log = LogManager.getLogger(FixCommentHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + private final Function<String, String> commentFormat; + + public FixCommentHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + commentFormat = executor.commentFormat(); + } + + public long execute() { + + fixField("common.Vessel", "comment"); + + fixField("ll_common.GearUseFeatures", "comment"); + fixField("ll_common.Program", "comment"); + fixField("ll_common.Trip", "generalComment"); + fixField("ll_common.Trip", "logbookComment"); + fixField("ll_common.Trip", "observationsComment"); + + fixField("ll_landing.Landing", "comment"); + + fixField("ll_logbook.Activity", "comment"); + fixField("ll_logbook.Catch", "comment"); + fixField("ll_logbook.Set", "comment"); + fixField("ll_logbook.Sample", "comment"); + + fixField("ll_observation.Activity", "comment"); + fixField("ll_observation.Branchline", "comment"); + fixField("ll_observation.Catch", "comment"); + fixField("ll_observation.Set", "comment"); + + fixField("ps_common.GearUseFeatures", "comment"); + fixField("ps_common.Program", "comment"); + fixField("ps_common.Trip", "generalComment"); + fixField("ps_common.Trip", "logbookComment"); + fixField("ps_common.Trip", "observationsComment"); + + fixField("ps_localmarket.Batch", "origin"); + fixField("ps_localmarket.Sample", "comment"); + fixField("ps_localmarket.SampleSpecies", "comment"); + fixField("ps_localmarket.Survey", "comment"); + + fixField("ps_logbook.Activity", "comment"); + fixField("ps_logbook.Catch", "comment"); + fixField("ps_logbook.FloatingObject", "comment"); + fixField("ps_logbook.Route", "comment"); + fixField("ps_logbook.Sample", "comment"); + fixField("ps_logbook.SampleSpecies", "comment"); + fixField("ps_logbook.TransmittingBuoy", "comment"); + + fixField("ps_observation.Activity", "comment"); + fixField("ps_observation.Catch", "comment"); + fixField("ps_observation.FloatingObject", "comment"); + fixField("ps_observation.NonTargetCatchRelease", "comment"); + fixField("ps_observation.Route", "comment"); + fixField("ps_observation.Set", "comment"); + fixField("ps_observation.TransmittingBuoy", "comment"); + return count.get(); + } + + public void fixField(String gav, String field) { + + executor.doSqlWork(connection -> { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = fieldValue.trim(); + if (!fieldValue.equals(fixFieldValue)) { + if (fixFieldValue.isEmpty()) { + fixFieldValue = null; + } + String id = resultSet.getString(1); + String finalFieldValue = commentFormat.apply(fixFieldValue); + log.warn(String.format("Fix comment field %s.%s[%s] (from '%s' to %s)", gav, field, id, fieldValue, finalFieldValue)); + executor.writeSql(String.format("UPDATE %s SET %s = %s WHERE topiaId = '%s';", gav, field, finalFieldValue, id)); + count.incrementAndGet(); + } + } + } + } + }); + + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.java ===================================== @@ -0,0 +1,241 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.spi.context.DataDtoEntityContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; + +/** + * To auto-trim string fields and remove any {@code '} characters inside it. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixStringHelper { + + private static final Logger log = LogManager.getLogger(FixStringHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + + public FixStringHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + } + + public long execute() { + + fixI18nFields("common.Country", "code", "iso2Code", "iso3Code"); + fixI18nFields("common.DataQuality", "code"); + fixI18nFields("common.FpaZone", "code"); + fixI18nFields("common.Gear", "code"); + fixI18nFields("common.GearCharacteristic", "code"); + fixI18nFields("common.GearCharacteristicType", "code"); + fixI18nFields("common.Harbour", "code"); + fixFields("common.LengthLengthParameter", "coefficients", "inputOutputFormula", "outputInputFormula"); + fixI18nFields("common.LengthMeasureMethod", "code"); + fixFields("common.LengthWeightParameter", "coefficients", "lengthWeightFormula", "weightLengthFormula"); + fixI18nFields("common.Ocean", "code"); + fixI18nFields("common.Organism", "code"); + fixField("common.Person", "firstName", false); + fixField("common.Person", "firstName", false); + fixI18nFields("common.Sex", "code"); + fixFields("common.ShipOwner", "code", "label"); + fixI18nFields("common.SizeMeasureType", "code"); + fixI18nFields("common.Species", "scientificLabel"); + fixI18nFields("common.SpeciesGroup", "code"); + fixI18nFields("common.SpeciesGroupReleaseMode", "code"); + fixI18nFields("common.SpeciesList", "code"); + fixI18nFields("common.Vessel", "code"); + fixI18nFields("common.VesselType", "code"); + fixFields("common.VesselSizeCategory", "code", "capacityLabel", "gaugeLabel"); + fixI18nFields("common.WeightMeasureMethod", "code"); + fixI18nFields("common.WeightMeasureType", "code"); + fixI18nFields("common.Wind", "code"); + + fixI18nFields("ll_common.BaitSettingStatus", "code"); + fixI18nFields("ll_common.BaitType", "code"); + fixI18nFields("ll_common.CatchFate", "code"); + fixI18nFields("ll_common.HealthStatus", "code"); + fixI18nFields("ll_common.HookSize", "code"); + fixI18nFields("ll_common.HookType", "code"); + fixI18nFields("ll_common.LightsticksColor", "code"); + fixI18nFields("ll_common.LightsticksType", "code"); + fixI18nFields("ll_common.LineType", "code"); + fixI18nFields("ll_common.MitigationType", "code"); + fixI18nFields("ll_common.ObservationMethod", "code"); + fixI18nFields("ll_common.OnBoardProcessing", "code"); + fixI18nFields("ll_common.Program", "code"); + fixI18nFields("ll_common.SettingShape", "code"); + fixI18nFields("ll_common.TripType", "code"); + fixI18nFields("ll_common.VesselActivity", "code"); + fixI18nFields("ll_common.WeightDeterminationMethod", "code"); + + fixI18nFields("ll_landing.Company", "code"); + fixI18nFields("ll_landing.Conservation", "code"); + fixI18nFields("ll_landing.DataSource", "code"); + + fixI18nFields("ll_observation.BaitHaulingStatus", "code"); + fixI18nFields("ll_observation.EncounterType", "code"); + fixI18nFields("ll_observation.HookPosition", "code"); + fixI18nFields("ll_observation.ItemHorizontalPosition", "code"); + fixI18nFields("ll_observation.ItemVerticalPosition", "code"); + fixI18nFields("ll_observation.MaturityStatus", "code"); + fixFields("ll_observation.SensorBrand", "brandName", "code"); + fixI18nFields("ll_observation.SensorDataFormat", "code"); + fixI18nFields("ll_observation.SensorType", "code"); + fixI18nFields("ll_observation.StomachFullness", "code"); + + fixI18nFields("ps_common.AcquisitionStatus", "code"); + fixI18nFields("ps_common.ObjectMaterial", "code"); + fixI18nFields("ps_common.ObjectMaterialType", "code"); + fixI18nFields("ps_common.ObjectOperation", "code"); + fixI18nFields("ps_common.ObservedSystem", "code"); + fixI18nFields("ps_common.Program", "code"); + fixI18nFields("ps_common.ReasonForNoFishing", "code"); + fixI18nFields("ps_common.ReasonForNullSet", "code"); + fixI18nFields("ps_common.SampleType", "code"); + fixI18nFields("ps_common.SchoolType", "code"); + fixI18nFields("ps_common.SpeciesFate", "code"); + fixI18nFields("ps_common.TransmittingBuoyOperation", "code"); + fixI18nFields("ps_common.TransmittingBuoyOwnership", "code"); + fixI18nFields("ps_common.TransmittingBuoyType", "code"); + fixI18nFields("ps_common.VesselActivity", "code"); + fixI18nFields("ps_common.WeightCategory", "code"); + + fixI18nFields("ps_landing.Destination", "code"); + fixI18nFields("ps_landing.Fate", "code"); + + fixI18nFields("ps_localmarket.BatchComposition", "code"); + fixI18nFields("ps_localmarket.BatchWeightType", "code"); + fixI18nFields("ps_localmarket.Packaging", "code"); + + fixI18nFields("ps_logbook.InformationSource", "code"); + fixI18nFields("ps_logbook.SampleQuality", "code"); + fixI18nFields("ps_logbook.SetSuccessStatus", "code"); + fixI18nFields("ps_logbook.WellContentStatus", "code"); + fixI18nFields("ps_logbook.WellSamplingConformity", "code"); + fixI18nFields("ps_logbook.WellSamplingStatus", "code"); + + fixI18nFields("ps_observation.DetectionMode", "code"); + fixI18nFields("ps_observation.InformationSource", "code"); + fixI18nFields("ps_observation.NonTargetCatchReleaseConformity", "code"); + fixI18nFields("ps_observation.NonTargetCatchReleaseStatus", "code"); + fixI18nFields("ps_observation.NonTargetCatchReleasingTime", "code"); + fixI18nFields("ps_observation.ReasonForDiscard", "code"); + fixI18nFields("ps_observation.SpeciesStatus", "code"); + fixI18nFields("ps_observation.SurroundingActivity", "code"); + + fixFields("ll_common.GearUseFeaturesMeasurement", "measurementValue"); + fixFields("ll_common.Trip", "ersId", "homeId"); + + fixFields("ll_logbook.Catch", "photoReferences", "tagNumber"); + fixFields("ll_logbook.SamplePart", "tagNumber"); + fixFields("ll_logbook.Set", "homeId"); + + fixFields("ll_observation.Catch", "photoReferences", "tagNumber"); + fixFields("ll_observation.SensorUsed", "sensorSerialNo"); + fixFields("ll_observation.Set", "homeId"); + fixFields("ll_observation.Tdr", "serialNo"); + + fixFields("ps_common.GearUseFeaturesMeasurement", "measurementValue"); + fixFields("ps_common.Trip", "ersId", "formsUrl", "homeId", "reportsUrl"); + + fixFields("ps_localmarket.Sample", "number"); + + fixFields("ps_logbook.Catch", "well"); + fixFields("ps_logbook.FloatingObject", "supportVesselName"); + fixFields("ps_logbook.Sample", "well"); + fixFields("ps_logbook.TransmittingBuoy", "code"); + fixFields("ps_logbook.WellPlan", "well"); + + fixFields("ps_observation.Activity", "ersId"); + fixFields("ps_observation.FloatingObject", "supportVesselName"); + + fixFields("ps_observation.SampleMeasure", "picturesReferences", "tagNumber"); + fixFields("ps_observation.Set", "supportVesselName"); + fixFields("ps_observation.TransmittingBuoy", "code"); + return count.get(); + } + + public void fixI18nFields(String gav, String... extraFields) { + fixField(gav, "label1", false); + fixField(gav, "label2", false); + fixField(gav, "label3", false); + fixFields(gav, extraFields); + } + + public void fixFields(String gav, String... extraFields) { + for (String extraField : extraFields) { + fixField(gav, extraField, false); + } + } + + public void fixField(String gav, String field, boolean removeSimpleQuote) { + executor.doSqlWork(connection -> { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = cleanString(fieldValue, removeSimpleQuote); + if (gav.equals("ps_common.ObjectMaterial") && field.equals("code") && fixFieldValue == null) { + // special case when we need to keep blank value + fixFieldValue = ""; + } + if (!fieldValue.equals(fixFieldValue)) { + String finalFieldValue = DataDtoEntityContext.escapeString(removeSimpleQuote ? fixFieldValue : fixFieldValue.replaceAll("'", "''")); + String id = resultSet.getString(1); + log.warn(String.format("Fix string field %s.%s[%s] (from '%s' to %s)", gav, field, id, fieldValue, finalFieldValue)); + executor.writeSql(String.format("UPDATE %1$s SET %2$s = %3$s WHERE topiaId = '%4$s';", gav, field, finalFieldValue, id)); + count.incrementAndGet(); + } + } + } + } + }); + } + + protected static String cleanString(String field, boolean removeSimpleQuote) { + String result = field; + if (result != null) { + result = result.trim(); + if (removeSimpleQuote) { + result = result.replaceAll("'", ""); + } + if (result.isEmpty()) { + result = null; + } + } + return result; + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java ===================================== @@ -42,19 +42,19 @@ class NotDiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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 " + + /* 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 NOT ( weightCategory IS NULL AND catchweight IS NULL AND well IS NULL AND broughtondeck IS NULL AND reasonfordiscard IS NULL )"); } @@ -134,7 +134,7 @@ class NotDiscardedTargetCatchRecord { /*1*/ DataDtoEntityContext.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(homeId, true)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), @@ -145,7 +145,7 @@ 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(getWell()), + /*15*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(well, true)), /*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) @@ -158,16 +158,4 @@ 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; - } } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/a6c294ab0136e38013cd9d452… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/a6c294ab0136e38013cd9d452… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs...
by Tony CHEMIT (@tchemit) 11 Nov '22

11 Nov '22
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: ad0dd0ec by Tony Chemit at 2022-11-11T15:20:51+01:00 [UI REFERENTIELS] Envisager un auto-trim droite et gauche sur les champs alphanumériques - See #1544 - - - - - 5 changed files: - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.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/FixCommentHelper.java - + core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java Changes: ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java ===================================== @@ -254,6 +254,7 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe executor.addScript("96", "add_referential_ps_common_ObservedSystem_finalize"); } } + private void migrateCatches(MigrationVersionResourceExecutor executor) { Function<String, String> commentFormat = executor.commentFormat(); @@ -589,6 +590,14 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe @Override public void generateFinalizeSqlScript(MigrationVersionResourceExecutor executor) { + long stringFixedCount = new FixStringHelper(executor).execute(); + if (stringFixedCount > 0) { + log.warn(String.format("Fix %s string rows(s).", stringFixedCount)); + } + long commentFixedCount = new FixCommentHelper(executor).execute(); + if (commentFixedCount > 0) { + log.warn(String.format("Fix %s comment rows(s).", commentFixedCount)); + } migrateIdx(executor, "ps_observation", "catch", "set"); migrateIdx(executor, "ps_observation", "SampleMeasure", "sample"); } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DiscardedTargetCatchRecord.java ===================================== @@ -56,19 +56,19 @@ public class DiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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" + + /* 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"); } @@ -135,7 +135,7 @@ public class DiscardedTargetCatchRecord { /*1*/ DataDtoEntityContext.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(homeId, true)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), @@ -146,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(getWell()), + /*15*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(well, true)), /*16*/ setIdx, /*17*/ DataDtoEntityContext.escapeString(weightMeasureMethodId == null ? "fr.ird.referential.common.WeightMeasureMethod#666#03" : weightCategoryId), /*18*/ DataDtoEntityContext.escapeString(DataSourceMigrationForVersion_9_0.INFORMATION_SOURCE_O) @@ -160,14 +160,4 @@ 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/FixCommentHelper.java ===================================== @@ -0,0 +1,133 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +/** + * To auto-trim string comment fields. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixCommentHelper { + + private static final Logger log = LogManager.getLogger(FixCommentHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + private final Function<String, String> commentFormat; + + public FixCommentHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + commentFormat = executor.commentFormat(); + } + + public long execute() { + + fixField("common.Vessel", "comment"); + + fixField("ll_common.GearUseFeatures", "comment"); + fixField("ll_common.Program", "comment"); + fixField("ll_common.Trip", "generalComment"); + fixField("ll_common.Trip", "logbookComment"); + fixField("ll_common.Trip", "observationsComment"); + + fixField("ll_landing.Landing", "comment"); + + fixField("ll_logbook.Activity", "comment"); + fixField("ll_logbook.Catch", "comment"); + fixField("ll_logbook.Set", "comment"); + fixField("ll_logbook.Sample", "comment"); + + fixField("ll_observation.Activity", "comment"); + fixField("ll_observation.Branchline", "comment"); + fixField("ll_observation.Catch", "comment"); + fixField("ll_observation.Set", "comment"); + + fixField("ps_common.GearUseFeatures", "comment"); + fixField("ps_common.Program", "comment"); + fixField("ps_common.Trip", "generalComment"); + fixField("ps_common.Trip", "logbookComment"); + fixField("ps_common.Trip", "observationsComment"); + + fixField("ps_localmarket.Batch", "origin"); + fixField("ps_localmarket.Sample", "comment"); + fixField("ps_localmarket.SampleSpecies", "comment"); + fixField("ps_localmarket.Survey", "comment"); + + fixField("ps_logbook.Activity", "comment"); + fixField("ps_logbook.Catch", "comment"); + fixField("ps_logbook.FloatingObject", "comment"); + fixField("ps_logbook.Route", "comment"); + fixField("ps_logbook.Sample", "comment"); + fixField("ps_logbook.SampleSpecies", "comment"); + fixField("ps_logbook.TransmittingBuoy", "comment"); + + fixField("ps_observation.Activity", "comment"); + fixField("ps_observation.Catch", "comment"); + fixField("ps_observation.FloatingObject", "comment"); + fixField("ps_observation.NonTargetCatchRelease", "comment"); + fixField("ps_observation.Route", "comment"); + fixField("ps_observation.Set", "comment"); + fixField("ps_observation.TransmittingBuoy", "comment"); + return count.get(); + } + + public void fixField(String gav, String field) { + + executor.doSqlWork(connection -> { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = fieldValue.trim(); + if (!fieldValue.equals(fixFieldValue)) { + if (fixFieldValue.isEmpty()) { + fixFieldValue = null; + } + String id = resultSet.getString(1); + String finalFieldValue = commentFormat.apply(fixFieldValue); + log.warn(String.format("Fix comment field %s.%s[%s] (from '%s' to %s)", gav, field, id, fieldValue, finalFieldValue)); + executor.writeSql(String.format("UPDATE %s SET %s = %s WHERE topiaId = '%s';", gav, field, finalFieldValue, id)); + count.incrementAndGet(); + } + } + } + } + }); + + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/FixStringHelper.java ===================================== @@ -0,0 +1,241 @@ +package fr.ird.observe.spi.migration.v9; + +/*- + * #%L + * ObServe Core :: Persistence :: Resources + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ird.observe.spi.context.DataDtoEntityContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; + +/** + * To auto-trim string fields and remove any {@code '} characters inside it. + * <p> + * <strong>Note:</strong> If fixed value is empty or blank then set {@code null} value. + * <p> + * Created on 11/11/2022. + * + * @author Tony Chemit - dev(a)tchemit.fr + * @since 9.0.17 + */ +public class FixStringHelper { + + private static final Logger log = LogManager.getLogger(FixStringHelper.class); + + private final MigrationVersionResourceExecutor executor; + private final AtomicLong count = new AtomicLong(); + + public FixStringHelper(MigrationVersionResourceExecutor executor) { + this.executor = Objects.requireNonNull(executor); + } + + public long execute() { + + fixI18nFields("common.Country", "code", "iso2Code", "iso3Code"); + fixI18nFields("common.DataQuality", "code"); + fixI18nFields("common.FpaZone", "code"); + fixI18nFields("common.Gear", "code"); + fixI18nFields("common.GearCharacteristic", "code"); + fixI18nFields("common.GearCharacteristicType", "code"); + fixI18nFields("common.Harbour", "code"); + fixFields("common.LengthLengthParameter", "coefficients", "inputOutputFormula", "outputInputFormula"); + fixI18nFields("common.LengthMeasureMethod", "code"); + fixFields("common.LengthWeightParameter", "coefficients", "lengthWeightFormula", "weightLengthFormula"); + fixI18nFields("common.Ocean", "code"); + fixI18nFields("common.Organism", "code"); + fixField("common.Person", "firstName", false); + fixField("common.Person", "firstName", false); + fixI18nFields("common.Sex", "code"); + fixFields("common.ShipOwner", "code", "label"); + fixI18nFields("common.SizeMeasureType", "code"); + fixI18nFields("common.Species", "scientificLabel"); + fixI18nFields("common.SpeciesGroup", "code"); + fixI18nFields("common.SpeciesGroupReleaseMode", "code"); + fixI18nFields("common.SpeciesList", "code"); + fixI18nFields("common.Vessel", "code"); + fixI18nFields("common.VesselType", "code"); + fixFields("common.VesselSizeCategory", "code", "capacityLabel", "gaugeLabel"); + fixI18nFields("common.WeightMeasureMethod", "code"); + fixI18nFields("common.WeightMeasureType", "code"); + fixI18nFields("common.Wind", "code"); + + fixI18nFields("ll_common.BaitSettingStatus", "code"); + fixI18nFields("ll_common.BaitType", "code"); + fixI18nFields("ll_common.CatchFate", "code"); + fixI18nFields("ll_common.HealthStatus", "code"); + fixI18nFields("ll_common.HookSize", "code"); + fixI18nFields("ll_common.HookType", "code"); + fixI18nFields("ll_common.LightsticksColor", "code"); + fixI18nFields("ll_common.LightsticksType", "code"); + fixI18nFields("ll_common.LineType", "code"); + fixI18nFields("ll_common.MitigationType", "code"); + fixI18nFields("ll_common.ObservationMethod", "code"); + fixI18nFields("ll_common.OnBoardProcessing", "code"); + fixI18nFields("ll_common.Program", "code"); + fixI18nFields("ll_common.SettingShape", "code"); + fixI18nFields("ll_common.TripType", "code"); + fixI18nFields("ll_common.VesselActivity", "code"); + fixI18nFields("ll_common.WeightDeterminationMethod", "code"); + + fixI18nFields("ll_landing.Company", "code"); + fixI18nFields("ll_landing.Conservation", "code"); + fixI18nFields("ll_landing.DataSource", "code"); + + fixI18nFields("ll_observation.BaitHaulingStatus", "code"); + fixI18nFields("ll_observation.EncounterType", "code"); + fixI18nFields("ll_observation.HookPosition", "code"); + fixI18nFields("ll_observation.ItemHorizontalPosition", "code"); + fixI18nFields("ll_observation.ItemVerticalPosition", "code"); + fixI18nFields("ll_observation.MaturityStatus", "code"); + fixFields("ll_observation.SensorBrand", "brandName", "code"); + fixI18nFields("ll_observation.SensorDataFormat", "code"); + fixI18nFields("ll_observation.SensorType", "code"); + fixI18nFields("ll_observation.StomachFullness", "code"); + + fixI18nFields("ps_common.AcquisitionStatus", "code"); + fixI18nFields("ps_common.ObjectMaterial", "code"); + fixI18nFields("ps_common.ObjectMaterialType", "code"); + fixI18nFields("ps_common.ObjectOperation", "code"); + fixI18nFields("ps_common.ObservedSystem", "code"); + fixI18nFields("ps_common.Program", "code"); + fixI18nFields("ps_common.ReasonForNoFishing", "code"); + fixI18nFields("ps_common.ReasonForNullSet", "code"); + fixI18nFields("ps_common.SampleType", "code"); + fixI18nFields("ps_common.SchoolType", "code"); + fixI18nFields("ps_common.SpeciesFate", "code"); + fixI18nFields("ps_common.TransmittingBuoyOperation", "code"); + fixI18nFields("ps_common.TransmittingBuoyOwnership", "code"); + fixI18nFields("ps_common.TransmittingBuoyType", "code"); + fixI18nFields("ps_common.VesselActivity", "code"); + fixI18nFields("ps_common.WeightCategory", "code"); + + fixI18nFields("ps_landing.Destination", "code"); + fixI18nFields("ps_landing.Fate", "code"); + + fixI18nFields("ps_localmarket.BatchComposition", "code"); + fixI18nFields("ps_localmarket.BatchWeightType", "code"); + fixI18nFields("ps_localmarket.Packaging", "code"); + + fixI18nFields("ps_logbook.InformationSource", "code"); + fixI18nFields("ps_logbook.SampleQuality", "code"); + fixI18nFields("ps_logbook.SetSuccessStatus", "code"); + fixI18nFields("ps_logbook.WellContentStatus", "code"); + fixI18nFields("ps_logbook.WellSamplingConformity", "code"); + fixI18nFields("ps_logbook.WellSamplingStatus", "code"); + + fixI18nFields("ps_observation.DetectionMode", "code"); + fixI18nFields("ps_observation.InformationSource", "code"); + fixI18nFields("ps_observation.NonTargetCatchReleaseConformity", "code"); + fixI18nFields("ps_observation.NonTargetCatchReleaseStatus", "code"); + fixI18nFields("ps_observation.NonTargetCatchReleasingTime", "code"); + fixI18nFields("ps_observation.ReasonForDiscard", "code"); + fixI18nFields("ps_observation.SpeciesStatus", "code"); + fixI18nFields("ps_observation.SurroundingActivity", "code"); + + fixFields("ll_common.GearUseFeaturesMeasurement", "measurementValue"); + fixFields("ll_common.Trip", "ersId", "homeId"); + + fixFields("ll_logbook.Catch", "photoReferences", "tagNumber"); + fixFields("ll_logbook.SamplePart", "tagNumber"); + fixFields("ll_logbook.Set", "homeId"); + + fixFields("ll_observation.Catch", "photoReferences", "tagNumber"); + fixFields("ll_observation.SensorUsed", "sensorSerialNo"); + fixFields("ll_observation.Set", "homeId"); + fixFields("ll_observation.Tdr", "serialNo"); + + fixFields("ps_common.GearUseFeaturesMeasurement", "measurementValue"); + fixFields("ps_common.Trip", "ersId", "formsUrl", "homeId", "reportsUrl"); + + fixFields("ps_localmarket.Sample", "number"); + + fixFields("ps_logbook.Catch", "well"); + fixFields("ps_logbook.FloatingObject", "supportVesselName"); + fixFields("ps_logbook.Sample", "well"); + fixFields("ps_logbook.TransmittingBuoy", "code"); + fixFields("ps_logbook.WellPlan", "well"); + + fixFields("ps_observation.Activity", "ersId"); + fixFields("ps_observation.FloatingObject", "supportVesselName"); + + fixFields("ps_observation.SampleMeasure", "picturesReferences", "tagNumber"); + fixFields("ps_observation.Set", "supportVesselName"); + fixFields("ps_observation.TransmittingBuoy", "code"); + return count.get(); + } + + public void fixI18nFields(String gav, String... extraFields) { + fixField(gav, "label1", false); + fixField(gav, "label2", false); + fixField(gav, "label3", false); + fixFields(gav, extraFields); + } + + public void fixFields(String gav, String... extraFields) { + for (String extraField : extraFields) { + fixField(gav, extraField, false); + } + } + + public void fixField(String gav, String field, boolean removeSimpleQuote) { + executor.doSqlWork(connection -> { + try (PreparedStatement statement = connection.prepareStatement(String.format("SELECT topiaId, %2$s FROM %1$s WHERE %2$s IS NOT NULL", gav, field))) { + try (ResultSet resultSet = statement.executeQuery()) { + while (resultSet.next()) { + String fieldValue = resultSet.getString(2); + String fixFieldValue = cleanString(fieldValue, removeSimpleQuote); + if (gav.equals("ps_common.ObjectMaterial") && field.equals("code") && fixFieldValue == null) { + // special case when we need to keep blank value + fixFieldValue = ""; + } + if (!fieldValue.equals(fixFieldValue)) { + String finalFieldValue = DataDtoEntityContext.escapeString(removeSimpleQuote ? fixFieldValue : fixFieldValue.replaceAll("'", "''")); + String id = resultSet.getString(1); + log.warn(String.format("Fix string field %s.%s[%s] (from '%s' to %s)", gav, field, id, fieldValue, finalFieldValue)); + executor.writeSql(String.format("UPDATE %1$s SET %2$s = %3$s WHERE topiaId = '%4$s';", gav, field, finalFieldValue, id)); + count.incrementAndGet(); + } + } + } + } + }); + } + + protected static String cleanString(String field, boolean removeSimpleQuote) { + String result = field; + if (result != null) { + result = result.trim(); + if (removeSimpleQuote) { + result = result.replaceAll("'", ""); + } + if (result.isEmpty()) { + result = null; + } + } + return result; + } +} ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/NotDiscardedTargetCatchRecord.java ===================================== @@ -42,19 +42,19 @@ class NotDiscardedTargetCatchRecord { public static PreparedStatement prepareStatement(Connection connection) throws SQLException { return connection.prepareStatement("SELECT" + - /* 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 " + + /* 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 NOT ( weightCategory IS NULL AND catchweight IS NULL AND well IS NULL AND broughtondeck IS NULL AND reasonfordiscard IS NULL )"); } @@ -134,7 +134,7 @@ class NotDiscardedTargetCatchRecord { /*1*/ DataDtoEntityContext.escapeString(id), /*2*/ topiaVersion, /*3*/ DataDtoEntityContext.timestamp(topiaCreateDate), - /*4*/ DataDtoEntityContext.escapeString(homeId), + /*4*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(homeId, true)), /*5*/ catchWeight, /*6*/ weightCategoryRecord.getMinWeight(), /*7*/ weightCategoryRecord.getMaxWeight(), @@ -145,7 +145,7 @@ 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(getWell()), + /*15*/ DataDtoEntityContext.escapeString(FixStringHelper.cleanString(well, true)), /*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) @@ -158,16 +158,4 @@ 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; - } } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/ad0dd0ec7e1a4b1c31e84a565… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/ad0dd0ec7e1a4b1c31e84a565… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-9.0.x] 2 commits: Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528
by Tony CHEMIT (@tchemit) 11 Nov '22

11 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: 9301c201 by Tony Chemit at 2022-11-11T11:12:49+01:00 Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528 - - - - - 4be9d6e1 by Tony Chemit at 2022-11-11T11:12:49+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 ===================================== @@ -1659,9 +1659,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 ===================================== @@ -1659,9 +1659,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 ===================================== @@ -1660,8 +1660,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 ===================================== @@ -112,6 +112,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/f0ea309d198becaa37d519a5… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f0ea309d198becaa37d519a5… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 2 commits: Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528
by Tony CHEMIT (@tchemit) 11 Nov '22

11 Nov '22
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/f772ed31e49b8bc76f8de182… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f772ed31e49b8bc76f8de182… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-9.0.x] 2 commits: Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528
by Tony CHEMIT (@tchemit) 11 Nov '22

11 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: ca7ae36d by Tony Chemit at 2022-11-11T09:16:08+01:00 Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528 - - - - - f0ea309d by Tony Chemit at 2022-11-11T10:39: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) { ===================================== 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) { @@ -149,7 +148,7 @@ class NotDiscardedTargetCatchRecord { /*15*/ DataDtoEntityContext.escapeString(well), /*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) ); } ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1659,9 +1659,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 ===================================== @@ -1659,9 +1659,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 ===================================== @@ -1660,8 +1660,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 ===================================== @@ -112,6 +112,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/a7a1fbc7160e2878b476818d… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/a7a1fbc7160e2878b476818d… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 2 commits: Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528
by Tony CHEMIT (@tchemit) 11 Nov '22

11 Nov '22
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 99c413c7 by Tony Chemit at 2022-11-11T10:39:46+01:00 Disparition des TargetCatch avec discarded=FALSE dans la nouvelle migration V9 - Closes #2528 - - - - - f772ed31 by Tony Chemit at 2022-11-11T10:39:51+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) { ===================================== 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) { @@ -149,7 +148,7 @@ class NotDiscardedTargetCatchRecord { /*15*/ DataDtoEntityContext.escapeString(well), /*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) ); } ===================================== 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/f97a3cf98cb88f236f90f914… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f97a3cf98cb88f236f90f914… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop-9.0.x] 3 commits: Labellisation du référentiel 'Type de données des propriétés/matériaux de FOB - Closes #2512
by Tony CHEMIT (@tchemit) 10 Nov '22

10 Nov '22
Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: 8d07203f by Tony Chemit at 2022-11-10T10:54:05+01:00 Labellisation du référentiel &#39;Type de données des propriétés/matériaux de FOB - Closes #2512 - - - - - 85fa0c6a by Tony Chemit at 2022-11-10T10:54:05+01:00 Persistence migration - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503 - - - - - a7a1fbc7 by Tony Chemit at 2022-11-10T10:54:19+01:00 GUI - Sur échantillons PS observations saisis par lots, migrés vers 9.0, valeurs étranges sur le champ poids individuel - Closes #2503 - - - - - 14 changed files: - client/core/src/main/resources/fr/ird/observe/client/ui/ObserveCommon.jcss - client/datasource/editor/api/src/main/i18n/getters/java.getter - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/SampleContentTableUIModelStates.java - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/actions/ResetSizeMeasureType.java - client/datasource/editor/api/src/main/resources/fr/ird/observe/client/datasource/editor/api/content/data/sample/CommonSample.jcss - client/datasource/editor/ps/src/main/i18n/getters/java.getter - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jaxx - + client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jcss - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIModelStates.java - core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.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 Changes: ===================================== client/core/src/main/resources/fr/ird/observe/client/ui/ObserveCommon.jcss ===================================== @@ -114,11 +114,6 @@ enabled:false; } -.computedDataInformation { - icon:{fr.ird.observe.client.util.UIHelper.getUIManagerActionIcon("data-calcule")}; - disabledIcon:{fr.ird.observe.client.util.UIHelper.getUIManagerActionIcon("data-observe")}; -} - .showReset { showReset:true; } ===================================== client/datasource/editor/api/src/main/i18n/getters/java.getter ===================================== @@ -68,10 +68,6 @@ observe.data.WithDataFile.choose.title.importData observe.data.WithDataFile.delete.data.file.message observe.data.message.will.delete.sub.data.type observe.data.message.will.delete.sub.data.type2 -observe.data.ps.observation.Sample.length.computed.tip -observe.data.ps.observation.Sample.length.observed.tip -observe.data.ps.observation.Sample.weight.computed.tip -observe.data.ps.observation.Sample.weight.observed.tip observe.error.storage.backup.local.db observe.error.storage.close.current.db observe.error.storage.close.local.db @@ -281,7 +277,6 @@ observe.ui.message.db.none.loaded.tip observe.ui.message.delete observe.ui.message.delete.new observe.ui.message.loaded.tip -observe.ui.message.no.species.selected observe.ui.message.quit.invalid.edit observe.ui.message.quit.valid.edit observe.ui.message.show.referential.usages ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/SampleContentTableUIModelStates.java ===================================== @@ -23,10 +23,10 @@ package fr.ird.observe.client.datasource.editor.api.content.data.sample; */ import com.google.common.collect.Maps; -import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.client.datasource.api.cache.ReferencesCache; import fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableUIModel; import fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableUIModelStates; +import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.dto.data.ContainerChildDto; import fr.ird.observe.dto.data.DataDto; import fr.ird.observe.dto.data.ps.observation.SampleMeasureDto; @@ -40,12 +40,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.SIZE_COMPUTED_TIP; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.SIZE_OBSERVED_TIP; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.WEIGHT_COMPUTED_TIP; -import static fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType.WEIGHT_OBSERVED_TIP; -import static io.ultreia.java4all.i18n.I18n.t; - /** * Created on 08/01/2021. * @@ -75,14 +69,6 @@ public abstract class SampleContentTableUIModelStates<D extends DataDto, C exten public abstract AcquisitionMode getDefaultAcquisitionMode(); - public String getWeightDataTip(boolean computed) { - return computed ? t(WEIGHT_COMPUTED_TIP) : t(WEIGHT_OBSERVED_TIP); - } - - public String getLengthDataTip(boolean computed) { - return computed ? t(SIZE_COMPUTED_TIP) : t(SIZE_OBSERVED_TIP); - } - public SizeMeasureTypeReference getDefaultSizeMeasureType() { return defaultSizeMeasureType; } ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/sample/actions/ResetSizeMeasureType.java ===================================== @@ -31,16 +31,10 @@ import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox; import javax.swing.JButton; import java.awt.event.ActionEvent; -import static io.ultreia.java4all.i18n.I18n.n; import static io.ultreia.java4all.i18n.I18n.t; public class ResetSizeMeasureType<U extends ContentTableUI<?, ?, U>> extends ContentTableUIActionSupport<U> { - public static final String WEIGHT_COMPUTED_TIP = n("observe.data.ps.observation.Sample.weight.computed.tip"); - public static final String WEIGHT_OBSERVED_TIP = n("observe.data.ps.observation.Sample.weight.observed.tip"); - public static final String SIZE_COMPUTED_TIP = n("observe.data.ps.observation.Sample.length.computed.tip"); - public static final String SIZE_OBSERVED_TIP = n("observe.data.ps.observation.Sample.length.observed.tip"); - public static final String NO_SPECIES_SELECTED = n("observe.ui.message.no.species.selected"); private final FilterableComboBox<?> combo; public static <U extends ContentTableUI<?, ?, U>> void install(U ui, JButton editor, FilterableComboBox<?> combo) { ===================================== client/datasource/editor/api/src/main/resources/fr/ird/observe/client/datasource/editor/api/content/data/sample/CommonSample.jcss ===================================== @@ -66,16 +66,6 @@ focusable:false; } -#lengthSourceInformation { - enabled: {tableEditBean.isIsLengthComputed()}; - toolTipText:{getStates().getLengthDataTip(tableEditBean.isIsLengthComputed())}; -} - -#weightSourceInformation { - enabled: {tableEditBean.getAcquisitionMode() == 1 && tableEditBean.isIsWeightComputed()}; - toolTipText:{getStates().getWeightDataTip(tableEditBean.isIsWeightComputed())}; -} - #tagNumber { enabled:{tableEditBean.getAcquisitionMode() == 1}; } ===================================== client/datasource/editor/ps/src/main/i18n/getters/java.getter ===================================== @@ -29,6 +29,10 @@ observe.data.ps.observation.Catch.totalCountComputed.observed.tip observe.data.ps.observation.Route.choice.create.fin.veille.activity observe.data.ps.observation.Route.choice.not.create.fin.veille.activity.and.continue observe.data.ps.observation.Route.message.need.fin.veille.activity +observe.data.ps.observation.Sample.length.computed.tip +observe.data.ps.observation.Sample.length.observed.tip +observe.data.ps.observation.Sample.weight.computed.tip +observe.data.ps.observation.Sample.weight.observed.tip observe.data.ps.observation.Set.schoolType.not.fill observe.referential.Referential.type observe.ui.action.copyCoordinate ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jaxx ===================================== @@ -187,7 +187,7 @@ <JPanel id="invisible"> <JButton id="defaultSizeMeasureType"/> <JButton id="defaultWeightMeasureType"/> - <JButton id='lengthSourceInformation' styleClass='computedDataInformation' onActionPerformed='handler.resetIsLengthComputed()'/> - <JButton id='weightSourceInformation' styleClass='computedDataInformation' onActionPerformed='handler.resetIsWeightComputed()'/> + <JButton id='lengthSourceInformation' onActionPerformed='handler.resetIsLengthComputed()'/> + <JButton id='weightSourceInformation' onActionPerformed='handler.resetIsWeightComputed()'/> </JPanel> </fr.ird.observe.client.datasource.editor.api.content.data.table.ContentTableUI> ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUI.jcss ===================================== @@ -0,0 +1,35 @@ +/*- + * #%L + * ObServe Client :: DataSource :: Editor :: PS + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +#lengthSourceInformation { + enabled: {tableEditBean.isIsLengthComputed()}; + toolTipText:{getStates().getLengthDataTip(tableEditBean.isIsLengthComputed())}; + icon:{getStates().getSourceInformationIcon(tableEditBean.isIsLengthComputed())}; + disabledIcon:{getStates().getSourceInformationIcon(tableEditBean.isIsLengthComputed())}; +} + +#weightSourceInformation { + enabled: {tableEditBean.getAcquisitionMode() == 1 && tableEditBean.isIsWeightComputed()}; + toolTipText:{getStates().getWeightDataTip(tableEditBean.isIsWeightComputed())}; + icon:{getStates().getSourceInformationIcon(tableEditBean.isIsWeightComputed())}; + disabledIcon:{getStates().getSourceInformationIcon(tableEditBean.isIsWeightComputed())}; +} ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIHandler.java ===================================== @@ -21,9 +21,9 @@ */ package fr.ird.observe.client.datasource.editor.ps.data.observation; -import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetSizeMeasureType; import fr.ird.observe.client.datasource.editor.api.content.data.sample.actions.ResetWeightMeasureType; +import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.dto.data.ps.observation.SampleMeasureDto; import fr.ird.observe.dto.referential.common.SizeMeasureTypeReference; import fr.ird.observe.dto.referential.common.SpeciesReference; @@ -251,7 +251,9 @@ public class SampleUIHandler extends GeneratedSampleUIHandler { protected void onWeightChanged(Float newValue) { SampleMeasureDto tableEditBean = ui.getModel().getStates().getTableEditBean(); - tableEditBean.setIsWeightComputed(false); + if (tableEditBean.getAcquisitionMode() == 1) { + tableEditBean.setIsWeightComputed(false); + } if (newValue == null) { tableEditBean.setWeightMeasureMethod(null); } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SampleUIModelStates.java ===================================== @@ -26,6 +26,7 @@ import fr.ird.observe.client.configuration.ClientConfig; import fr.ird.observe.client.datasource.api.cache.ReferencesCache; import fr.ird.observe.client.datasource.api.cache.ReferencesFilterHelper; import fr.ird.observe.client.datasource.editor.api.content.data.sample.SampleContentTableUIModelStates; +import fr.ird.observe.client.util.UIHelper; import fr.ird.observe.dto.data.AcquisitionMode; import fr.ird.observe.dto.data.ps.observation.SampleDto; import fr.ird.observe.dto.data.ps.observation.SampleMeasureDto; @@ -35,11 +36,25 @@ import fr.ird.observe.navigation.id.Project; import fr.ird.observe.services.ObserveServicesProvider; import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition; +import javax.swing.Icon; + +import static io.ultreia.java4all.i18n.I18n.n; +import static io.ultreia.java4all.i18n.I18n.t; + @GenerateJavaBeanDefinition public class SampleUIModelStates extends SampleContentTableUIModelStates<SampleDto, SampleMeasureDto> { + public static final String WEIGHT_COMPUTED_TIP = n("observe.data.ps.observation.Sample.weight.computed.tip"); + public static final String WEIGHT_OBSERVED_TIP = n("observe.data.ps.observation.Sample.weight.observed.tip"); + public static final String SIZE_COMPUTED_TIP = n("observe.data.ps.observation.Sample.length.computed.tip"); + public static final String SIZE_OBSERVED_TIP = n("observe.data.ps.observation.Sample.length.observed.tip"); + private final Icon computedIcon; + private final Icon observedIcon; + public SampleUIModelStates(GeneratedSampleUIModel model) { super(model, SampleDto.newDto(new java.util.Date()), SampleMeasureDto.newDto(new java.util.Date()), model.getSource().getInitializer().getSelectedId(), model.getSource().getInitializer().getScope().isStandalone()); + this.computedIcon = UIHelper.getUIManagerActionIcon("data-calcule"); + this.observedIcon = UIHelper.getUIManagerActionIcon("data-observe"); } @Override @@ -65,4 +80,16 @@ public class SampleUIModelStates extends SampleContentTableUIModelStates<SampleD return beanToSave; } + public String getWeightDataTip(boolean computed) { + return computed ? t(WEIGHT_COMPUTED_TIP) : t(WEIGHT_OBSERVED_TIP); + } + + public String getLengthDataTip(boolean computed) { + return computed ? t(SIZE_COMPUTED_TIP) : t(SIZE_OBSERVED_TIP); + } + + public Icon getSourceInformationIcon(boolean computed) { + return computed ? computedIcon : observedIcon; + } + } ===================================== core/persistence/resources/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_0.java ===================================== @@ -372,6 +372,10 @@ public class DataSourceMigrationForVersion_9_0 extends ByMajorMigrationVersionRe this.sample_idx = resultSet.getInt(20); this.lengthMeasureMethod = resultSet.getString(21); this.weightMeasureMethod = resultSet.getString(22); + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2503 + if (acquisitionMode == 0 && weight != null && !isWeightComputed) { + isWeightComputed = true; + } } } ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1634,7 +1634,7 @@ observe.referential.ps.common.ObjectMaterial.validation=Validation observe.referential.ps.common.ObjectMaterial.validation.bad.parentCode=Code should starts with %1$s- observe.referential.ps.common.ObjectMaterial.validation.invalid.validation=Validation formula is not valid. observe.referential.ps.common.ObjectMaterial.validationInformation=Validation formula must contains variable x -observe.referential.ps.common.ObjectMaterialType.type=Floating objet material type +observe.referential.ps.common.ObjectMaterialType.type=Data type of properties/material of FOB observe.referential.ps.common.ObjectOperation.atLeastOneSelected=Domain observe.referential.ps.common.ObjectOperation.type=Object operation observe.referential.ps.common.ObjectOperation.validation.atLeastOneSelected=At least one domain must be selected. ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1634,7 +1634,7 @@ observe.referential.ps.common.ObjectMaterial.validation=Validation \#TODO observe.referential.ps.common.ObjectMaterial.validation.bad.parentCode=Code should starts with %1$s- \#TODO observe.referential.ps.common.ObjectMaterial.validation.invalid.validation=La formule de validation n'est pas cohérente. \#TODO observe.referential.ps.common.ObjectMaterial.validationInformation=La formule de validation doit contenir la variable x \#TODO -observe.referential.ps.common.ObjectMaterialType.type=Type d'objet flottant \#TODO +observe.referential.ps.common.ObjectMaterialType.type=Data type of properties/material of FOB \#TODO observe.referential.ps.common.ObjectOperation.atLeastOneSelected=Domain observe.referential.ps.common.ObjectOperation.type=Operación sobre el objeto observe.referential.ps.common.ObjectOperation.validation.atLeastOneSelected=At least one domain must be selected. ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1634,7 +1634,7 @@ observe.referential.ps.common.ObjectMaterial.validation=Validation observe.referential.ps.common.ObjectMaterial.validation.bad.parentCode=Le code doit commencer par %1$s- observe.referential.ps.common.ObjectMaterial.validation.invalid.validation=La formule de validation n'est pas cohérente. observe.referential.ps.common.ObjectMaterial.validationInformation=La formule de validation doit contenir la variable x -observe.referential.ps.common.ObjectMaterialType.type=Type d'objet flottant +observe.referential.ps.common.ObjectMaterialType.type=Type de données des propriétés/matériaux de FOB observe.referential.ps.common.ObjectOperation.atLeastOneSelected=Sous-domaine observe.referential.ps.common.ObjectOperation.type=Opération sur l'objet observe.referential.ps.common.ObjectOperation.validation.atLeastOneSelected=Veuillez sélectionner au moins un sous domaine. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f1d62d0f6de901b21df74434… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/f1d62d0f6de901b21df74434… You're receiving this email because of your account on gitlab.com.
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.