Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe Commits: efb91ec2 by Tony Chemit at 2022-12-05T21:48:51+01:00 AVDTH - Gestion de la propriété de la balise en situation de migration AVDTH - Closes #2569 - - - - - 2 changed files: - core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/ImportReferentialContext.java - core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/FloatingObjectReader.java Changes: ===================================== core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/data/ImportReferentialContext.java ===================================== @@ -554,8 +554,11 @@ public class ImportReferentialContext { return Objects.requireNonNull(transmittingBuoyType, String.format("Can't find transmittingBuoyType with code: %s", buoyTypeCode)); } - public TransmittingBuoyOwnership getTransmittingBuoyOwnershipByVesselActivityCode(String vesselActivityCode) { - String transmittingBuoyOwnershipCode = FloatingObjectReader.TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING.get(vesselActivityCode); + public TransmittingBuoyOwnership getTransmittingBuoyOwnership(String buoyOwnershipCode) { + if (buoyOwnershipCode == null) { + return null; + } + String transmittingBuoyOwnershipCode = FloatingObjectReader.TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING.get(buoyOwnershipCode); if (transmittingBuoyOwnershipCode == null) { return null; } ===================================== 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> { .put("26", "2") // Visite | 2 Récupération | W_ARRIVING | .put("29", "1") // Visite | 1 Visite | W_ARRIVING | .put("32", "3") // Modif ou renfor | 3 Mise à l'eau | W_ARR + W_LEA | - .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 + .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 .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' // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2568 - .put("40", "4") // Perte | 4 Perte signal | W_ARRIVING | rattacher cette balise à un FOB de type '1-1 DFAD' + appartenance 3 - Ce bateau - .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 + .put("40", "4") // Perte | 4 Perte signal | W_ARRIVING | rattacher cette balise à un FOB de type '1-1 DFAD' + .put("41", "5") // Arret commandé de la transmission | 5 Fin d'utilisation | W_ARRIVING | rattacher cette balise à un FOB de type '1-1 DFAD' .build(); /** * Is floatingObjectPart on leaving from avdth ACTIVITE.C_OPERA. @@ -193,13 +193,13 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { .put("99", "99") .build(); /** - * To get TransmittingBuoy.transmittingBuoyOwnership code from avdth ACTIVITE.C_OPERA code. + * To get TransmittingBuoy.transmittingBuoyOwnership code from avdth ACTIVITE.F_PROP_BALISE code. + * <p> + * See <a href="https://gitlab.com/ultreiaio/ird-observe/-/issues/2569">issue 2569</a> */ public static final Map<String, String> TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING = Map.of( - "33", "3", - "40", "3", - "41", "3" - ); + "1", "0", + "2", "3"); /** * To get associated observedSystem code from avdth ACTIVITE.C_TYP_OBJET code. */ @@ -257,8 +257,7 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { } //FIXME 29 - F_DCP_ECO // int dcpEcoCode = resultSet.getInt(29); - //FIXME 30 - F_PROP_BALISE -// String buoyCode = resultSet.getString(30); + String buoyOwnershipCode = resultSet.getString(30); String buoyTypeCode = resultSet.getString(31); if (buoyTypeCode == null) { //FIXME should fail? @@ -335,10 +334,8 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { transmittingBuoy.setLatitude(dataContext.getActivity().getLatitude()); transmittingBuoy.setLongitude(dataContext.getActivity().getLongitude()); } - TransmittingBuoyOwnership transmittingBuoyOwnership = dataContext.getTransmittingBuoyOwnershipByVesselActivityCode(vesselActivityCode); - if (transmittingBuoyOwnership != null) { - transmittingBuoy.setTransmittingBuoyOwnership(transmittingBuoyOwnership); - } + TransmittingBuoyOwnership transmittingBuoyOwnership = dataContext.getTransmittingBuoyOwnership(buoyOwnershipCode); + transmittingBuoy.setTransmittingBuoyOwnership(transmittingBuoyOwnership); entity.addTransmittingBuoy(transmittingBuoy); } } else if (addBuoyFromObservedSystem) { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/efb91ec278cd5b5185c3837bf1... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/efb91ec278cd5b5185c3837bf1... You're receiving this email because of your account on gitlab.com.