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

Commits:

7 changed files:

Changes:

  • core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/referential/interceptors/VesselActivityInterceptor.java
    ... ... @@ -83,8 +83,8 @@ public class VesselActivityInterceptor extends ReferentialInterceptor<VesselActi
    83 83
                 .put("19", "29")
    
    84 84
                 .put("20", "30")
    
    85 85
                 .put("35", "31")
    
    86
    -            //FIXME
    
    87
    -            .put("36", "99")
    
    86
    +            // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2600
    
    87
    +            .put("36", "36")
    
    88 88
                 // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2568
    
    89 89
                 .put("40", "13")
    
    90 90
                 .put("41", "13")
    

  • core/persistence/migration/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_1.java
    ... ... @@ -36,10 +36,13 @@ import java.time.LocalDateTime;
    36 36
     import java.time.ZoneOffset;
    
    37 37
     import java.util.Date;
    
    38 38
     import java.util.LinkedHashMap;
    
    39
    +import java.util.LinkedHashSet;
    
    39 40
     import java.util.LinkedList;
    
    40 41
     import java.util.List;
    
    41 42
     import java.util.Map;
    
    42 43
     import java.util.Objects;
    
    44
    +import java.util.Set;
    
    45
    +import java.util.stream.Stream;
    
    43 46
     
    
    44 47
     /**
    
    45 48
      * Created on 14/09/2022.
    
    ... ... @@ -270,6 +273,24 @@ public class DataSourceMigrationForVersion_9_1 extends ByMajorMigrationVersionRe
    270 273
             // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2546
    
    271 274
             executor.addScript("03", "fix_sql_types_issue_2546");
    
    272 275
             executor.addScript("04", "drop_ll_common_weightDeterminationMethod");
    
    276
    +
    
    277
    +        if (withIds) {
    
    278
    +            addVesselActivity36(executor);
    
    279
    +        }
    
    280
    +    }
    
    281
    +
    
    282
    +    private void addVesselActivity36(MigrationVersionResourceExecutor executor) {
    
    283
    +        Set<String> existingCodes = executor.findMultipleResultAstSet(SqlQuery.wrap("SELECT CODE FROM ps_common.VesselActivity", resultSet -> resultSet.getString(1)));
    
    284
    +        Set<String> newCodes = new LinkedHashSet<>();
    
    285
    +        Stream.of("36").forEach(code -> {
    
    286
    +            if (!existingCodes.contains(code)) {
    
    287
    +                executor.addScript("05", "add_referential_ps_common_VesselActivity_" + code);
    
    288
    +                newCodes.add(code);
    
    289
    +            }
    
    290
    +        });
    
    291
    +        if (!newCodes.isEmpty()) {
    
    292
    +            executor.addScript("05", "add_referential_ps_common_VesselActivity_finalize");
    
    293
    +        }
    
    273 294
         }
    
    274 295
     
    
    275 296
         private Map<String, List<WellPlanStructure>> splitByTrip(List<WellPlanStructure> existingWellPlan) {
    

  • core/persistence/migration/src/main/resources/db/migration/v9/9.1/05_add_referential_ps_common_VesselActivity_36-common.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- ObServe Core :: Persistence :: Migration
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2008 - 2023 IRD, Ultreia.io
    
    6
    +-- %%
    
    7
    +-- This program is free software: you can redistribute it and/or modify
    
    8
    +-- it under the terms of the GNU General Public License as
    
    9
    +-- published by the Free Software Foundation, either version 3 of the
    
    10
    +-- License, or (at your option) any later version.
    
    11
    +--
    
    12
    +-- This program is distributed in the hope that it will be useful,
    
    13
    +-- but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +-- GNU General Public License for more details.
    
    16
    +--
    
    17
    +-- You should have received a copy of the GNU General Public
    
    18
    +-- License along with this program.  If not, see
    
    19
    +-- <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +-- #L%
    
    21
    +---
    
    22
    +INSERT INTO ps_common.vesselActivity(topiaid, topiaversion, topiacreatedate, lastupdatedate, code, uri, homeid, needcomment, status, label1, label2, label3, label4, label5, label6, label7, label8, allowFad) VALUES ('fr.ird.referential.ps.common.VesselActivity#${REFERENTIAL_PREFIX}36', 0, ${CURRENT_DATE}, ${CURRENT_TIMESTAMP}, '36', null, null, FALSE, 1, 'Refueling', 'Ravitaillement en carburant', 'Refueling TODO', null, null, null, null, null, FALSE);

  • core/persistence/migration/src/main/resources/db/migration/v9/9.1/05_add_referential_ps_common_VesselActivity_finalize-common.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- ObServe Core :: Persistence :: Migration
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2008 - 2023 IRD, Ultreia.io
    
    6
    +-- %%
    
    7
    +-- This program is free software: you can redistribute it and/or modify
    
    8
    +-- it under the terms of the GNU General Public License as
    
    9
    +-- published by the Free Software Foundation, either version 3 of the
    
    10
    +-- License, or (at your option) any later version.
    
    11
    +--
    
    12
    +-- This program is distributed in the hope that it will be useful,
    
    13
    +-- but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +-- GNU General Public License for more details.
    
    16
    +--
    
    17
    +-- You should have received a copy of the GNU General Public
    
    18
    +-- License along with this program.  If not, see
    
    19
    +-- <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +-- #L%
    
    21
    +---
    
    22
    +UPDATE common.LastUpdateDate SET lastUpdateDate = ${CURRENT_TIMESTAMP} WHERE type ='fr.ird.observe.entities.referential.ps.common.VesselActivity';

  • core/persistence/test/src/test/resources/fixtures/persistence/table_count/referential.properties
    ... ... @@ -89,7 +89,7 @@ ps_common.speciesFate=15
    89 89
     ps_common.transmittingBuoyOperation=5
    
    90 90
     ps_common.transmittingBuoyOwnership=5
    
    91 91
     ps_common.transmittingBuoyType=62
    
    92
    -ps_common.vesselActivity=36
    
    92
    +ps_common.vesselActivity=37
    
    93 93
     ps_common.weightCategory=137
    
    94 94
     ps_landing.destination=28
    
    95 95
     ps_landing.fate=2
    

  • model/src/main/resources/fixtures/global.properties
    ... ... @@ -25,4 +25,4 @@ REFERENCE_DATA_COUNT=68
    25 25
     ENTITIES_LIMIT_SIZE=100
    
    26 26
     # fr.ird.observe.services.service.referential.ReferentialService
    
    27 27
     # fr.ird.observe.services.local.service.referential.DifferentialModelTest
    
    28
    -REFERENTIAL_COUNT=4093
    28
    +REFERENTIAL_COUNT=4094

  • src/site/markdown/avdth/referential.md
    ... ... @@ -251,7 +251,7 @@ Mapping type d'activité
    251 251
     | 19                   | 29                                |
    
    252 252
     | 20                   | 30                                |
    
    253 253
     | 35                   | 31                                |
    
    254
    -| 36                   | 99  **FIXME**                     |
    
    254
    +| 36                   | 36                                |
    
    255 255
     
    
    256 256
     1. **Seule une activité de code 6 permet la création de captures**.
    
    257 257
     2. **Seule une activité de code 13 permet la création de DCP**.