Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe
Commits:
-
63e0cfb5
by Tony Chemit at 2022-12-05T13:55:28+01:00
5 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
- core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/referential/AvdthReferentialImportContext.java
- core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/referential/AvdthReferentialImportResult.java
- core/persistence/resources/src/main/java/fr/ird/observe/persistence/avdth/referential/interceptors/VesselActivityInterceptor.java
Changes:
| ... | ... | @@ -46,6 +46,7 @@ import fr.ird.observe.entities.referential.ps.common.SampleType; |
| 46 | 46 | import fr.ird.observe.entities.referential.ps.common.SchoolType;
|
| 47 | 47 | import fr.ird.observe.entities.referential.ps.common.SpeciesFate;
|
| 48 | 48 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOperation;
|
| 49 | +import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOwnership;
|
|
| 49 | 50 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyType;
|
| 50 | 51 | import fr.ird.observe.entities.referential.ps.common.VesselActivity;
|
| 51 | 52 | import fr.ird.observe.entities.referential.ps.common.WeightCategory;
|
| ... | ... | @@ -99,6 +100,7 @@ public class ImportReferentialContext { |
| 99 | 100 | private Map<String, ObservedSystem> observedSystem;
|
| 100 | 101 | private Map<String, ObjectOperation> objectOperation;
|
| 101 | 102 | private Map<String, TransmittingBuoyOperation> transmittingBuoyOperation;
|
| 103 | + private Map<String, TransmittingBuoyOwnership> transmittingBuoyOwnership;
|
|
| 102 | 104 | private Map<String, TransmittingBuoyType> transmittingBuoyType;
|
| 103 | 105 | private Map<String, SampleQuality> sampleQuality;
|
| 104 | 106 | private Map<String, SampleType> sampleType;
|
| ... | ... | @@ -213,6 +215,7 @@ public class ImportReferentialContext { |
| 213 | 215 | Map<String, ObjectMaterial> objectMaterial = Maps.uniqueIndex(referential.getObjectMaterial(), ObjectMaterial::getTopiaId);
|
| 214 | 216 | transmittingBuoyOperation = Maps.uniqueIndex(referential.getTransmittingBuoyOperation(), TransmittingBuoyOperation::getCode);
|
| 215 | 217 | transmittingBuoyOperation1 = transmittingBuoyOperation.get("1");
|
| 218 | + transmittingBuoyOwnership = Maps.uniqueIndex(referential.getTransmittingBuoyOwnership(), TransmittingBuoyOwnership::getCode);
|
|
| 216 | 219 | transmittingBuoyType = Maps.uniqueIndex(referential.getTransmittingBuoyType(), TransmittingBuoyType::getCode);
|
| 217 | 220 | transmittingBuoyType98 = transmittingBuoyType.get("98");
|
| 218 | 221 | objectMaterialFOB = objectMaterial.get("fr.ird.referential.ps.common.ObjectMaterial#0#1.3");
|
| ... | ... | @@ -551,6 +554,14 @@ public class ImportReferentialContext { |
| 551 | 554 | return Objects.requireNonNull(transmittingBuoyType, String.format("Can't find transmittingBuoyType with code: %s", buoyTypeCode));
|
| 552 | 555 | }
|
| 553 | 556 | |
| 557 | + public TransmittingBuoyOwnership getTransmittingBuoyOwnershipByVesselActivityCode(String vesselActivityCode) {
|
|
| 558 | + String transmittingBuoyOwnershipCode = FloatingObjectReader.TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING.get(vesselActivityCode);
|
|
| 559 | + if (transmittingBuoyOwnershipCode == null) {
|
|
| 560 | + return null;
|
|
| 561 | + }
|
|
| 562 | + return transmittingBuoyOwnership.get(transmittingBuoyOwnershipCode);
|
|
| 563 | + }
|
|
| 564 | + |
|
| 554 | 565 | public ObservedSystem getObservedSystem(String objectTypeCode, String buoyTypeCode) {
|
| 555 | 566 | if (objectTypeCode.equals("999")) {
|
| 556 | 567 | if (buoyTypeCode.equals("999")) {
|
| ... | ... | @@ -30,6 +30,7 @@ import fr.ird.observe.entities.referential.ps.common.ObjectMaterial; |
| 30 | 30 | import fr.ird.observe.entities.referential.ps.common.ObjectOperation;
|
| 31 | 31 | import fr.ird.observe.entities.referential.ps.common.ObservedSystem;
|
| 32 | 32 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOperation;
|
| 33 | +import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOwnership;
|
|
| 33 | 34 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyType;
|
| 34 | 35 | import fr.ird.observe.entities.referential.ps.common.VesselActivity;
|
| 35 | 36 | import fr.ird.observe.persistence.avdth.data.DataReader;
|
| ... | ... | @@ -80,6 +81,9 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 80 | 81 | .put("32", "8")
|
| 81 | 82 | .put("33", "11")
|
| 82 | 83 | .put("34", "4")
|
| 84 | + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2568
|
|
| 85 | + .put("40", "11")
|
|
| 86 | + .put("41", "11")
|
|
| 83 | 87 | .build();
|
| 84 | 88 | /**
|
| 85 | 89 | * To get TransmittingBuoy.TransmittingBuoyOperation code from avdth ACTIVITE.C_OPERA code.
|
| ... | ... | @@ -104,8 +108,11 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 104 | 108 | .put("26", "2") // Visite | 2 Récupération | W_ARRIVING |
|
| 105 | 109 | .put("29", "1") // Visite | 1 Visite | W_ARRIVING |
|
| 106 | 110 | .put("32", "3") // Modif ou renfor | 3 Mise à l'eau | W_ARR + W_LEA |
|
| 107 | - .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
|
|
| 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
|
|
| 108 | 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 | + // 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
|
|
| 109 | 116 | .build();
|
| 110 | 117 | /**
|
| 111 | 118 | * Is floatingObjectPart on leaving from avdth ACTIVITE.C_OPERA.
|
| ... | ... | @@ -135,7 +142,9 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 135 | 142 | "31",
|
| 136 | 143 | "32",
|
| 137 | 144 | "33",
|
| 138 | - "34");
|
|
| 145 | + "34",
|
|
| 146 | + "40",
|
|
| 147 | + "41");
|
|
| 139 | 148 | /**
|
| 140 | 149 | * To get TransmittingBuoy.TransmittingBuoyType code from avdth ACTIVITE.C_TYP_BALISE code.
|
| 141 | 150 | */
|
| ... | ... | @@ -183,6 +192,14 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 183 | 192 | .put("98", "99")
|
| 184 | 193 | .put("99", "99")
|
| 185 | 194 | .build();
|
| 195 | + /**
|
|
| 196 | + * To get TransmittingBuoy.transmittingBuoyOwnership code from avdth ACTIVITE.C_OPERA code.
|
|
| 197 | + */
|
|
| 198 | + public static final Map<String, String> TRANSMITTING_BUOY_OWNERSHIP_CODE_MAPPING = Map.of(
|
|
| 199 | + "33", "3",
|
|
| 200 | + "40", "3",
|
|
| 201 | + "41", "3"
|
|
| 202 | + );
|
|
| 186 | 203 | /**
|
| 187 | 204 | * To get associated observedSystem code from avdth ACTIVITE.C_TYP_OBJET code.
|
| 188 | 205 | */
|
| ... | ... | @@ -318,6 +335,10 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 318 | 335 | transmittingBuoy.setLatitude(dataContext.getActivity().getLatitude());
|
| 319 | 336 | transmittingBuoy.setLongitude(dataContext.getActivity().getLongitude());
|
| 320 | 337 | }
|
| 338 | + TransmittingBuoyOwnership transmittingBuoyOwnership = dataContext.getTransmittingBuoyOwnershipByVesselActivityCode(vesselActivityCode);
|
|
| 339 | + if (transmittingBuoyOwnership != null) {
|
|
| 340 | + transmittingBuoy.setTransmittingBuoyOwnership(transmittingBuoyOwnership);
|
|
| 341 | + }
|
|
| 321 | 342 | entity.addTransmittingBuoy(transmittingBuoy);
|
| 322 | 343 | }
|
| 323 | 344 | } else if (addBuoyFromObservedSystem) {
|
| ... | ... | @@ -22,7 +22,6 @@ package fr.ird.observe.persistence.avdth.referential; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | -import fr.ird.observe.services.service.data.ps.AvdthReferentialImportConfiguration;
|
|
| 26 | 25 | import fr.ird.observe.entities.ObserveTopiaApplicationContext;
|
| 27 | 26 | import fr.ird.observe.entities.ObserveTopiaPersistenceContext;
|
| 28 | 27 | import fr.ird.observe.entities.referential.ReferentialEntity;
|
| ... | ... | @@ -44,6 +43,7 @@ import fr.ird.observe.entities.referential.ps.common.SampleType; |
| 44 | 43 | import fr.ird.observe.entities.referential.ps.common.SchoolType;
|
| 45 | 44 | import fr.ird.observe.entities.referential.ps.common.SpeciesFate;
|
| 46 | 45 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOperation;
|
| 46 | +import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOwnership;
|
|
| 47 | 47 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyType;
|
| 48 | 48 | import fr.ird.observe.entities.referential.ps.common.VesselActivity;
|
| 49 | 49 | import fr.ird.observe.entities.referential.ps.common.WeightCategory;
|
| ... | ... | @@ -66,11 +66,12 @@ import fr.ird.observe.persistence.avdth.referential.interceptors.TransmittingBuo |
| 66 | 66 | import fr.ird.observe.persistence.avdth.referential.interceptors.VesseInterceptor;
|
| 67 | 67 | import fr.ird.observe.persistence.avdth.referential.interceptors.VesselActivityInterceptor;
|
| 68 | 68 | import fr.ird.observe.persistence.avdth.referential.interceptors.WeightCategoryInterceptor;
|
| 69 | +import fr.ird.observe.services.service.data.ps.AvdthReferentialImportConfiguration;
|
|
| 69 | 70 | import fr.ird.observe.spi.context.ReferentialDtoEntityContext;
|
| 70 | 71 | import fr.ird.observe.spi.decoration.DecoratorService;
|
| 72 | +import io.ultreia.java4all.util.sql.SqlScriptWriter;
|
|
| 71 | 73 | import org.apache.logging.log4j.LogManager;
|
| 72 | 74 | import org.apache.logging.log4j.Logger;
|
| 73 | -import io.ultreia.java4all.util.sql.SqlScriptWriter;
|
|
| 74 | 75 | |
| 75 | 76 | import java.io.Closeable;
|
| 76 | 77 | import java.io.IOException;
|
| ... | ... | @@ -170,6 +171,7 @@ public class AvdthReferentialImportContext implements Closeable { |
| 170 | 171 | prepare(ObservedSystem.SPI, persistenceContext, result::setObservedSystem);
|
| 171 | 172 | prepare(TransmittingBuoyOperation.SPI, persistenceContext, result::setTransmittingBuoyOperation);
|
| 172 | 173 | prepare(TransmittingBuoyType.SPI, persistenceContext, result::setTransmittingBuoyType);
|
| 174 | + prepare(TransmittingBuoyOwnership.SPI, persistenceContext, result::setTransmittingBuoyOwnership);
|
|
| 173 | 175 | prepare(AcquisitionStatus.SPI, persistenceContext, result::setAcquisitionStatus);
|
| 174 | 176 | prepare(Person.SPI, persistenceContext, result::setPerson);
|
| 175 | 177 | prepare(ReasonForNoFishing.SPI, persistenceContext, result::setReasonForNoFishing);
|
| ... | ... | @@ -28,7 +28,6 @@ import fr.ird.observe.entities.referential.common.Harbour; |
| 28 | 28 | import fr.ird.observe.entities.referential.common.LengthMeasureMethod;
|
| 29 | 29 | import fr.ird.observe.entities.referential.common.Ocean;
|
| 30 | 30 | import fr.ird.observe.entities.referential.common.Person;
|
| 31 | -import fr.ird.observe.entities.referential.ps.common.Program;
|
|
| 32 | 31 | import fr.ird.observe.entities.referential.common.SizeMeasureType;
|
| 33 | 32 | import fr.ird.observe.entities.referential.common.Species;
|
| 34 | 33 | import fr.ird.observe.entities.referential.common.Vessel;
|
| ... | ... | @@ -38,12 +37,14 @@ import fr.ird.observe.entities.referential.ps.common.AcquisitionStatus; |
| 38 | 37 | import fr.ird.observe.entities.referential.ps.common.ObjectMaterial;
|
| 39 | 38 | import fr.ird.observe.entities.referential.ps.common.ObjectOperation;
|
| 40 | 39 | import fr.ird.observe.entities.referential.ps.common.ObservedSystem;
|
| 40 | +import fr.ird.observe.entities.referential.ps.common.Program;
|
|
| 41 | 41 | import fr.ird.observe.entities.referential.ps.common.ReasonForNoFishing;
|
| 42 | 42 | import fr.ird.observe.entities.referential.ps.common.ReasonForNullSet;
|
| 43 | 43 | import fr.ird.observe.entities.referential.ps.common.SampleType;
|
| 44 | 44 | import fr.ird.observe.entities.referential.ps.common.SchoolType;
|
| 45 | 45 | import fr.ird.observe.entities.referential.ps.common.SpeciesFate;
|
| 46 | 46 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOperation;
|
| 47 | +import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyOwnership;
|
|
| 47 | 48 | import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyType;
|
| 48 | 49 | import fr.ird.observe.entities.referential.ps.common.VesselActivity;
|
| 49 | 50 | import fr.ird.observe.entities.referential.ps.common.WeightCategory;
|
| ... | ... | @@ -99,6 +100,7 @@ public class AvdthReferentialImportResult { |
| 99 | 100 | private List<ObjectOperation> objectOperation;
|
| 100 | 101 | private List<ObjectMaterial> objectMaterial;
|
| 101 | 102 | private List<TransmittingBuoyOperation> transmittingBuoyOperation;
|
| 103 | + private List<TransmittingBuoyOwnership> transmittingBuoyOwnership;
|
|
| 102 | 104 | private List<AcquisitionStatus> acquisitionStatus;
|
| 103 | 105 | private List<ReasonForNoFishing> reasonForNoFishing;
|
| 104 | 106 | private List<ReasonForNullSet> reasonForNullSet;
|
| ... | ... | @@ -321,6 +323,14 @@ public class AvdthReferentialImportResult { |
| 321 | 323 | this.transmittingBuoyType = transmittingBuoyType;
|
| 322 | 324 | }
|
| 323 | 325 | |
| 326 | + public List<TransmittingBuoyOwnership> getTransmittingBuoyOwnership() {
|
|
| 327 | + return transmittingBuoyOwnership;
|
|
| 328 | + }
|
|
| 329 | + |
|
| 330 | + public void setTransmittingBuoyOwnership(List<TransmittingBuoyOwnership> transmittingBuoyOwnership) {
|
|
| 331 | + this.transmittingBuoyOwnership = transmittingBuoyOwnership;
|
|
| 332 | + }
|
|
| 333 | + |
|
| 324 | 334 | public List<FpaZone> getFpaZone() {
|
| 325 | 335 | return fpaZone;
|
| 326 | 336 | }
|
| ... | ... | @@ -85,6 +85,9 @@ public class VesselActivityInterceptor extends ReferentialInterceptor<VesselActi |
| 85 | 85 | .put("35", "31")
|
| 86 | 86 | //FIXME
|
| 87 | 87 | .put("36", "99")
|
| 88 | + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2568
|
|
| 89 | + .put("40", "13")
|
|
| 90 | + .put("41", "13")
|
|
| 88 | 91 | .build();
|
| 89 | 92 | |
| 90 | 93 | @SuppressWarnings("SpellCheckingInspection")
|