Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: c840b55e by Tony CHEMIT at 2018-04-24T13:57:27Z optimize dependencies - - - - - 63279977 by Tony CHEMIT at 2018-04-24T13:57:53Z Mettre les mêmes modes de libération que Whale shark pour le groupe d'espèce Cetaceans - Closes #931 - - - - - 8 changed files: - dto/pom.xml - persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_2.java - + persistence/src/main/resources/db/migration/7.2/06_fix_species_group_release_mode_for_cetaceans-common.sql - services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java - test/src/main/java/fr/ird/observe/test/ObserveFixtures.java - test/src/main/resources/db/7.2/dataForTestLongline.sql.gz - test/src/main/resources/db/7.2/dataForTestSeine.sql.gz - test/src/main/resources/db/7.2/referentiel.sql.gz Changes: ===================================== dto/pom.xml ===================================== --- a/dto/pom.xml +++ b/dto/pom.xml @@ -70,10 +70,6 @@ </dependency> <dependency> <groupId>io.ultreia.java4all.jaxx</groupId> - <artifactId>jaxx-runtime</artifactId> - </dependency> - <dependency> - <groupId>io.ultreia.java4all.jaxx</groupId> <artifactId>jaxx-widgets-select</artifactId> </dependency> ===================================== persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_2.java ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_2.java +++ b/persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_2.java @@ -22,8 +22,13 @@ package fr.ird.observe.persistence.migration; * #L% */ +import org.nuiton.topia.persistence.support.TopiaSqlQuery; import org.nuiton.topia.persistence.support.TopiaSqlSupport; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.List; /** @@ -48,6 +53,21 @@ public class DataSourceMigrationForVersion_7_2 extends AbstractObserveMigrationC addScript("04", "update_non_target_catch_release_status", queries); addScript("05", "remove_species_group_release_mode_value", queries); + Boolean withIds = topiaSqlSupport.findSingleResult(new TopiaSqlQuery<Boolean>() { + @Override + public PreparedStatement prepareQuery(Connection connection) throws SQLException { + return connection.prepareStatement("SELECT COUNT (*) FROM observe_common.SpeciesGroup WHERE topiaid='fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.9204972827240977';"); + } + + @Override + public Boolean prepareResult(ResultSet resultSet) throws SQLException { + return resultSet.getInt(1) > 0; + } + }); + if (withIds) { + addScript("06", "fix_species_group_release_mode_for_cetaceans", queries); + } + } public static class H2DataSourceMigrationForVersion extends DataSourceMigrationForVersion_7_2 { ===================================== persistence/src/main/resources/db/migration/7.2/06_fix_species_group_release_mode_for_cetaceans-common.sql ===================================== --- /dev/null +++ b/persistence/src/main/resources/db/migration/7.2/06_fix_species_group_release_mode_for_cetaceans-common.sql @@ -0,0 +1,26 @@ +--- +-- #%L +-- ObServe :: Persistence +-- %% +-- Copyright (C) 2008 - 2018 IRD, Code Lutin, 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 observe_common.SpeciesGroup_SpeciesGroupReleaseMode(SpeciesGroup, SpeciesGroupReleaseMode) VALUES ('fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.9204972827240977','fr.ird.observe.entities.referentiel.SpeciesGroupReleaseMode#0#1');; +INSERT INTO observe_common.SpeciesGroup_SpeciesGroupReleaseMode(SpeciesGroup, SpeciesGroupReleaseMode) VALUES('fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.9204972827240977','fr.ird.observe.entities.referentiel.SpeciesGroupReleaseMode#0#7'); +INSERT INTO observe_common.SpeciesGroup_SpeciesGroupReleaseMode(SpeciesGroup, SpeciesGroupReleaseMode) VALUES('fr.ird.observe.entities.referentiel.SpeciesGroup#1239832683690#0.9204972827240977','fr.ird.observe.entities.referentiel.SpeciesGroupReleaseMode#0#8'); + ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java ===================================== --- a/services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java +++ b/services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java @@ -148,7 +148,7 @@ public class ValidateServiceLocalTest extends ServiceLocalTestSupport { Assert.assertEquals(DtoModelClasses.REFERENTIAL_TYPES.size() - 1, types.size()); assertValidateResult(result, DataQualityDto.class, 1); - assertValidateResult(result, SpeciesGroupReleaseModeDto.class, 3); + assertValidateResult(result, SpeciesGroupReleaseModeDto.class, 2); assertValidateResult(result, SettingShapeDto.class, 3); assertValidateResult(result, BaitHaulingStatusDto.class, 3); assertValidateResult(result, TripTypeDto.class, 1); ===================================== test/src/main/java/fr/ird/observe/test/ObserveFixtures.java ===================================== --- a/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java +++ b/test/src/main/java/fr/ird/observe/test/ObserveFixtures.java @@ -102,7 +102,7 @@ public class ObserveFixtures { .put("observe_common.species", 285L) .put("observe_common.species_specieslist", 401L) .put("observe_common.speciesgroup", 11L) - .put("observe_common.speciesgroupreleasemode", 10L) + .put("observe_common.speciesgroupreleasemode", 9L) .put("observe_common.specieslist", 6L) .put("observe_common.vessel", 1172L) .put("observe_common.vesselsizecategory", 13L) ===================================== test/src/main/resources/db/7.2/dataForTestLongline.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.2/dataForTestLongline.sql.gz and b/test/src/main/resources/db/7.2/dataForTestLongline.sql.gz differ ===================================== test/src/main/resources/db/7.2/dataForTestSeine.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.2/dataForTestSeine.sql.gz and b/test/src/main/resources/db/7.2/dataForTestSeine.sql.gz differ ===================================== test/src/main/resources/db/7.2/referentiel.sql.gz ===================================== Binary files a/test/src/main/resources/db/7.2/referentiel.sql.gz and b/test/src/main/resources/db/7.2/referentiel.sql.gz differ View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/4540e32893705595099c2352b5e... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/4540e32893705595099c2352b5e... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT