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

Commits:

1 changed file:

Changes:

  • core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/FloatingObjectReader.java
    ... ... @@ -132,40 +132,6 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    132 132
                 .put("40", "4") // Perte           | 4 Perte signal
    
    133 133
                 .put("41", "5") // Arret commandé de la transmission  | 5 Fin d'utilisation
    
    134 134
                 .build();
    
    135
    -    /**
    
    136
    -     * Is floatingObjectPart on leaving from avdth ACTIVITE.C_OPERA.
    
    137
    -     */
    
    138
    -    public static final Set<String> WHEN_LEAVING_CODE = Set.of("5", "23", "31", "32");
    
    139
    -    /**
    
    140
    -     * Is floatingObjectPart on arriving from avdth ACTIVITE.C_OPERA.
    
    141
    -     */
    
    142
    -    public static final Set<String> WHEN_ARRIVING_CODE = Set.of(
    
    143
    -            "0",
    
    144
    -            "1",
    
    145
    -            "2",
    
    146
    -            "3",
    
    147
    -            "4",
    
    148
    -            "6",
    
    149
    -            "7",
    
    150
    -            "8",
    
    151
    -            "9",
    
    152
    -            "10",
    
    153
    -            "12",
    
    154
    -            "13",
    
    155
    -            "14",
    
    156
    -            "15",
    
    157
    -            "22",
    
    158
    -            "24",
    
    159
    -            "25",
    
    160
    -            "26",
    
    161
    -            "29",
    
    162
    -            "30",
    
    163
    -            "31",
    
    164
    -            "32",
    
    165
    -            "33",
    
    166
    -            "34",
    
    167
    -            "40",
    
    168
    -            "41");
    
    169 135
         /**
    
    170 136
          * To get TransmittingBuoy.TransmittingBuoyType code from avdth ACTIVITE.C_TYP_BALISE code.
    
    171 137
          */
    
    ... ... @@ -363,6 +329,7 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    363 329
                                                                            vesselActivityCode,
    
    364 330
                                                                            objectTypeCode,
    
    365 331
                                                                            observedSystemCodes,
    
    332
    +                                                                       objectOperation,
    
    366 333
                                                                            entity,
    
    367 334
                                                                            floatingObjectExistsInAvdth,
    
    368 335
                                                                            buoyExistsInAvdth);
    
    ... ... @@ -386,11 +353,12 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    386 353
                                                    String vesselActivityCode,
    
    387 354
                                                    String objectTypeCode,
    
    388 355
                                                    Set<String> observedSystemCodes,
    
    356
    +                                               ObjectOperation objectOperation,
    
    389 357
                                                    FloatingObject entity,
    
    390 358
                                                    boolean floatingObjectExistsInAvdth,
    
    391 359
                                                    boolean buoyExistsInAvdth) throws SQLException {
    
    392
    -        boolean whenArriving = WHEN_ARRIVING_CODE.contains(vesselActivityCode);
    
    393
    -        boolean whenLeaving = WHEN_LEAVING_CODE.contains(vesselActivityCode);
    
    360
    +        boolean whenArriving = objectOperation.isWhenArriving();
    
    361
    +        boolean whenLeaving = objectOperation.isWhenLeaving();
    
    394 362
     
    
    395 363
             // to add default material if there is a declared buoy (but no floating object declared)
    
    396 364
             // and no object material created by ObservedSystem, we will then add a standalone buoy
    
    ... ... @@ -563,7 +531,7 @@ public class FloatingObjectReader extends DataReader<FloatingObject> {
    563 531
         private TransmittingBuoyType getTransmittingBuoyTypeByBuoyTypeCode(ImportDataContext dataContext, String buoyTypeCode) {
    
    564 532
             String transmittingBuoyTypeCode = TRANSMITTING_BUOY_TYPE_CODE_MAPPING.get(buoyTypeCode);
    
    565 533
             if (transmittingBuoyTypeCode == null) {
    
    566
    -            transmittingBuoyTypeCode = "999";
    
    534
    +            transmittingBuoyTypeCode = "99";
    
    567 535
             }
    
    568 536
             TransmittingBuoyType transmittingBuoyType = dataContext.getTransmittingBuoyType(transmittingBuoyTypeCode);
    
    569 537
             return Objects.requireNonNull(transmittingBuoyType, String.format("Can't find transmittingBuoyType with code: %s", buoyTypeCode));