Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 6ea068cb by Tony Chemit at 2023-02-07T12:23:16+01:00 AVDTH - Use ObjectOperation states to find out where to add materials (whenArriving/whenLeaving) instead of asking AVDTH for a such mapping... - - - - - f585d278 by Tony Chemit at 2023-02-07T12:23:54+01:00 AVDTH - Bad TransmittingBuoyType fallback code (should be 99 but was 999) - - - - - 1 changed file: - core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/FloatingObjectReader.java 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> { .put("40", "4") // Perte | 4 Perte signal .put("41", "5") // Arret commandé de la transmission | 5 Fin d'utilisation .build(); - /** - * Is floatingObjectPart on leaving from avdth ACTIVITE.C_OPERA. - */ - public static final Set<String> WHEN_LEAVING_CODE = Set.of("5", "23", "31", "32"); - /** - * Is floatingObjectPart on arriving from avdth ACTIVITE.C_OPERA. - */ - public static final Set<String> WHEN_ARRIVING_CODE = Set.of( - "0", - "1", - "2", - "3", - "4", - "6", - "7", - "8", - "9", - "10", - "12", - "13", - "14", - "15", - "22", - "24", - "25", - "26", - "29", - "30", - "31", - "32", - "33", - "34", - "40", - "41"); /** * To get TransmittingBuoy.TransmittingBuoyType code from avdth ACTIVITE.C_TYP_BALISE code. */ @@ -363,6 +329,7 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { vesselActivityCode, objectTypeCode, observedSystemCodes, + objectOperation, entity, floatingObjectExistsInAvdth, buoyExistsInAvdth); @@ -386,11 +353,12 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { String vesselActivityCode, String objectTypeCode, Set<String> observedSystemCodes, + ObjectOperation objectOperation, FloatingObject entity, boolean floatingObjectExistsInAvdth, boolean buoyExistsInAvdth) throws SQLException { - boolean whenArriving = WHEN_ARRIVING_CODE.contains(vesselActivityCode); - boolean whenLeaving = WHEN_LEAVING_CODE.contains(vesselActivityCode); + boolean whenArriving = objectOperation.isWhenArriving(); + boolean whenLeaving = objectOperation.isWhenLeaving(); // to add default material if there is a declared buoy (but no floating object declared) // and no object material created by ObservedSystem, we will then add a standalone buoy @@ -563,7 +531,7 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { private TransmittingBuoyType getTransmittingBuoyTypeByBuoyTypeCode(ImportDataContext dataContext, String buoyTypeCode) { String transmittingBuoyTypeCode = TRANSMITTING_BUOY_TYPE_CODE_MAPPING.get(buoyTypeCode); if (transmittingBuoyTypeCode == null) { - transmittingBuoyTypeCode = "999"; + transmittingBuoyTypeCode = "99"; } TransmittingBuoyType transmittingBuoyType = dataContext.getTransmittingBuoyType(transmittingBuoyTypeCode); return Objects.requireNonNull(transmittingBuoyType, String.format("Can't find transmittingBuoyType with code: %s", buoyTypeCode)); View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/92ed62561da00e0d2a7188786... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/92ed62561da00e0d2a7188786... You're receiving this email because of your account on gitlab.com.