Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

11 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -35,7 +35,7 @@ cache:
    35 35
       services:
    
    36 36
         - docker:dind
    
    37 37
       script:
    
    38
    -    - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11 gitlab-ci-token ${CI_REGISTRY_PASSWORD} ${BUILD_DIR}; fi
    
    38
    +    - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11 gitlab-ci-token ${CI_REGISTRY_PASSWORD}; fi
    
    39 39
     
    
    40 40
     .build: &build
    
    41 41
       environment:
    

  • client/datasource/actions/src/main/i18n/getters/java.getter
    ... ... @@ -122,6 +122,7 @@ observe.ui.datasource.editor.actions.synchro.referential.action.revertFromRight.
    122 122
     observe.ui.datasource.editor.actions.synchro.referential.description
    
    123 123
     observe.ui.datasource.editor.actions.synchro.referential.launch.operation
    
    124 124
     observe.ui.datasource.editor.actions.synchro.referential.legacy
    
    125
    +observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation
    
    125 126
     observe.ui.datasource.editor.actions.synchro.referential.legacy.description
    
    126 127
     observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation
    
    127 128
     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
    29 29
     import io.ultreia.java4all.decoration.Decorator;
    
    30 30
     import io.ultreia.java4all.i18n.I18n;
    
    31 31
     import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
    
    32
    +import org.apache.logging.log4j.LogManager;
    
    33
    +import org.apache.logging.log4j.Logger;
    
    32 34
     import org.nuiton.jaxx.runtime.spi.UIHandler;
    
    33 35
     import org.nuiton.jaxx.runtime.swing.CardLayout2;
    
    34 36
     import org.nuiton.jaxx.runtime.swing.model.JaxxDefaultListModel;
    
    ... ... @@ -48,6 +50,8 @@ import java.util.Set;
    48 50
     @SuppressWarnings({"rawtypes", "unchecked"})
    
    49 51
     public class SynchronizeUIHandler extends AdminTabUIHandler<SynchronizeUI> implements UIHandler<SynchronizeUI> {
    
    50 52
     
    
    53
    +    private static final Logger log = LogManager.getLogger(SynchronizeUIHandler.class);
    
    54
    +
    
    51 55
         @Override
    
    52 56
         public void afterInit(SynchronizeUI ui) {
    
    53 57
             super.afterInit(ui);
    
    ... ... @@ -73,8 +77,19 @@ public class SynchronizeUIHandler extends AdminTabUIHandler<SynchronizeUI> imple
    73 77
             }
    
    74 78
             SynchronizeModel stepModel = ui.getStepModel();
    
    75 79
             int row = stepModel.getObsoleteReferencesSelectionModel().getMinSelectionIndex();
    
    80
    +        log.info("Selected row in obsolete references list: {}", row);
    
    76 81
             JaxxDefaultListModel<ObsoleteReferentialReference<?>> obsoleteReferences = stepModel.getObsoleteReferences();
    
    77
    -        if (row != -1 && obsoleteReferences.getElementAt(row) != null) {
    
    82
    +        if (row == -1) {
    
    83
    +            // No selection in the obsolete list
    
    84
    +            FilterableComboBox<ToolkitIdLabel> safeComboBox = getSafeComboBox();
    
    85
    +            if (safeComboBox != null) {
    
    86
    +                safeComboBox.setSelectedItem(null);
    
    87
    +                safeComboBox.setEnabled(false);
    
    88
    +                ui.setCanApply(false);
    
    89
    +            }
    
    90
    +            return;
    
    91
    +        }
    
    92
    +        if (obsoleteReferences.getElementAt(row) != null) {
    
    78 93
                 ObsoleteReferentialReference referentialReference = obsoleteReferences.getElementAt(row);
    
    79 94
                 String key = referentialReference.getReferentialName().getName();
    
    80 95
                 CardLayout2 safeRefsPanelLayout = ui.getSafeRefsPanelLayout();
    
    ... ... @@ -82,6 +97,7 @@ public class SynchronizeUIHandler extends AdminTabUIHandler<SynchronizeUI> imple
    82 97
                 if (safeRefsPanelLayout.contains(key)) {
    
    83 98
                     // la liste déroulante existe deja pour ce type
    
    84 99
                     FilterableComboBox<?> list = (FilterableComboBox<?>) safeRefsPanelLayout.getComponent(safeRefsPanel, key);
    
    100
    +                list.setEnabled(true);
    
    85 101
                     if (!getSafeComboBox().equals(list)) {
    
    86 102
                         // on l'affiche
    
    87 103
                         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;
    40 40
     public class Apply extends SynchroUIActionSupport {
    
    41 41
     
    
    42 42
         public Apply() {
    
    43
    -        super(t("observe.ui.action.apply"), t("observe.ui.action.apply"), "accept", 'Q');
    
    43
    +        super(t("observe.ui.action.apply"), t("observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation"), "accept", 'Q');
    
    44 44
         }
    
    45 45
     
    
    46 46
         @Override
    
    47 47
         protected void doActionPerformed(ActionEvent e, SynchronizeUI ui) {
    
    48
    -        resolveObsoleteReference();
    
    48
    +        addAdminWorker(getUi().getStart().getToolTipText(), this::resolveObsoleteReference);
    
    49 49
         }
    
    50 50
     
    
    51
    -    private  <D extends ReferentialDto> void resolveObsoleteReference() {
    
    51
    +    private <D extends ReferentialDto> WizardState resolveObsoleteReference() {
    
    52 52
     
    
    53 53
             @SuppressWarnings("unchecked") ObsoleteReferentialReference<D> obsoleteRef = (ObsoleteReferentialReference<D>) ui.getObsoleteReferencesList().getSelectedValue();
    
    54 54
     
    
    ... ... @@ -74,10 +74,11 @@ public class Apply extends SynchroUIActionSupport {
    74 74
                     try (ObserveSwingDataSource centralSource = ObserveSwingDataSource.doOpenSource(stepModel.getCentralSource())) {
    
    75 75
                         UnidirectionalSynchronizeEngine engine = stepModel.newEngine();
    
    76 76
                         beforeSuccess(engine);
    
    77
    -                    ui.getModel().setStepState(WizardState.SUCCESSED);
    
    77
    +                    return WizardState.SUCCESSED;
    
    78 78
                     }
    
    79 79
                 }
    
    80 80
             }
    
    81
    +        return WizardState.NEED_FIX;
    
    81 82
         }
    
    82 83
     
    
    83 84
     }

  • client/runner/src/main/i18n/translations/client-runner_en_GB.properties
    ... ... @@ -619,6 +619,7 @@ observe.ui.datasource.editor.actions.synchro.referential.action.revertFromRight.
    619 619
     observe.ui.datasource.editor.actions.synchro.referential.description=Advanced referential management
    
    620 620
     observe.ui.datasource.editor.actions.synchro.referential.launch.operation=Compute differentials of referential
    
    621 621
     observe.ui.datasource.editor.actions.synchro.referential.legacy=Update referential
    
    622
    +observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation=Apply remplacement and finalize the update if obsolete list is empty
    
    622 623
     observe.ui.datasource.editor.actions.synchro.referential.legacy.description=Update referential
    
    623 624
     observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation=Synchronize referential from central database
    
    624 625
     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.
    619 619
     observe.ui.datasource.editor.actions.synchro.referential.description=Gestión avanzada del referencial
    
    620 620
     observe.ui.datasource.editor.actions.synchro.referential.launch.operation=Calcular el diferencial de los referenciales de los fuentes de datos
    
    621 621
     observe.ui.datasource.editor.actions.synchro.referential.legacy=Actualización del referencial
    
    622
    +observe.ui.datasource.editor.actions.synchro.referential.legacy.apply.operation=Apply remplacement and finalize the update if obsolete list is empty \#TODO
    
    622 623
     observe.ui.datasource.editor.actions.synchro.referential.legacy.description=Actualizar el referencial gracia a una base central
    
    623 624
     observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation=Calcular el diferencial de los referenciales de los fuentes de datos
    
    624 625
     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.
    619 619
     observe.ui.datasource.editor.actions.synchro.referential.description=Gestion avancée du référentiel
    
    620 620
     observe.ui.datasource.editor.actions.synchro.referential.launch.operation=Calculer le différentiel des référentiels des sources de données
    
    621 621
     observe.ui.datasource.editor.actions.synchro.referential.legacy=Mise à jour du référentiel
    
    622
    +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
    
    622 623
     observe.ui.datasource.editor.actions.synchro.referential.legacy.description=Mettre à jour le référentiel depuis une base centrale
    
    623 624
     observe.ui.datasource.editor.actions.synchro.referential.legacy.launch.operation=Calculer le différentiel des référentiels des sources de données
    
    624 625
     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 {
    296 296
             localmarketSampleType = Objects.requireNonNull(Maps.uniqueIndex(referential.getSampleType(), SampleType::getCode).get("9"));
    
    297 297
         }
    
    298 298
     
    
    299
    -
    
    300
    -    public void setNoneZeroFloat(Object o, Consumer<Float> setter) {
    
    301
    -        if (o != null) {
    
    302
    -            Float o1 = Float.valueOf(o.toString());
    
    303
    -            if (o1.intValue() > 0) {
    
    304
    -                setter.accept(o1);
    
    305
    -            }
    
    306
    -        }
    
    307
    -    }
    
    308
    -
    
    309 299
         public SetSuccessStatus getSetSuccessStatus0() {
    
    310 300
             return setSuccessStatus0;
    
    311 301
         }
    

  • 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> {
    150 150
             entity.setStartDate(Objects.requireNonNull(startDate));
    
    151 151
             entity.setLandingWellContentStatus(dataContext.getWellContentStatus(resultSet.getString(11)));
    
    152 152
             entity.setLoch(resultSet.getInt(12));
    
    153
    -        entity.setLogbookComment(resultSet.getString(13));
    
    153
    +        String logbookComment = resultSet.getString(13);
    
    154
    +        // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2923
    
    155
    +        if (logbookComment != null) {
    
    156
    +            logbookComment = logbookComment.trim();
    
    157
    +            if (!logbookComment.isEmpty()) {
    
    158
    +                entity.setLogbookComment(logbookComment);
    
    159
    +            }
    
    160
    +        }
    
    154 161
             entity.setErsId(resultSet.getString(14));
    
    155 162
             entity.setDepartureWellContentStatus(dataContext.getWellContentStatus(resultSet.getString(15)));
    
    156 163
             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> {
    115 115
             String wellId = WellReader.getWellId(resultSet, 7);
    
    116 116
             entity.setWell(wellId);
    
    117 117
             entity.setSuperSample(resultSet.getInt(9) == 1);
    
    118
    -        Object smallsWeight = resultSet.getObject(10);
    
    119
    -        dataContext.setNoneZeroFloat(smallsWeight, entity::setSmallsWeight);
    
    120
    -        Object bigsWeight = resultSet.getObject(11);
    
    121
    -        dataContext.setNoneZeroFloat(bigsWeight, entity::setBigsWeight);
    
    122
    -        Object totalWeight = resultSet.getObject(12);
    
    123
    -        dataContext.setNoneZeroFloat(totalWeight, entity::setTotalWeight);
    
    118
    +        entity.setSmallsWeight(((Number) resultSet.getObject(10)).floatValue());
    
    119
    +        entity.setBigsWeight(((Number) resultSet.getObject(11)).floatValue());
    
    120
    +        entity.setTotalWeight(((Number) resultSet.getObject(12)).floatValue());
    
    121
    +        // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2918
    
    122
    +        boolean smallsWeightNull = isNull(entity.getSmallsWeight());
    
    123
    +        boolean bigsWeightNull = isNull(entity.getBigsWeight());
    
    124
    +        boolean totalWeightNull = isNull(entity.getTotalWeight());
    
    125
    +        if (smallsWeightNull && bigsWeightNull && totalWeightNull) {
    
    126
    +            entity.setSmallsWeight(null);
    
    127
    +            entity.setBigsWeight(null);
    
    128
    +            entity.setTotalWeight(0f);
    
    129
    +            return entity;
    
    130
    +        }
    
    131
    +        if (!smallsWeightNull || !bigsWeightNull) {
    
    132
    +            if (totalWeightNull) {
    
    133
    +                entity.setTotalWeight(null);
    
    134
    +            }
    
    135
    +            if (smallsWeightNull) {
    
    136
    +                entity.setSmallsWeight(0f);
    
    137
    +            }
    
    138
    +            if (bigsWeightNull) {
    
    139
    +                entity.setBigsWeight(0f);
    
    140
    +            }
    
    141
    +            return entity;
    
    142
    +        }
    
    143
    +        // now we have smallsWeightNull && bigsWeightNull
    
    144
    +        entity.setSmallsWeight(null);
    
    145
    +        entity.setBigsWeight(null);
    
    124 146
             return entity;
    
    125 147
         }
    
    148
    +
    
    149
    +    private static boolean isNull(Float value) {
    
    150
    +        return Math.abs(value)-0.000001f==0;
    
    151
    +    }
    
    126 152
     }

  • pom.xml
    ... ... @@ -23,7 +23,7 @@
    23 23
       <parent>
    
    24 24
         <groupId>io.ultreia.maven</groupId>
    
    25 25
         <artifactId>pom</artifactId>
    
    26
    -    <version>2024.29</version>
    
    26
    +    <version>2024.31</version>
    
    27 27
       </parent>
    
    28 28
       <groupId>fr.ird.observe</groupId>
    
    29 29
       <artifactId>ird-observe</artifactId>