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

Commits:

16 changed files:

Changes:

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/DcpUIAdapter.java
    ... ... @@ -151,6 +151,8 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    151 151
                 }
    
    152 152
             });
    
    153 153
             states.getBean().addPropertyChangeListener(FloatingObjectDto.PROPERTY_OBJECT_OPERATION, e -> states.updateMaterials(getTable().getTreeTableModel(), (ObjectOperationReference) e.getNewValue()));
    
    154
    +        states.setFirstBuoyOwnershipListener(new DcpUIModelStates.TransmittingBuoyOwnershipListener<>(getTransmittingBuoy1(), getVessel1(), getCountry1()));
    
    155
    +        states.setSecondBuoyOwnershipListener(new DcpUIModelStates.TransmittingBuoyOwnershipListener<>(getTransmittingBuoy2(), getVessel2(), getCountry2()));
    
    154 156
         }
    
    155 157
     
    
    156 158
         default void installExtraActions() {
    
    ... ... @@ -165,12 +167,14 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    165 167
             changeTypeTransmittingBuoyOperation(states, typeOperation, false);
    
    166 168
         }
    
    167 169
     
    
    168
    -    default void stopEditUI() {
    
    170
    +    default void stopEditUI(DcpUIModelStates<?, ?> states) {
    
    169 171
             if (getMainTabbedPane().getSelectedIndex() == 1) {
    
    170 172
                 getTable().editingCanceled(null);
    
    171 173
             }
    
    172 174
             getValidatorBuoy1().setBean(null);
    
    173 175
             getValidatorBuoy2().setBean(null);
    
    176
    +        states.removeFirstBuoyOwnershipListener(getTransmittingBuoy1());
    
    177
    +        states.removeSecondBuoyOwnershipListener(getTransmittingBuoy2());
    
    174 178
         }
    
    175 179
     
    
    176 180
         default void changeTypeTransmittingBuoyOperation(ItemEvent event, DcpUIModelStates<?, ?> states) {
    
    ... ... @@ -184,8 +188,10 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    184 188
             FloatingObjectAware bean = states.getBean();
    
    185 189
             if (bean.getFirstBuoy() != null) {
    
    186 190
                 getValidatorBuoy1().setBean(getTransmittingBuoy1());
    
    191
    +            states.addFirstBuoyOwnershipListener(getTransmittingBuoy1());
    
    187 192
                 if (bean.getSecondBuoy() != null) {
    
    188 193
                     getValidatorBuoy2().setBean(getTransmittingBuoy2());
    
    194
    +                states.addSecondBuoyOwnershipListener(getTransmittingBuoy2());
    
    189 195
                 }
    
    190 196
             }
    
    191 197
             states.setModified(states.isCreatingMode());
    
    ... ... @@ -219,6 +225,8 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    219 225
             if (states.isEditing()) {
    
    220 226
                 getValidatorBuoy1().setBean(null);
    
    221 227
                 getValidatorBuoy2().setBean(null);
    
    228
    +            states.removeFirstBuoyOwnershipListener(getTransmittingBuoy1());
    
    229
    +            states.removeSecondBuoyOwnershipListener(getTransmittingBuoy2());
    
    222 230
             }
    
    223 231
     
    
    224 232
             String[] transmittingBuoyOperationCodes = typeOperation.getTransmittingBuoyOperationCodes();
    
    ... ... @@ -239,6 +247,7 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    239 247
                     editorPanel.add(getTransmittingBuoy1EditorPanel());
    
    240 248
                     if (states.isEditing()) {
    
    241 249
                         getValidatorBuoy1().setBean(getTransmittingBuoy1());
    
    250
    +                    states.addFirstBuoyOwnershipListener(getTransmittingBuoy1());
    
    242 251
                     }
    
    243 252
                     focusOwner = getTransmittingBuoyType1();
    
    244 253
                     break;
    
    ... ... @@ -256,6 +265,8 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    256 265
                     if (states.isEditing()) {
    
    257 266
                         getValidatorBuoy1().setBean(getTransmittingBuoy1());
    
    258 267
                         getValidatorBuoy2().setBean(getTransmittingBuoy2());
    
    268
    +                    states.addFirstBuoyOwnershipListener(getTransmittingBuoy1());
    
    269
    +                    states.addSecondBuoyOwnershipListener(getTransmittingBuoy2());
    
    259 270
                     }
    
    260 271
                     focusOwner = getTransmittingBuoyType1();
    
    261 272
                     break;
    
    ... ... @@ -273,6 +284,7 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    273 284
             });
    
    274 285
         }
    
    275 286
     
    
    287
    +
    
    276 288
         private void addTransmittingBuoyCoordinate() {
    
    277 289
             Table transmittingBuoy1Editor = getTransmittingBuoy1Editor();
    
    278 290
             if (transmittingBuoy1Editor.getComponentCount() != 13) {
    
    ... ... @@ -292,4 +304,5 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    292 304
                 transmittingBuoy1Editor.add(getComment1(), new GridBagConstraints(0, 5, 2, 1, 0.0, 1.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
    
    293 305
             }
    
    294 306
         }
    
    307
    +
    
    295 308
     }

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/DcpUIModelStates.java
    ... ... @@ -37,6 +37,8 @@ import fr.ird.observe.dto.data.ps.dcp.FloatingObjectPreset;
    37 37
     import fr.ird.observe.dto.data.ps.dcp.FloatingObjectPresetsManager;
    
    38 38
     import fr.ird.observe.dto.data.ps.logbook.TransmittingBuoyDto;
    
    39 39
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    40
    +import fr.ird.observe.dto.referential.common.CountryReference;
    
    41
    +import fr.ird.observe.dto.referential.common.VesselReference;
    
    40 42
     import fr.ird.observe.dto.referential.ps.common.ObjectMaterialDto;
    
    41 43
     import fr.ird.observe.dto.referential.ps.common.ObjectMaterialReference;
    
    42 44
     import fr.ird.observe.dto.referential.ps.common.ObjectOperationReference;
    
    ... ... @@ -44,9 +46,12 @@ import fr.ird.observe.dto.referential.ps.common.TransmittingBuoyOperationReferen
    44 46
     import fr.ird.observe.dto.referential.ps.common.TransmittingBuoyOwnershipReference;
    
    45 47
     import io.ultreia.java4all.bean.JavaBean;
    
    46 48
     import io.ultreia.java4all.jaxx.widgets.combobox.BeanEnumEditor;
    
    49
    +import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
    
    47 50
     import org.apache.logging.log4j.LogManager;
    
    48 51
     import org.apache.logging.log4j.Logger;
    
    49 52
     
    
    53
    +import java.beans.PropertyChangeEvent;
    
    54
    +import java.beans.PropertyChangeListener;
    
    50 55
     import java.util.Collection;
    
    51 56
     import java.util.Date;
    
    52 57
     import java.util.LinkedHashMap;
    
    ... ... @@ -96,6 +101,14 @@ public interface DcpUIModelStates<D extends DataDto & FloatingObjectAware, P ext
    96 101
     
    
    97 102
         Optional<ToolkitIdModifications> consolidate();
    
    98 103
     
    
    104
    +    TransmittingBuoyOwnershipListener<?> getFirstBuoyOwnershipListener();
    
    105
    +
    
    106
    +    void setFirstBuoyOwnershipListener(TransmittingBuoyOwnershipListener<?> firstBuoyOwnershipListener);
    
    107
    +
    
    108
    +    TransmittingBuoyOwnershipListener<?> getSecondBuoyOwnershipListener();
    
    109
    +
    
    110
    +    void setSecondBuoyOwnershipListener(TransmittingBuoyOwnershipListener<?> secondBuoyOwnershipListener);
    
    111
    +
    
    99 112
         default void recomputeComputedValues() {
    
    100 113
             Optional<ToolkitIdModifications> result = consolidate();
    
    101 114
             result.ifPresent(r -> {
    
    ... ... @@ -163,14 +176,16 @@ public interface DcpUIModelStates<D extends DataDto & FloatingObjectAware, P ext
    163 176
     
    
    164 177
         Map<String, ObjectMaterialDto> getReferentialMap();
    
    165 178
     
    
    179
    +    void setReferentialMap(Map<String, ObjectMaterialDto> referentialMap);
    
    180
    +
    
    166 181
         Map<String, TransmittingBuoyOperationReference> getBuoyOperationMap();
    
    167 182
     
    
    183
    +    void setBuoyOperationMap(Map<String, TransmittingBuoyOperationReference> buoyOperationMap);
    
    184
    +
    
    168 185
         default TransmittingBuoyOperationReference getBuoyOperation(String code) {
    
    169 186
             return getBuoyOperationMap().get(code);
    
    170 187
         }
    
    171 188
     
    
    172
    -    void setBuoyOperationMap(Map<String, TransmittingBuoyOperationReference> buoyOperationMap);
    
    173
    -
    
    174 189
         Map<ObjectMaterialDto, String> getWhenArriving();
    
    175 190
     
    
    176 191
         Map<ObjectMaterialDto, String> getWhenLeaving();
    
    ... ... @@ -181,8 +196,6 @@ public interface DcpUIModelStates<D extends DataDto & FloatingObjectAware, P ext
    181 196
             return all.stream().filter(ObjectMaterialDto::withData).collect(Collectors.toSet());
    
    182 197
         }
    
    183 198
     
    
    184
    -    void setReferentialMap(Map<String, ObjectMaterialDto> referentialMap);
    
    185
    -
    
    186 199
         void setWhenArriving(String id, String value);
    
    187 200
     
    
    188 201
         void setWhenLeaving(String id, String value);
    
    ... ... @@ -300,10 +313,6 @@ public interface DcpUIModelStates<D extends DataDto & FloatingObjectAware, P ext
    300 313
     
    
    301 314
             FloatingObjectPreset floatingObjectReference = getReference();
    
    302 315
     
    
    303
    -        // FIXME See why we have to do this
    
    304
    -//        bean.getTransmittingBuoy().clear();
    
    305
    -//        bean.getFloatingObjectPart().clear();
    
    306
    -//        Form<FloatingObjectDto> form = model.openForm(getModel().getStates().getSelectedId());
    
    307 316
             List<TransmittingBuoyOperationReference> referentialReferences = referencesCache.getReferentialReferences(TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OPERATION);
    
    308 317
             setBuoyOperationMap(Maps.uniqueIndex(referentialReferences, TransmittingBuoyOperationReference::getCode));
    
    309 318
     
    
    ... ... @@ -312,8 +321,14 @@ public interface DcpUIModelStates<D extends DataDto & FloatingObjectAware, P ext
    312 321
     
    
    313 322
             openTable.accept(bean.isPersisted() || floatingObjectReference != null);
    
    314 323
     
    
    315
    -        Optional.ofNullable(bean.getFirstBuoy()).ifPresent(b -> b.copy(ui1));
    
    316
    -        Optional.ofNullable(bean.getSecondBuoy()).ifPresent(b -> b.copy(ui2));
    
    324
    +        Optional.ofNullable(bean.getFirstBuoy()).ifPresent(b -> {
    
    325
    +            b.copy(ui1);
    
    326
    +            getFirstBuoyOwnershipListener().apply();
    
    327
    +        });
    
    328
    +        Optional.ofNullable(bean.getSecondBuoy()).ifPresent(b -> {
    
    329
    +            b.copy(ui2);
    
    330
    +            getSecondBuoyOwnershipListener().apply();
    
    331
    +        });
    
    317 332
             getBean().setCanValidateMaterials(true);
    
    318 333
         }
    
    319 334
     
    
    ... ... @@ -322,4 +337,79 @@ public interface DcpUIModelStates<D extends DataDto & FloatingObjectAware, P ext
    322 337
         ReferencesCache getReferenceCache();
    
    323 338
     
    
    324 339
         boolean isCreatingMode();
    
    340
    +
    
    341
    +    default void addFirstBuoyOwnershipListener(TransmittingBuoyAware buoy) {
    
    342
    +        TransmittingBuoyOwnershipListener<?> listener = getFirstBuoyOwnershipListener();
    
    343
    +        buoy.removePropertyChangeListener(TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP, listener);
    
    344
    +        buoy.addPropertyChangeListener(TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP, listener);
    
    345
    +        listener.apply();
    
    346
    +    }
    
    347
    +
    
    348
    +    default void removeFirstBuoyOwnershipListener(TransmittingBuoyAware buoy) {
    
    349
    +        PropertyChangeListener listener = getFirstBuoyOwnershipListener();
    
    350
    +        buoy.removePropertyChangeListener(TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP, listener);
    
    351
    +    }
    
    352
    +
    
    353
    +    default void addSecondBuoyOwnershipListener(TransmittingBuoyAware buoy) {
    
    354
    +        TransmittingBuoyOwnershipListener<?> listener = getSecondBuoyOwnershipListener();
    
    355
    +        buoy.removePropertyChangeListener(TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP, listener);
    
    356
    +        buoy.addPropertyChangeListener(TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP, listener);
    
    357
    +        listener.apply();
    
    358
    +    }
    
    359
    +
    
    360
    +    default void removeSecondBuoyOwnershipListener(TransmittingBuoyAware buoy) {
    
    361
    +        PropertyChangeListener listener = getSecondBuoyOwnershipListener();
    
    362
    +        buoy.removePropertyChangeListener(TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP, listener);
    
    363
    +    }
    
    364
    +
    
    365
    +    class TransmittingBuoyOwnershipListener<T extends TransmittingBuoyAware> implements PropertyChangeListener {
    
    366
    +
    
    367
    +        private final T buoy;
    
    368
    +        private final FilterableComboBox<VesselReference> vessel;
    
    369
    +        private final FilterableComboBox<CountryReference> country;
    
    370
    +
    
    371
    +        public TransmittingBuoyOwnershipListener(T buoy, FilterableComboBox<VesselReference> vessel, FilterableComboBox<CountryReference> country) {
    
    372
    +            this.buoy = buoy;
    
    373
    +            this.vessel = vessel;
    
    374
    +            this.country = country;
    
    375
    +        }
    
    376
    +
    
    377
    +        @Override
    
    378
    +        public void propertyChange(PropertyChangeEvent evt) {
    
    379
    +            TransmittingBuoyOwnershipReference buoyOwnership = (TransmittingBuoyOwnershipReference) evt.getNewValue();
    
    380
    +            apply(buoyOwnership);
    
    381
    +        }
    
    382
    +
    
    383
    +        public void apply() {
    
    384
    +            apply(buoy.getTransmittingBuoyOwnership());
    
    385
    +        }
    
    386
    +
    
    387
    +        private void apply(TransmittingBuoyOwnershipReference buoyOwnership) {
    
    388
    +            boolean enableVessel = true;
    
    389
    +            boolean enableCountry = true;
    
    390
    +            if (buoyOwnership != null) {
    
    391
    +                switch (buoyOwnership.getId()) {
    
    392
    +                    case ProtectedIdsPs.PS_COMMON_TRANSMITTING_BUOY_OWNERSHIP_THIS_SHIP_ID:
    
    393
    +                        enableVessel = false;
    
    394
    +                        enableCountry = false;
    
    395
    +                        break;
    
    396
    +                    case ProtectedIdsPs.PS_COMMON_TRANSMITTING_BUOY_OWNERSHIP_UNKNOWN_ID:
    
    397
    +                        enableVessel = false;
    
    398
    +                        break;
    
    399
    +                }
    
    400
    +            }
    
    401
    +            if (enableVessel) {
    
    402
    +                vessel.setEnabled(true);
    
    403
    +            } else {
    
    404
    +                buoy.setVessel(null);
    
    405
    +                vessel.setEnabled(false);
    
    406
    +            }
    
    407
    +            if (enableCountry) {
    
    408
    +                country.setEnabled(true);
    
    409
    +            } else {
    
    410
    +                buoy.setCountry(null);
    
    411
    +                country.setEnabled(false);
    
    412
    +            }
    
    413
    +        }
    
    414
    +    }
    
    325 415
     }

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/FloatingObjectUICommon.jcss
    ... ... @@ -108,7 +108,6 @@
    108 108
     
    
    109 109
     #transmittingBuoyOwnership1 {
    
    110 110
       property:{TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP};
    
    111
    -  enabled: {!DcpUIModelStates.isBuoyDeployement(transmittingBuoy1.getTransmittingBuoyOperation())}
    
    112 111
     }
    
    113 112
     
    
    114 113
     #country1Label {
    
    ... ... @@ -161,7 +160,6 @@
    161 160
     
    
    162 161
     #transmittingBuoyOwnership2 {
    
    163 162
       property:{TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OWNERSHIP};
    
    164
    -  enabled: {!DcpUIModelStates.isBuoyDeployement(transmittingBuoy2.getTransmittingBuoyOperation())}
    
    165 163
     }
    
    166 164
     
    
    167 165
     #country2Label {
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/FloatingObjectUIHandler.java
    ... ... @@ -55,7 +55,7 @@ public class FloatingObjectUIHandler extends GeneratedFloatingObjectUIHandler {
    55 55
     
    
    56 56
         @Override
    
    57 57
         public void stopEditUI() {
    
    58
    -        ui.stopEditUI();
    
    58
    +        ui.stopEditUI(ui.getModel().getStates());
    
    59 59
             super.stopEditUI();
    
    60 60
         }
    
    61 61
     
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/FloatingObjectUIModelStates.java
    ... ... @@ -66,6 +66,8 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    66 66
         private boolean arriving;
    
    67 67
         private boolean leaving;
    
    68 68
         private FloatingObjectConsolidateEngine consolidateEngine;
    
    69
    +    private TransmittingBuoyOwnershipListener<?> firstBuoyOwnershipListener;
    
    70
    +    private TransmittingBuoyOwnershipListener<?> secondBuoyOwnershipListener;
    
    69 71
     
    
    70 72
         public FloatingObjectUIModelStates(GeneratedFloatingObjectUIModel model) {
    
    71 73
             super(model);
    
    ... ... @@ -78,6 +80,26 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    78 80
             this.simplifiedObjectTypeSpecializedRulesSupplier = SingletonSupplier.of(model.getClientConfig()::getSimplifiedObjectTypeSpecializedRules);
    
    79 81
         }
    
    80 82
     
    
    83
    +    @Override
    
    84
    +    public TransmittingBuoyOwnershipListener<?> getFirstBuoyOwnershipListener() {
    
    85
    +        return firstBuoyOwnershipListener;
    
    86
    +    }
    
    87
    +
    
    88
    +    @Override
    
    89
    +    public void setFirstBuoyOwnershipListener(TransmittingBuoyOwnershipListener<?> firstBuoyOwnershipListener) {
    
    90
    +        this.firstBuoyOwnershipListener = firstBuoyOwnershipListener;
    
    91
    +    }
    
    92
    +
    
    93
    +    @Override
    
    94
    +    public TransmittingBuoyOwnershipListener<?> getSecondBuoyOwnershipListener() {
    
    95
    +        return secondBuoyOwnershipListener;
    
    96
    +    }
    
    97
    +
    
    98
    +    @Override
    
    99
    +    public void setSecondBuoyOwnershipListener(TransmittingBuoyOwnershipListener<?> secondBuoyOwnershipListener) {
    
    100
    +        this.secondBuoyOwnershipListener = secondBuoyOwnershipListener;
    
    101
    +    }
    
    102
    +
    
    81 103
         @Override
    
    82 104
         public Map<String, TransmittingBuoyOperationReference> getBuoyOperationMap() {
    
    83 105
             return buoyOperationMap;
    
    ... ... @@ -141,11 +163,6 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    141 163
             return whenLeaving;
    
    142 164
         }
    
    143 165
     
    
    144
    -    @Override
    
    145
    -    public void setReferentialMap(Map<String, ObjectMaterialDto> referentialMap) {
    
    146
    -        this.referentialMap = referentialMap;
    
    147
    -    }
    
    148
    -
    
    149 166
         @Override
    
    150 167
         public void setWhenArriving(String id, String value) {
    
    151 168
             setWhen0(id, value, whenArriving);
    
    ... ... @@ -230,6 +247,11 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    230 247
             return referentialMap;
    
    231 248
         }
    
    232 249
     
    
    250
    +    @Override
    
    251
    +    public void setReferentialMap(Map<String, ObjectMaterialDto> referentialMap) {
    
    252
    +        this.referentialMap = referentialMap;
    
    253
    +    }
    
    254
    +
    
    233 255
         @Override
    
    234 256
         public String getComputedWhenArrivingBiodegradableValue() {
    
    235 257
             return DcpUIModelStates.super.getComputedWhenArrivingBiodegradableValue();
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/FloatingObjectUIHandler.java
    ... ... @@ -55,7 +55,7 @@ public class FloatingObjectUIHandler extends GeneratedFloatingObjectUIHandler {
    55 55
     
    
    56 56
         @Override
    
    57 57
         public void stopEditUI() {
    
    58
    -        ui.stopEditUI();
    
    58
    +        ui.stopEditUI(ui.getModel().getStates());
    
    59 59
             super.stopEditUI();
    
    60 60
         }
    
    61 61
     
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/FloatingObjectUIModelStates.java
    ... ... @@ -70,6 +70,8 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    70 70
         private boolean arriving;
    
    71 71
         private boolean leaving;
    
    72 72
         private FloatingObjectConsolidateEngine consolidateEngine;
    
    73
    +    private TransmittingBuoyOwnershipListener<?> firstBuoyOwnershipListener;
    
    74
    +    private TransmittingBuoyOwnershipListener<?> secondBuoyOwnershipListener;
    
    73 75
     
    
    74 76
         public FloatingObjectUIModelStates(GeneratedFloatingObjectUIModel model) {
    
    75 77
             super(model);
    
    ... ... @@ -82,6 +84,26 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    82 84
             this.simplifiedObjectTypeSpecializedRulesSupplier = SingletonSupplier.of(model.getClientConfig()::getSimplifiedObjectTypeSpecializedRules);
    
    83 85
         }
    
    84 86
     
    
    87
    +    @Override
    
    88
    +    public TransmittingBuoyOwnershipListener<?> getFirstBuoyOwnershipListener() {
    
    89
    +        return firstBuoyOwnershipListener;
    
    90
    +    }
    
    91
    +
    
    92
    +    @Override
    
    93
    +    public void setFirstBuoyOwnershipListener(TransmittingBuoyOwnershipListener<?> firstBuoyOwnershipListener) {
    
    94
    +        this.firstBuoyOwnershipListener = firstBuoyOwnershipListener;
    
    95
    +    }
    
    96
    +
    
    97
    +    @Override
    
    98
    +    public TransmittingBuoyOwnershipListener<?> getSecondBuoyOwnershipListener() {
    
    99
    +        return secondBuoyOwnershipListener;
    
    100
    +    }
    
    101
    +
    
    102
    +    @Override
    
    103
    +    public void setSecondBuoyOwnershipListener(TransmittingBuoyOwnershipListener<?> secondBuoyOwnershipListener) {
    
    104
    +        this.secondBuoyOwnershipListener = secondBuoyOwnershipListener;
    
    105
    +    }
    
    106
    +
    
    85 107
         @Override
    
    86 108
         public Map<String, TransmittingBuoyOperationReference> getBuoyOperationMap() {
    
    87 109
             return buoyOperationMap;
    
    ... ... @@ -145,11 +167,6 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    145 167
             return whenLeaving;
    
    146 168
         }
    
    147 169
     
    
    148
    -    @Override
    
    149
    -    public void setReferentialMap(Map<String, ObjectMaterialDto> referentialMap) {
    
    150
    -        this.referentialMap = referentialMap;
    
    151
    -    }
    
    152
    -
    
    153 170
         @Override
    
    154 171
         public void setWhenArriving(String id, String value) {
    
    155 172
             setWhen0(id, value, whenArriving);
    
    ... ... @@ -234,6 +251,11 @@ public class FloatingObjectUIModelStates extends GeneratedFloatingObjectUIModelS
    234 251
             return referentialMap;
    
    235 252
         }
    
    236 253
     
    
    254
    +    @Override
    
    255
    +    public void setReferentialMap(Map<String, ObjectMaterialDto> referentialMap) {
    
    256
    +        this.referentialMap = referentialMap;
    
    257
    +    }
    
    258
    +
    
    237 259
         @Override
    
    238 260
         public String getComputedWhenArrivingBiodegradableValue() {
    
    239 261
             return DcpUIModelStates.super.getComputedWhenArrivingBiodegradableValue();
    

  • core/api/dto-decoration/src/main/i18n/getters/labels.getter
    ... ... @@ -1011,6 +1011,7 @@ observe.data.ps.logbook.SampleSpeciesMeasure.count
    1011 1011
     observe.data.ps.logbook.SampleSpeciesMeasure.count.short
    
    1012 1012
     observe.data.ps.logbook.SampleSpeciesMeasure.type
    
    1013 1013
     observe.data.ps.logbook.TransmittingBuoy.code
    
    1014
    +observe.data.ps.logbook.TransmittingBuoy.country
    
    1014 1015
     observe.data.ps.logbook.TransmittingBuoy.type
    
    1015 1016
     observe.data.ps.logbook.Well.action.create
    
    1016 1017
     observe.data.ps.logbook.Well.action.move
    
    ... ... @@ -1233,6 +1234,7 @@ observe.data.ps.observation.SpeciesFateDiscardMode.nullValue
    1233 1234
     observe.data.ps.observation.SpeciesFateDiscardMode.trueValue
    
    1234 1235
     observe.data.ps.observation.SpeciesFateDiscardMode.type
    
    1235 1236
     observe.data.ps.observation.TransmittingBuoy.code
    
    1237
    +observe.data.ps.observation.TransmittingBuoy.country
    
    1236 1238
     observe.data.ps.observation.TransmittingBuoy.type
    
    1237 1239
     observe.referential.MinMaxWeight.maxWeight
    
    1238 1240
     observe.referential.MinMaxWeight.minMaxWeight
    

  • core/api/dto/src/main/java/fr/ird/observe/dto/ProtectedIdsPs.java
    ... ... @@ -33,6 +33,7 @@ import java.util.Set;
    33 33
     //FIXME-PROTECTED-ID
    
    34 34
     public interface ProtectedIdsPs {
    
    35 35
         String PS_COMMON_TRANSMITTING_BUOY_OWNERSHIP_THIS_SHIP_ID = "fr.ird.referential.ps.common.TransmittingBuoyOwnership#0#3";
    
    36
    +    String PS_COMMON_TRANSMITTING_BUOY_OWNERSHIP_UNKNOWN_ID = "fr.ird.referential.ps.common.TransmittingBuoyOwnership#0#0";
    
    36 37
         String PS_COMMON_SCHOOL_TYPE_UNDEFINED_ID = "fr.ird.referential.ps.common.SchoolType#0#0";
    
    37 38
         String PS_COMMON_SCHOOL_TYPE_FREE_ID = "fr.ird.referential.ps.common.SchoolType#0#2";
    
    38 39
         String PS_COMMON_SCHOOL_TYPE_OBJECT_ID = "fr.ird.referential.ps.common.SchoolType#0#1";
    

  • core/persistence/migration/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_3.java
    ... ... @@ -35,19 +35,21 @@ import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExec
    35 35
      * @author Tony Chemit - dev@tchemit.fr
    
    36 36
      * @since 9.3.0
    
    37 37
      */
    
    38
    -//@AutoService(MigrationVersionResource.class)
    
    38
    +@AutoService(MigrationVersionResource.class)
    
    39 39
     public class DataSourceMigrationForVersion_9_3 extends ByMajorMigrationVersionResource {
    
    40 40
     
    
    41 41
         public DataSourceMigrationForVersion_9_3() {
    
    42 42
             super(Version.valueOf("9.3"), false);
    
    43
    -        createResourceScriptVariables(this, "2023-11-15", "2023-09-01 00:00:00.000000");
    
    43
    +        createResourceScriptVariables(this, "2023-12-01", "2023-12-01 00:00:00.000000");
    
    44 44
         }
    
    45 45
     
    
    46
    -
    
    47 46
         @Override
    
    48 47
         public void generateSqlScript(MigrationVersionResourceExecutor executor) {
    
    49 48
             boolean withIds = executor.findSingleResult(SqlQuery.wrap("SELECT COUNT (*) FROM common.person", r -> r.getInt(1) > 0));
    
    50
    -
    
    49
    +        if (withIds) {
    
    50
    +            // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2044
    
    51
    +            executor.addScript("01", "issue-2044");
    
    52
    +        }
    
    51 53
         }
    
    52 54
     
    
    53 55
     }
    

  • core/persistence/migration/src/main/resources/db/migration/v9/9.3/01_issue-2044-common.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- ObServe Core :: Persistence :: Migration
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2008 - 2023 IRD, Ultreia.io
    
    6
    +-- %%
    
    7
    +-- This program is free software: you can redistribute it and/or modify
    
    8
    +-- it under the terms of the GNU General Public License as
    
    9
    +-- published by the Free Software Foundation, either version 3 of the
    
    10
    +-- License, or (at your option) any later version.
    
    11
    +--
    
    12
    +-- This program is distributed in the hope that it will be useful,
    
    13
    +-- but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +-- GNU General Public License for more details.
    
    16
    +--
    
    17
    +-- You should have received a copy of the GNU General Public
    
    18
    +-- License along with this program.  If not, see
    
    19
    +-- <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +-- #L%
    
    21
    +---
    
    22
    +-- Unknown vessel → no vessel
    
    23
    +UPDATE ps_observation.TransmittingBuoy SET vessel = NULL WHERE transmittingBuoyOwnership = 'fr.ird.referential.ps.common.TransmittingBuoyOwnership#0#0';
    
    24
    +UPDATE ps_logbook.TransmittingBuoy SET vessel = NULL WHERE transmittingBuoyOwnership = 'fr.ird.referential.ps.common.TransmittingBuoyOwnership#0#0';
    
    25
    +-- This vessel → no country, nor vessel
    
    26
    +UPDATE ps_observation.TransmittingBuoy SET country = NULL, vessel = NULL WHERE transmittingBuoyOwnership = 'fr.ird.referential.ps.common.TransmittingBuoyOwnership#0#3';
    
    27
    +UPDATE ps_logbook.TransmittingBuoy SET country = NULL, vessel = NULL WHERE transmittingBuoyOwnership = 'fr.ird.referential.ps.common.TransmittingBuoyOwnership#0#3';

  • core/services/i18n/src/main/i18n/translations/services_en_GB.properties
    ... ... @@ -1222,6 +1222,7 @@ observe.data.ps.logbook.SampleSpeciesMeasure.count=Count
    1222 1222
     observe.data.ps.logbook.SampleSpeciesMeasure.count.short=Count
    
    1223 1223
     observe.data.ps.logbook.SampleSpeciesMeasure.type=Sample species measure
    
    1224 1224
     observe.data.ps.logbook.TransmittingBuoy.code=Code
    
    1225
    +observe.data.ps.logbook.TransmittingBuoy.country=Flag country
    
    1225 1226
     observe.data.ps.logbook.TransmittingBuoy.type=Transmitting buoy
    
    1226 1227
     observe.data.ps.logbook.Well.action.create=Next well
    
    1227 1228
     observe.data.ps.logbook.Well.action.move=Change trip
    
    ... ... @@ -1496,6 +1497,7 @@ observe.data.ps.observation.SpeciesFateDiscardMode.nullValue=Unknown
    1496 1497
     observe.data.ps.observation.SpeciesFateDiscardMode.trueValue=Discarded
    
    1497 1498
     observe.data.ps.observation.SpeciesFateDiscardMode.type=Species fate discard mode
    
    1498 1499
     observe.data.ps.observation.TransmittingBuoy.code=Code
    
    1500
    +observe.data.ps.observation.TransmittingBuoy.country=Flag country
    
    1499 1501
     observe.data.ps.observation.TransmittingBuoy.type=Transmitting buoy
    
    1500 1502
     observe.data.ps.pairing.ActivityPairingResultItem.computedDistance=Distance (km)
    
    1501 1503
     observe.data.ps.pairing.ActivityPairingResultItem.computedTime=Time shift (days\:hours\:minutes)
    

  • core/services/i18n/src/main/i18n/translations/services_es_ES.properties
    ... ... @@ -1222,6 +1222,7 @@ observe.data.ps.logbook.SampleSpeciesMeasure.count=Count \#TODO
    1222 1222
     observe.data.ps.logbook.SampleSpeciesMeasure.count.short=Count
    
    1223 1223
     observe.data.ps.logbook.SampleSpeciesMeasure.type=Sample species measure
    
    1224 1224
     observe.data.ps.logbook.TransmittingBuoy.code=Identificación
    
    1225
    +observe.data.ps.logbook.TransmittingBuoy.country=Bandera
    
    1225 1226
     observe.data.ps.logbook.TransmittingBuoy.type=TransmittingBuoy
    
    1226 1227
     observe.data.ps.logbook.Well.action.create=Next well
    
    1227 1228
     observe.data.ps.logbook.Well.action.move=Change trip
    
    ... ... @@ -1496,6 +1497,7 @@ observe.data.ps.observation.SpeciesFateDiscardMode.nullValue=Unknown
    1496 1497
     observe.data.ps.observation.SpeciesFateDiscardMode.trueValue=Discarded
    
    1497 1498
     observe.data.ps.observation.SpeciesFateDiscardMode.type=Species fate discard mode
    
    1498 1499
     observe.data.ps.observation.TransmittingBuoy.code=Identificación
    
    1500
    +observe.data.ps.observation.TransmittingBuoy.country=Bandera
    
    1499 1501
     observe.data.ps.observation.TransmittingBuoy.type=TransmittingBuoy
    
    1500 1502
     observe.data.ps.pairing.ActivityPairingResultItem.computedDistance=Distance (km) \#TODO
    
    1501 1503
     observe.data.ps.pairing.ActivityPairingResultItem.computedTime=Time shift (days\:hours\:minutes) \#TODO
    

  • core/services/i18n/src/main/i18n/translations/services_fr_FR.properties
    ... ... @@ -1222,6 +1222,7 @@ observe.data.ps.logbook.SampleSpeciesMeasure.count=Effectif
    1222 1222
     observe.data.ps.logbook.SampleSpeciesMeasure.count.short=Effectif
    
    1223 1223
     observe.data.ps.logbook.SampleSpeciesMeasure.type=Mesure d'un échantillon espèce
    
    1224 1224
     observe.data.ps.logbook.TransmittingBuoy.code=Identifiant
    
    1225
    +observe.data.ps.logbook.TransmittingBuoy.country=Pavillon
    
    1225 1226
     observe.data.ps.logbook.TransmittingBuoy.type=Balise émettrice
    
    1226 1227
     observe.data.ps.logbook.Well.action.create=Cuve suivante
    
    1227 1228
     observe.data.ps.logbook.Well.action.move=Changer de marée
    
    ... ... @@ -1496,6 +1497,7 @@ observe.data.ps.observation.SpeciesFateDiscardMode.nullValue=Inconnu
    1496 1497
     observe.data.ps.observation.SpeciesFateDiscardMode.trueValue=Rejeté
    
    1497 1498
     observe.data.ps.observation.SpeciesFateDiscardMode.type=Mode de rejet (du devenir)
    
    1498 1499
     observe.data.ps.observation.TransmittingBuoy.code=Identifiant
    
    1500
    +observe.data.ps.observation.TransmittingBuoy.country=Pavillon
    
    1499 1501
     observe.data.ps.observation.TransmittingBuoy.type=Balise émettrice
    
    1500 1502
     observe.data.ps.pairing.ActivityPairingResultItem.computedDistance=Distance (km)
    
    1501 1503
     observe.data.ps.pairing.ActivityPairingResultItem.computedTime=Écart de temps (jours\:heures\:minutes)
    

  • model/src/main/models/Observe/dto/class/i18nOverrideLabels.properties
    ... ... @@ -23,8 +23,10 @@ data.ll.common.Trip=species
    23 23
     data.ll.landing.Landing=vessel
    
    24 24
     data.ps.localmarket.Sample=well
    
    25 25
     data.ps.logbook.Catch=weightMeasureMethod.validation.required
    
    26
    +data.ps.logbook.TransmittingBuoy=country
    
    26 27
     data.ps.observation.Catch=minWeight,maxWeight,minMaxWeight,weightMeasureMethod
    
    27 28
     data.ps.observation.SchoolEstimate=species
    
    28 29
     data.ps.observation.Set=startTime,haulingStartTimeStamp,haulingEndTimeStamp,endTimeStamp
    
    30
    +data.ps.observation.TransmittingBuoy=country
    
    29 31
     referential.common.Species=codeAndHomeId
    
    30 32
     referential.ps.common.AcquisitionStatus=observation,logbook,landing,localMarket

  • pom.xml
    ... ... @@ -93,9 +93,9 @@
    93 93
         <model.persistence.defaultPackage>fr.ird.observe.entities</model.persistence.defaultPackage>
    
    94 94
         <model.persistence.fullPackagePath>fr.ird.observe</model.persistence.fullPackagePath>
    
    95 95
         <!--persistence model version-->
    
    96
    -    <persistence.model.version>9.2</persistence.model.version>
    
    96
    +    <persistence.model.version>9.3</persistence.model.version>
    
    97 97
         <!--persistence previous model version used for tck migration-->
    
    98
    -    <persistence.previous.model.version>9.1</persistence.previous.model.version>
    
    98
    +    <persistence.previous.model.version>9.2</persistence.previous.model.version>
    
    99 99
         <tck.filename>tck-v${persistence.model.version}.zip</tck.filename>
    
    100 100
         <tck.updated.filename>updated-${tck.filename}</tck.updated.filename>
    
    101 101
         <tck.remote.path>/var/www/html/private/ird-observe/tck</tck.remote.path>