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

Commits:

2 changed files:

Changes:

  • core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/ImportReferentialContext.java
    ... ... @@ -554,8 +554,11 @@ public class ImportReferentialContext {
    554 554
             return Objects.requireNonNull(transmittingBuoyType, String.format("Can't find transmittingBuoyType with code: %s", buoyTypeCode));
    
    555 555
         }
    
    556 556
     
    
    557
    -    public TransmittingBuoyOwnership getTransmittingBuoyOwnershipByVesselActivityCode(String vesselActivityCode) {
    
    558
    -        String transmittingBuoyOwnershipCode = FloatingObjectReader.TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING.get(vesselActivityCode);
    
    557
    +    public TransmittingBuoyOwnership getTransmittingBuoyOwnership(String buoyOwnershipCode) {
    
    558
    +        if (buoyOwnershipCode == null) {
    
    559
    +            return null;
    
    560
    +        }
    
    561
    +        String transmittingBuoyOwnershipCode = FloatingObjectReader.TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING.get(buoyOwnershipCode);
    
    559 562
             if (transmittingBuoyOwnershipCode == null) {
    
    560 563
                 return null;
    
    561 564
             }
    

  • core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/FloatingObjectReader.java
    ... ... @@ -108,11 +108,11 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    108 108
                 .put("26", "2") // Visite          | 2 Récupération         | W_ARRIVING    |
    
    109 109
                 .put("29", "1") // Visite          | 1 Visite               | W_ARRIVING    |
    
    110 110
                 .put("32", "3") // Modif ou renfor | 3 Mise à l'eau         | W_ARR + W_LEA |
    
    111
    -            .put("33", "4") // Perte           | 4 Perte signal         | W_ARRIVING    | codes 11 et 4 à créer ; matériaux sur W_ARRIVING par convention, comme pour Visite + appartenance 3 - Ce bateau
    
    111
    +            .put("33", "4") // Perte           | 4 Perte signal         | W_ARRIVING    | codes 11 et 4 à créer ; matériaux sur W_ARRIVING par convention, comme pour Visite
    
    112 112
                 .put("34", "2") // Retrait         | 2 Récupération         | W_ARRIVING    | rattacher cette balise à un FOB de type '2-2-4-4 Bouée émettrice seule'
    
    113 113
                 // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2568
    
    114
    -            .put("40", "4") // Perte           | 4 Perte signal         | W_ARRIVING    | rattacher cette balise à un FOB de type '1-1 DFAD' + appartenance 3 - Ce bateau
    
    115
    -            .put("41", "5") // Arret commandé de la transmission  | 5 Fin d'utilisation | W_ARRIVING    | rattacher cette balise à un FOB de type '1-1 DFAD' + appartenance 3 - Ce bateau
    
    114
    +            .put("40", "4") // Perte           | 4 Perte signal         | W_ARRIVING    | rattacher cette balise à un FOB de type '1-1 DFAD'
    
    115
    +            .put("41", "5") // Arret commandé de la transmission  | 5 Fin d'utilisation | W_ARRIVING    | rattacher cette balise à un FOB de type '1-1 DFAD'
    
    116 116
                 .build();
    
    117 117
         /**
    
    118 118
          * Is floatingObjectPart on leaving from avdth ACTIVITE.C_OPERA.
    
    ... ... @@ -193,13 +193,13 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    193 193
                 .put("99", "99")
    
    194 194
                 .build();
    
    195 195
         /**
    
    196
    -     * To get TransmittingBuoy.transmittingBuoyOwnership code from avdth ACTIVITE.C_OPERA code.
    
    196
    +     * To get TransmittingBuoy.transmittingBuoyOwnership code from avdth ACTIVITE.F_PROP_BALISE code.
    
    197
    +     * <p>
    
    198
    +     * See <a href="https://gitlab.com/ultreiaio/ird-observe/-/issues/2569">issue 2569</a>
    
    197 199
          */
    
    198 200
         public static final Map<String, String> TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING = Map.of(
    
    199
    -            "33", "3",
    
    200
    -            "40", "3",
    
    201
    -            "41", "3"
    
    202
    -    );
    
    201
    +            "1", "0",
    
    202
    +            "2", "3");
    
    203 203
         /**
    
    204 204
          * To get associated observedSystem code from avdth ACTIVITE.C_TYP_OBJET code.
    
    205 205
          */
    
    ... ... @@ -257,8 +257,7 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    257 257
             }
    
    258 258
             //FIXME 29 - F_DCP_ECO
    
    259 259
     //        int dcpEcoCode = resultSet.getInt(29);
    
    260
    -        //FIXME 30 - F_PROP_BALISE
    
    261
    -//        String buoyCode = resultSet.getString(30);
    
    260
    +        String buoyOwnershipCode = resultSet.getString(30);
    
    262 261
             String buoyTypeCode = resultSet.getString(31);
    
    263 262
             if (buoyTypeCode == null) {
    
    264 263
                 //FIXME should fail?
    
    ... ... @@ -335,10 +334,8 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    335 334
                         transmittingBuoy.setLatitude(dataContext.getActivity().getLatitude());
    
    336 335
                         transmittingBuoy.setLongitude(dataContext.getActivity().getLongitude());
    
    337 336
                     }
    
    338
    -                TransmittingBuoyOwnership transmittingBuoyOwnership = dataContext.getTransmittingBuoyOwnershipByVesselActivityCode(vesselActivityCode);
    
    339
    -                if (transmittingBuoyOwnership != null) {
    
    340
    -                    transmittingBuoy.setTransmittingBuoyOwnership(transmittingBuoyOwnership);
    
    341
    -                }
    
    337
    +                TransmittingBuoyOwnership transmittingBuoyOwnership = dataContext.getTransmittingBuoyOwnership(buoyOwnershipCode);
    
    338
    +                transmittingBuoy.setTransmittingBuoyOwnership(transmittingBuoyOwnership);
    
    342 339
                     entity.addTransmittingBuoy(transmittingBuoy);
    
    343 340
                 }
    
    344 341
             } else if (addBuoyFromObservedSystem) {