Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 0327b7ba by Tony Chemit at 2023-09-17T13:41:41+02:00 Ajout de caractéristiques autorisées sur des équipements - Closes #2787 - - - - - e2af5abf by Tony Chemit at 2023-09-17T13:41:42+02:00 Supprimer les valeurs ```None``` des identifiants de balises via la migration classique. - Closes #2788 - - - - - 6 changed files: - core/persistence/migration/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_2.java - + core/persistence/migration/src/main/resources/db/migration/v9/9.2/13_issue-2787-common.sql - + core/persistence/migration/src/main/resources/db/migration/v9/9.2/14_issue-2788-common.sql - core/persistence/test/src/test/resources/fixtures/persistence/table_count/referential.properties - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-referentialResult-common.json - model/src/main/resources/fixtures/global.properties Changes: ===================================== core/persistence/migration/src/main/java/fr/ird/observe/spi/migration/v9/DataSourceMigrationForVersion_9_2.java ===================================== @@ -125,6 +125,12 @@ public class DataSourceMigrationForVersion_9_2 extends ByMajorMigrationVersionRe } // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2765 addNewTable(executor, withIds, "12_01_issue-2765", "table-common_gear_associations"); + if (withIds) { + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2787 + executor.addScript("13", "issue-2787"); + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/2788 + executor.addScript("14", "issue-2788"); + } } ===================================== core/persistence/migration/src/main/resources/db/migration/v9/9.2/13_issue-2787-common.sql ===================================== @@ -0,0 +1,83 @@ +--- +-- #%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% +--- +-- add caracteristic 27 +INSERT INTO common.GearCharacteristic (TOPIAID, TOPIAVERSION, TOPIACREATEDATE, LASTUPDATEDATE, CODE, URI, HOMEID, NEEDCOMMENT, STATUS, LABEL1, LABEL2, LABEL3, LABEL4, LABEL5, LABEL6, LABEL7, LABEL8, UNIT, GEARCHARACTERISTICTYPE) VALUES ('fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027', 0, ${CURRENT_DATE}, ${CURRENT_TIMESTAMP}, '27', null, null, false, 1, 'Electric power', 'Puissance électrique', 'Energia electrica', null, null, null, null, null, 'kW', 'fr.ird.referential.common.GearCharacteristicType#1239832686123#0.3'); + +-- add characteristic (4, 5, 15 and 27) to gear 2 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.1', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ( 'fr.ird.referential.common.Gear#1239832686125#0.1', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ( 'fr.ird.referential.common.Gear#1239832686125#0.1', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ( 'fr.ird.referential.common.Gear#1239832686125#0.1', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 3 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.2', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.2', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.2', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.2', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 4 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.3', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.3', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.3', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.3', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 5 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.4', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.4', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +-- INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.4', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.4', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 6 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.5', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.5', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.5', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1239832686125#0.5', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 32 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#32', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#32', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#32', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#32', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 34 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#34', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#34', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#34', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#34', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 35 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#35', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#35', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#35', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#35', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 36 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#36', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#36', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#36', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#36', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); + +-- add characteristic (4, 5, 15 and 27) to gear 37 +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#37', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.4'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#37', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.5'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#37', 'fr.ird.referential.common.GearCharacteristic#1239832686124#0.1'); +INSERT INTO common.gear_allowedGearCharacteristic(gear, gearCharacteristic) VALUES ('fr.ird.referential.common.Gear#1464000000000#37', 'fr.ird.referential.common.GearCharacteristic#${REFERENTIAL_PREFIX}027'); ===================================== core/persistence/migration/src/main/resources/db/migration/v9/9.2/14_issue-2788-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 ps_logbook.TransmittingBuoy SET code = NULL WHERE code ILIKE 'None'; ===================================== core/persistence/test/src/test/resources/fixtures/persistence/table_count/referential.properties ===================================== @@ -23,7 +23,7 @@ common.country=91 common.dataQuality=5 common.fpaZone=45 common.gear=38 -common.gearCharacteristic=46 +common.gearCharacteristic=47 common.gearCharacteristicListItem=220 common.gearCharacteristicType=8 common.harbour=98 @@ -114,7 +114,7 @@ ps_observation.reasonForDiscard=5 ps_observation.speciesStatus=6 ps_observation.surroundingActivity=8 -common.gear_allowedGearCharacteristic=43 +common.gear_allowedGearCharacteristic=82 common.gear_defaultGearCharacteristic=39 common.species_ocean=553 common.speciesGroup_speciesGroupReleaseMode=19 ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ValidateService-referentialResult-common.json ===================================== @@ -4387,6 +4387,22 @@ } ] }, + { + "datum": { + "text": "27##Puissance électrique##kW", + "type": "fr.ird.observe.dto.referential.common.GearCharacteristicDto", + "id": "fr.ird.referential.common.GearCharacteristic#1464000000000#027", + "topiaVersion": 0, + "lastUpdateDate": "2023-09-01T00:00:00.000Z" + }, + "messages": [ + { + "fieldName": "uri", + "scope": "WARNING", + "message": "Le champ n'est pas renseigné." + } + ] + }, { "datum": { "text": "FURUNO - CI-30##001_001", ===================================== 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=4356 +REFERENTIAL_COUNT=4357 View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/068ecd365a55ce6f04586ebd0... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/068ecd365a55ce6f04586ebd0... You're receiving this email because of your account on gitlab.com.