Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: d5e54112 by Tony Chemit at 2023-01-15T13:59:09+01:00 Migration - Add new vessel activity 36 - - - - - 10efebdb by Tony Chemit at 2023-01-15T14:21:58+01:00 Tests - Update some fixtures - - - - - e01e43fb by Tony Chemit at 2023-01-15T14:26:41+01:00 Avdth - Use new vessel activity 36 in referential mapping - - - - - e6051d82 by Tony Chemit at 2023-01-15T14:27:19+01:00 Avdth - Update migration documentation - - - - - 52684633 by Tony Chemit at 2023-01-15T14:47:22+01:00 Merge branch 'feature/issue_2600' into develop Nouvelle référence 'Refueling' - Closes #2600 - - - - - 7 changed files: - core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/referential/interceptors/VesselActivityInterceptor.java - core/persistence/migration/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_1.java - + core/persistence/migration/src/main/resources/db/migration/v9/9.1/05_add_referential_ps_common_VesselActivity_36-common.sql - + core/persistence/migration/src/main/resources/db/migration/v9/9.1/05_add_referential_ps_common_VesselActivity_finalize-common.sql - core/persistence/test/src/test/resources/fixtures/persistence/table_count/referential.properties - model/src/main/resources/fixtures/global.properties - src/site/markdown/avdth/referential.md 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 .put("19", "29") .put("20", "30") .put("35", "31") - //FIXME - .put("36", "99") + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2600 + .put("36", "36") // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2568 .put("40", "13") .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; import java.time.ZoneOffset; import java.util.Date; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; +import java.util.stream.Stream; /** * Created on 14/09/2022. @@ -270,6 +273,24 @@ public class DataSourceMigrationForVersion_9_1 extends ByMajorMigrationVersionRe // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2546 executor.addScript("03", "fix_sql_types_issue_2546"); executor.addScript("04", "drop_ll_common_weightDeterminationMethod"); + + if (withIds) { + addVesselActivity36(executor); + } + } + + private void addVesselActivity36(MigrationVersionResourceExecutor executor) { + Set<String> existingCodes = executor.findMultipleResultAstSet(SqlQuery.wrap("SELECT CODE FROM ps_common.VesselActivity", resultSet -> resultSet.getString(1))); + Set<String> newCodes = new LinkedHashSet<>(); + Stream.of("36").forEach(code -> { + if (!existingCodes.contains(code)) { + executor.addScript("05", "add_referential_ps_common_VesselActivity_" + code); + newCodes.add(code); + } + }); + if (!newCodes.isEmpty()) { + executor.addScript("05", "add_referential_ps_common_VesselActivity_finalize"); + } } 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 ===================================== @@ -0,0 +1,22 @@ +--- +-- #%L +-- ObServe Core :: Persistence :: Migration +-- %% +-- Copyright (C) 2008 - 2023 IRD, Ultreia.io +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/gpl-3.0.html>. +-- #L% +--- +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 ===================================== @@ -0,0 +1,22 @@ +--- +-- #%L +-- ObServe Core :: Persistence :: Migration +-- %% +-- Copyright (C) 2008 - 2023 IRD, Ultreia.io +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/gpl-3.0.html>. +-- #L% +--- +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 ps_common.transmittingBuoyOperation=5 ps_common.transmittingBuoyOwnership=5 ps_common.transmittingBuoyType=62 -ps_common.vesselActivity=36 +ps_common.vesselActivity=37 ps_common.weightCategory=137 ps_landing.destination=28 ps_landing.fate=2 ===================================== model/src/main/resources/fixtures/global.properties ===================================== @@ -25,4 +25,4 @@ REFERENCE_DATA_COUNT=68 ENTITIES_LIMIT_SIZE=100 # fr.ird.observe.services.service.referential.ReferentialService # fr.ird.observe.services.local.service.referential.DifferentialModelTest -REFERENTIAL_COUNT=4093 +REFERENTIAL_COUNT=4094 ===================================== src/site/markdown/avdth/referential.md ===================================== @@ -251,7 +251,7 @@ Mapping type d'activité | 19 | 29 | | 20 | 30 | | 35 | 31 | -| 36 | 99 **FIXME** | +| 36 | 36 | 1. **Seule une activité de code 6 permet la création de captures**. 2. **Seule une activité de code 13 permet la création de DCP**.. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ab143805e7a4e20066da0aabf... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/ab143805e7a4e20066da0aabf... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)