Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
b3ffb6b8
by Tony Chemit at 2023-04-02T09:50:17+02:00
4 changed files:
- core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/ImportReferentialContext.java
- core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/ActivityReader.java
- core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/referential/interceptors/ObservedSystemInterceptor.java
- src/site/markdown/avdth/referential.md
Changes:
| ... | ... | @@ -134,6 +134,7 @@ public class ImportReferentialContext { |
| 134 | 134 | private ObservedSystem observedSystem0;
|
| 135 | 135 | private SpeciesCache speciesCache;
|
| 136 | 136 | private ObservedSystem observedSystem20;
|
| 137 | + private ObservedSystem observedSystem102;
|
|
| 137 | 138 | private ObservedSystem observedSystem103;
|
| 138 | 139 | private ObservedSystem observedSystem110;
|
| 139 | 140 | private VesselActivity vesselActivity6;
|
| ... | ... | @@ -210,6 +211,7 @@ public class ImportReferentialContext { |
| 210 | 211 | observedSystem = Maps.uniqueIndex(referential.getObservedSystem(), ObservedSystem::getCode);
|
| 211 | 212 | observedSystem0 = observedSystem.get("0");
|
| 212 | 213 | observedSystem20 = observedSystem.get("20");
|
| 214 | + observedSystem102 = observedSystem.get("102");
|
|
| 213 | 215 | observedSystem103 = observedSystem.get("103");
|
| 214 | 216 | observedSystem110 = observedSystem.get("110");
|
| 215 | 217 | |
| ... | ... | @@ -506,6 +508,10 @@ public class ImportReferentialContext { |
| 506 | 508 | return observedSystem0;
|
| 507 | 509 | }
|
| 508 | 510 | |
| 511 | + public ObservedSystem getObservedSystem102() {
|
|
| 512 | + return observedSystem102;
|
|
| 513 | + }
|
|
| 514 | + |
|
| 509 | 515 | public ObservedSystem getObservedSystem103() {
|
| 510 | 516 | return observedSystem103;
|
| 511 | 517 | }
|
| ... | ... | @@ -548,7 +554,7 @@ public class ImportReferentialContext { |
| 548 | 554 | }
|
| 549 | 555 | |
| 550 | 556 | public void addBaitOnlyObservedSystem(Activity entity) {
|
| 551 | - entity.addObservedSystem(getObservedSystem("102"));
|
|
| 557 | + entity.addObservedSystem(getObservedSystem102());
|
|
| 552 | 558 | }
|
| 553 | 559 | |
| 554 | 560 | public ObjectOperation getObjectOperation(String objectOperationCode) {
|
| ... | ... | @@ -32,6 +32,7 @@ import fr.ird.observe.persistence.avdth.data.DataQueryDefinition; |
| 32 | 32 | import fr.ird.observe.persistence.avdth.data.DataReader;
|
| 33 | 33 | import fr.ird.observe.persistence.avdth.data.ImportDataContext;
|
| 34 | 34 | import fr.ird.observe.persistence.avdth.data.ImportEngine;
|
| 35 | +import fr.ird.observe.persistence.avdth.referential.interceptors.ObservedSystemInterceptor;
|
|
| 35 | 36 | import io.ultreia.java4all.util.Dates;
|
| 36 | 37 | |
| 37 | 38 | import java.sql.ResultSet;
|
| ... | ... | @@ -353,6 +354,9 @@ public class ActivityReader extends DataReader<Activity> { |
| 353 | 354 | ResultSet activityObservedSystemRow = activityObservedSystemTableReader.next();
|
| 354 | 355 | String observedSystemCode = activityObservedSystemRow.getString(6);
|
| 355 | 356 | observedSystemCodes.add(observedSystemCode);
|
| 357 | + if (!ObservedSystemInterceptor.CODE_MAPPING.containsKey(observedSystemCode)) {
|
|
| 358 | + throw new IllegalStateException(String.format("Can't find observedSystem with code: %s from ad-hoc AVDTH to ObServe mapping", observedSystemCode));
|
|
| 359 | + }
|
|
| 356 | 360 | ObservedSystem observedSystem = dataContext.getObservedSystem(observedSystemCode);
|
| 357 | 361 | observedSystems.add(observedSystem);
|
| 358 | 362 | }
|
| ... | ... | @@ -58,24 +58,58 @@ public class ObservedSystemInterceptor extends ReferentialInterceptor<ObservedSy |
| 58 | 58 | * From avdth code to observe code.
|
| 59 | 59 | */
|
| 60 | 60 | public static final Map<String, String> CODE_MAPPING = ImmutableMap.<String, String>builder()
|
| 61 | + .put("0", "0")
|
|
| 61 | 62 | .put("10", "18")
|
| 62 | 63 | .put("11", "23")
|
| 63 | 64 | .put("12", "24")
|
| 64 | 65 | .put("13", "25")
|
| 65 | 66 | .put("14", "26")
|
| 67 | + .put("20", "20")
|
|
| 66 | 68 | .put("21", "20")
|
| 67 | 69 | .put("22", "20")
|
| 68 | 70 | .put("23", "20")
|
| 69 | 71 | .put("24", "20")
|
| 70 | 72 | .put("25", "20")
|
| 71 | 73 | .put("26", "17")
|
| 74 | + .put("27", "27")
|
|
| 75 | + .put("28", "28")
|
|
| 72 | 76 | .put("29", "31")
|
| 73 | 77 | .put("30", "4")
|
| 74 | 78 | .put("31", "4")
|
| 79 | + .put("32", "32")
|
|
| 80 | + .put("33", "33")
|
|
| 81 | + .put("34", "34")
|
|
| 82 | + .put("35", "35")
|
|
| 83 | + .put("36", "36")
|
|
| 84 | + .put("37", "37")
|
|
| 85 | + .put("38", "38")
|
|
| 86 | + .put("40", "40")
|
|
| 87 | + .put("41", "41")
|
|
| 88 | + .put("42", "42")
|
|
| 89 | + .put("43", "43")
|
|
| 90 | + .put("50", "50")
|
|
| 75 | 91 | .put("51", "11")
|
| 76 | 92 | .put("52", "10")
|
| 93 | + .put("53", "53")
|
|
| 77 | 94 | .put("60", "12")
|
| 78 | 95 | .put("61", "13")
|
| 96 | + .put("62", "62")
|
|
| 97 | + .put("70", "70")
|
|
| 98 | + .put("71", "71")
|
|
| 99 | + .put("72", "72")
|
|
| 100 | + .put("73", "73")
|
|
| 101 | + .put("74", "74")
|
|
| 102 | + .put("80", "80")
|
|
| 103 | + .put("81", "81")
|
|
| 104 | + .put("90", "90")
|
|
| 105 | + .put("91", "91")
|
|
| 106 | + .put("92", "92")
|
|
| 107 | + .put("93", "93")
|
|
| 108 | + .put("94", "94")
|
|
| 109 | + .put("95", "95")
|
|
| 110 | + .put("96", "96")
|
|
| 111 | + .put("97", "97")
|
|
| 112 | + .put("98", "98")
|
|
| 79 | 113 | .put("99", "101")
|
| 80 | 114 | .build();
|
| 81 | 115 | /**
|
| ... | ... | @@ -176,6 +210,6 @@ public class ObservedSystemInterceptor extends ReferentialInterceptor<ObservedSy |
| 176 | 210 | |
| 177 | 211 | @Override
|
| 178 | 212 | public void consume(AvdthReferentialImportResult result, List<ObservedSystem> newList) {
|
| 179 | - result.setObservedSystem(newList);
|
|
| 213 | + mergeNewReferential(result, newList, AvdthReferentialImportResult::getObservedSystem, ObservedSystem::getCode);
|
|
| 180 | 214 | }
|
| 181 | 215 | } |
| ... | ... | @@ -142,24 +142,58 @@ Pour transposer tous les codes **ACT_ASSOC.C_ASSOC** en code **ps_common.Observe |
| 142 | 142 | |
| 143 | 143 | | **ACT_ASSOC.C_ASSOC** | **ps_common.ObservedSystem.code** |
|
| 144 | 144 | |:----------------------|:----------------------------------|
|
| 145 | +| 0 | 0 |
|
|
| 145 | 146 | | 10 | 18 |
|
| 146 | 147 | | 11 | 23 |
|
| 147 | 148 | | 12 | 24 |
|
| 148 | 149 | | 13 | 25 |
|
| 149 | 150 | | 14 | 26 |
|
| 151 | +| 20 | 20 |
|
|
| 150 | 152 | | 21 | 20 |
|
| 151 | 153 | | 22 | 20 |
|
| 152 | 154 | | 23 | 20 |
|
| 153 | 155 | | 24 | 20 |
|
| 154 | 156 | | 25 | 20 |
|
| 155 | 157 | | 26 | 17 |
|
| 158 | +| 27 | 27 |
|
|
| 159 | +| 28 | 28 |
|
|
| 156 | 160 | | 29 | 31 |
|
| 157 | 161 | | 30 | 4 |
|
| 158 | 162 | | 31 | 4 |
|
| 163 | +| 32 | 32 |
|
|
| 164 | +| 33 | 33 |
|
|
| 165 | +| 34 | 34 |
|
|
| 166 | +| 35 | 35 |
|
|
| 167 | +| 36 | 36 |
|
|
| 168 | +| 37 | 37 |
|
|
| 169 | +| 38 | 38 |
|
|
| 170 | +| 40 | 40 |
|
|
| 171 | +| 41 | 41 |
|
|
| 172 | +| 42 | 42 |
|
|
| 173 | +| 43 | 43 |
|
|
| 174 | +| 50 | 50 |
|
|
| 159 | 175 | | 51 | 11 |
|
| 160 | 176 | | 52 | 10 |
|
| 177 | +| 53 | 53 |
|
|
| 161 | 178 | | 60 | 12 |
|
| 162 | 179 | | 61 | 13 |
|
| 180 | +| 62 | 62 |
|
|
| 181 | +| 70 | 70 |
|
|
| 182 | +| 71 | 71 |
|
|
| 183 | +| 72 | 72 |
|
|
| 184 | +| 73 | 73 |
|
|
| 185 | +| 74 | 74 |
|
|
| 186 | +| 80 | 80 |
|
|
| 187 | +| 81 | 81 |
|
|
| 188 | +| 90 | 90 |
|
|
| 189 | +| 91 | 91 |
|
|
| 190 | +| 92 | 92 |
|
|
| 191 | +| 93 | 93 |
|
|
| 192 | +| 94 | 94 |
|
|
| 193 | +| 95 | 95 |
|
|
| 194 | +| 96 | 96 |
|
|
| 195 | +| 97 | 97 |
|
|
| 196 | +| 98 | 98 |
|
|
| 163 | 197 | | 99 | 101 |
|
| 164 | 198 | |
| 165 | 199 | ### REF_VESSEL_ACTIVITY_TYPE
|