[Git][ultreiaio/ird-observe][develop] 5 commits: Faille sur l'UI de remplacement de code de référentiel - Closes #2917
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 09fab1d5 by Tony Chemit at 2024-07-11T12:39:44+02:00 Faille sur l'UI de remplacement de code de référentiel - Closes #2917 - - - - - c7def86d by Tony Chemit at 2024-07-11T13:45:54+02:00 fix CI - - - - - 4104a3af by Tony Chemit at 2024-08-17T17:29:05+02:00 update pom - - - - - dc83d313 by Tony Chemit at 2024-08-17T17:29:05+02:00 Amélioration des poids +10/-10 et total des échantillons lors de l'import AVDTH - Closes #2918 - - - - - 92dab31d by Tony Chemit at 2024-08-17T17:41:59+02:00 Mettre à null le commentaire Trip.logbookComment si celui ci n'est constitué que d'espaces - Closes #2923 - - - - - 11 changed files: - .gitlab-ci.yml - client/datasource/actions/src/main/i18n/getters/java.getter - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/legacy/SynchronizeUIHandler.java - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/legacy/actions/Apply.java - client/runner/src/main/i18n/translations/client-runner_en_GB.properties - client/runner/src/main/i18n/translations/client-runner_es_ES.properties - client/runner/src/main/i18n/translations/client-runner_fr_FR.properties - core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/ImportReferentialContext.java - core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/common/TripReader.java - core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/SampleReader.java - pom.xml Changes: ===================================== .gitlab-ci.yml ===================================== @@ -35,7 +35,7 @@ cache: services: - docker:dind script: - - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11 gitlab-ci-token ${CI_REGISTRY_PASSWORD} ${BUILD_DIR}; fi + - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11 gitlab-ci-token ${CI_REGISTRY_PASSWORD}; fi .build: &build environment: ===================================== client/datasource/actions/src/main/i18n/getters/java.getter ===================================== @@ -122,6 +122,7 @@ observe.ui.datasource.editor.actions.synchro.referential.action.revertFromRight. observe.ui.datasource.editor.actions.synchro.referential.description observe.ui.datasource.editor.actions.synchro.referential.launch.operation observe.ui.datasource.editor.actions.synchro.referential.legacy +observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation observe.ui.datasource.editor.actions.synchro.referential.legacy.description observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation observe.ui.datasource.editor.actions.synchro.referential.legacy.tip ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/legacy/SynchronizeUIHandler.java ===================================== @@ -29,6 +29,8 @@ import fr.ird.observe.services.service.referential.synchro.UnidirectionalCallbac import io.ultreia.java4all.decoration.Decorator; import io.ultreia.java4all.i18n.I18n; import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.CardLayout2; import org.nuiton.jaxx.runtime.swing.model.JaxxDefaultListModel; @@ -48,6 +50,8 @@ import java.util.Set; @SuppressWarnings({"rawtypes", "unchecked"}) public class SynchronizeUIHandler extends AdminTabUIHandler<SynchronizeUI> implements UIHandler<SynchronizeUI> { + private static final Logger log = LogManager.getLogger(SynchronizeUIHandler.class); + @Override public void afterInit(SynchronizeUI ui) { super.afterInit(ui); @@ -73,8 +77,19 @@ public class SynchronizeUIHandler extends AdminTabUIHandler<SynchronizeUI> imple } SynchronizeModel stepModel = ui.getStepModel(); int row = stepModel.getObsoleteReferencesSelectionModel().getMinSelectionIndex(); + log.info("Selected row in obsolete references list: {}", row); JaxxDefaultListModel<ObsoleteReferentialReference<?>> obsoleteReferences = stepModel.getObsoleteReferences(); - if (row != -1 && obsoleteReferences.getElementAt(row) != null) { + if (row == -1) { + // No selection in the obsolete list + FilterableComboBox<ToolkitIdLabel> safeComboBox = getSafeComboBox(); + if (safeComboBox != null) { + safeComboBox.setSelectedItem(null); + safeComboBox.setEnabled(false); + ui.setCanApply(false); + } + return; + } + if (obsoleteReferences.getElementAt(row) != null) { ObsoleteReferentialReference referentialReference = obsoleteReferences.getElementAt(row); String key = referentialReference.getReferentialName().getName(); CardLayout2 safeRefsPanelLayout = ui.getSafeRefsPanelLayout(); @@ -82,6 +97,7 @@ public class SynchronizeUIHandler extends AdminTabUIHandler<SynchronizeUI> imple if (safeRefsPanelLayout.contains(key)) { // la liste déroulante existe deja pour ce type FilterableComboBox<?> list = (FilterableComboBox<?>) safeRefsPanelLayout.getComponent(safeRefsPanel, key); + list.setEnabled(true); if (!getSafeComboBox().equals(list)) { // on l'affiche safeRefsPanelLayout.show(safeRefsPanel, key); ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/legacy/actions/Apply.java ===================================== @@ -40,15 +40,15 @@ import static io.ultreia.java4all.i18n.I18n.t; public class Apply extends SynchroUIActionSupport { public Apply() { - super(t("observe.ui.action.apply"), t("observe.ui.action.apply"), "accept", 'Q'); + super(t("observe.ui.action.apply"), t("observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation"), "accept", 'Q'); } @Override protected void doActionPerformed(ActionEvent e, SynchronizeUI ui) { - resolveObsoleteReference(); + addAdminWorker(getUi().getStart().getToolTipText(), this::resolveObsoleteReference); } - private <D extends ReferentialDto> void resolveObsoleteReference() { + private <D extends ReferentialDto> WizardState resolveObsoleteReference() { @SuppressWarnings("unchecked") ObsoleteReferentialReference<D> obsoleteRef = (ObsoleteReferentialReference<D>) ui.getObsoleteReferencesList().getSelectedValue(); @@ -74,10 +74,11 @@ public class Apply extends SynchroUIActionSupport { try (ObserveSwingDataSource centralSource = ObserveSwingDataSource.doOpenSource(stepModel.getCentralSource())) { UnidirectionalSynchronizeEngine engine = stepModel.newEngine(); beforeSuccess(engine); - ui.getModel().setStepState(WizardState.SUCCESSED); + return WizardState.SUCCESSED; } } } + return WizardState.NEED_FIX; } } ===================================== client/runner/src/main/i18n/translations/client-runner_en_GB.properties ===================================== @@ -619,6 +619,7 @@ observe.ui.datasource.editor.actions.synchro.referential.action.revertFromRight. observe.ui.datasource.editor.actions.synchro.referential.description=Advanced referential management observe.ui.datasource.editor.actions.synchro.referential.launch.operation=Compute differentials of referential observe.ui.datasource.editor.actions.synchro.referential.legacy=Update referential +observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation=Apply remplacement and finalize the update if obsolete list is empty observe.ui.datasource.editor.actions.synchro.referential.legacy.description=Update referential observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation=Synchronize referential from central database observe.ui.datasource.editor.actions.synchro.referential.legacy.tip=Synchronize object on local database ===================================== client/runner/src/main/i18n/translations/client-runner_es_ES.properties ===================================== @@ -619,6 +619,7 @@ observe.ui.datasource.editor.actions.synchro.referential.action.revertFromRight. observe.ui.datasource.editor.actions.synchro.referential.description=Gestión avanzada del referencial observe.ui.datasource.editor.actions.synchro.referential.launch.operation=Calcular el diferencial de los referenciales de los fuentes de datos observe.ui.datasource.editor.actions.synchro.referential.legacy=Actualización del referencial +observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation=Apply remplacement and finalize the update if obsolete list is empty \#TODO observe.ui.datasource.editor.actions.synchro.referential.legacy.description=Actualizar el referencial gracia a una base central observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation=Calcular el diferencial de los referenciales de los fuentes de datos observe.ui.datasource.editor.actions.synchro.referential.legacy.tip=Operación de actualización del referencial de la base local ===================================== client/runner/src/main/i18n/translations/client-runner_fr_FR.properties ===================================== @@ -619,6 +619,7 @@ observe.ui.datasource.editor.actions.synchro.referential.action.revertFromRight. observe.ui.datasource.editor.actions.synchro.referential.description=Gestion avancée du référentiel observe.ui.datasource.editor.actions.synchro.referential.launch.operation=Calculer le différentiel des référentiels des sources de données observe.ui.datasource.editor.actions.synchro.referential.legacy=Mise à jour du référentiel +observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation=Appliquer le remplacement et finir la mise à jour si la liste des références à remplacer est vide observe.ui.datasource.editor.actions.synchro.referential.legacy.description=Mettre à jour le référentiel depuis une base centrale observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation=Calculer le différentiel des référentiels des sources de données observe.ui.datasource.editor.actions.synchro.referential.legacy.tip=Opération de mise à jour du référentiel de la base locale ===================================== core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/ImportReferentialContext.java ===================================== @@ -296,16 +296,6 @@ public class ImportReferentialContext { localmarketSampleType = Objects.requireNonNull(Maps.uniqueIndex(referential.getSampleType(), SampleType::getCode).get("9")); } - - public void setNoneZeroFloat(Object o, Consumer<Float> setter) { - if (o != null) { - Float o1 = Float.valueOf(o.toString()); - if (o1.intValue() > 0) { - setter.accept(o1); - } - } - } - public SetSuccessStatus getSetSuccessStatus0() { return setSuccessStatus0; } ===================================== core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/common/TripReader.java ===================================== @@ -150,7 +150,14 @@ public class TripReader extends DataReader<Trip> { entity.setStartDate(Objects.requireNonNull(startDate)); entity.setLandingWellContentStatus(dataContext.getWellContentStatus(resultSet.getString(11))); entity.setLoch(resultSet.getInt(12)); - entity.setLogbookComment(resultSet.getString(13)); + String logbookComment = resultSet.getString(13); + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2923 + if (logbookComment != null) { + logbookComment = logbookComment.trim(); + if (!logbookComment.isEmpty()) { + entity.setLogbookComment(logbookComment); + } + } entity.setErsId(resultSet.getString(14)); entity.setDepartureWellContentStatus(dataContext.getWellContentStatus(resultSet.getString(15))); entity.setLogbookDataQuality(dataContext.getDataQualityA()); ===================================== core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/SampleReader.java ===================================== @@ -115,12 +115,38 @@ public class SampleReader extends DataReader<Sample> { String wellId = WellReader.getWellId(resultSet, 7); entity.setWell(wellId); entity.setSuperSample(resultSet.getInt(9) == 1); - Object smallsWeight = resultSet.getObject(10); - dataContext.setNoneZeroFloat(smallsWeight, entity::setSmallsWeight); - Object bigsWeight = resultSet.getObject(11); - dataContext.setNoneZeroFloat(bigsWeight, entity::setBigsWeight); - Object totalWeight = resultSet.getObject(12); - dataContext.setNoneZeroFloat(totalWeight, entity::setTotalWeight); + entity.setSmallsWeight(((Number) resultSet.getObject(10)).floatValue()); + entity.setBigsWeight(((Number) resultSet.getObject(11)).floatValue()); + entity.setTotalWeight(((Number) resultSet.getObject(12)).floatValue()); + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2918 + boolean smallsWeightNull = isNull(entity.getSmallsWeight()); + boolean bigsWeightNull = isNull(entity.getBigsWeight()); + boolean totalWeightNull = isNull(entity.getTotalWeight()); + if (smallsWeightNull && bigsWeightNull && totalWeightNull) { + entity.setSmallsWeight(null); + entity.setBigsWeight(null); + entity.setTotalWeight(0f); + return entity; + } + if (!smallsWeightNull || !bigsWeightNull) { + if (totalWeightNull) { + entity.setTotalWeight(null); + } + if (smallsWeightNull) { + entity.setSmallsWeight(0f); + } + if (bigsWeightNull) { + entity.setBigsWeight(0f); + } + return entity; + } + // now we have smallsWeightNull && bigsWeightNull + entity.setSmallsWeight(null); + entity.setBigsWeight(null); return entity; } + + private static boolean isNull(Float value) { + return Math.abs(value)-0.000001f==0; + } } ===================================== pom.xml ===================================== @@ -23,7 +23,7 @@ <parent> <groupId>io.ultreia.maven</groupId> <artifactId>pom</artifactId> - <version>2024.29</version> + <version>2024.31</version> </parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/d0e69531e0fa55345f5b6fa4b... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/d0e69531e0fa55345f5b6fa4b... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)