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

Commits:

30 changed files:

Changes:

  • client-configuration/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>client-configuration</artifactId>
    

  • client-core/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>client-core</artifactId>
    

  • client-runner/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>client-runner</artifactId>
    

  • dto/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0.9-SNAPSHOT</version>
    
    30
    +    <version>7.1.0-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>dto</artifactId>
    

  • observe-i18n/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>observe-i18n</artifactId>
    

  • observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
    ... ... @@ -824,7 +824,7 @@ observe.common.LengthLengthParameterDto.types=Relations Taille-Taille
    824 824
     observe.common.LengthWeightParameterDto.coefficients=Coefficients
    
    825 825
     observe.common.LengthWeightParameterDto.generalTab=Caractéristiques générales
    
    826 826
     observe.common.LengthWeightParameterDto.lengthWeightFormula=Relation Poids
    
    827
    -observe.common.LengthWeightParameterDto.lengthWeightFormulaInformation=La relation poids permet de calculer le poids à partir de la taille
    
    827
    +observe.common.LengthWeightParameterDto.lengthWeightFormulaInformation=La relation poids permet de calculer le poids à partir de la taille, elle doit contenir la variable L (length) qui représente la taille d'entrée
    
    828 828
     observe.common.LengthWeightParameterDto.meanLength=Taille moyenne (en cm)
    
    829 829
     observe.common.LengthWeightParameterDto.meanValues=Valeurs moyennes
    
    830 830
     observe.common.LengthWeightParameterDto.meanWeight=Poids moyen (en Kg)
    
    ... ... @@ -832,7 +832,7 @@ observe.common.LengthWeightParameterDto.otherTab=Autres caractéristiques
    832 832
     observe.common.LengthWeightParameterDto.type=Relation Taille-Poids
    
    833 833
     observe.common.LengthWeightParameterDto.types=Relations Taille-Poids
    
    834 834
     observe.common.LengthWeightParameterDto.weightLengthFormula=Relation Taille
    
    835
    -observe.common.LengthWeightParameterDto.weightLengthFormulaInformation=La relation taille permet de calculer la taille à partir du poids
    
    835
    +observe.common.LengthWeightParameterDto.weightLengthFormulaInformation=La relation taille permet de calculer la taille à partir du poids, elle doit contenir la variable P (poids) qui représente le poids d'entrée
    
    836 836
     observe.common.LightsticksColorDto.type=Couleur de cyalumes
    
    837 837
     observe.common.LightsticksColorDto.types=Couleurs de cyalumes
    
    838 838
     observe.common.LightsticksTypeDto.type=Type de cyalumes
    

  • observe/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>observe</artifactId>
    

  • persistence/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>persistence</artifactId>
    

  • persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_1.java
    1
    +package fr.ird.observe.persistence.migration;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Persistence
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + * 
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + * 
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import com.google.auto.service.AutoService;
    
    26
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResource;
    
    27
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor;
    
    28
    +import org.nuiton.version.Versions;
    
    29
    +
    
    30
    +/**
    
    31
    + * Created on 16/07/19.
    
    32
    + *
    
    33
    + * @author Tony Chemit - dev@tchemit.fr
    
    34
    + * @since ?
    
    35
    + */
    
    36
    +@AutoService(MigrationVersionResource.class)
    
    37
    +public class DataSourceMigrationForVersion_7_1 extends MigrationVersionResource {
    
    38
    +
    
    39
    +    public DataSourceMigrationForVersion_7_1() {
    
    40
    +        super(Versions.valueOf("7.1"));
    
    41
    +    }
    
    42
    +
    
    43
    +    @Override
    
    44
    +    public void generateSqlScript(MigrationVersionResourceExecutor executor) {
    
    45
    +        executor.addScript("01", "add_not_null_on_length_weight_parameters");
    
    46
    +        executor.addScript("02", "add_not_null_on_length_length_parameters");
    
    47
    +    }
    
    48
    +
    
    49
    +}
    
    50
    +

  • persistence/src/main/models/Observe.model
    ... ... @@ -416,19 +416,19 @@ label8 + {*:1} String
    416 416
     getLabel(referentialLocale !fr.ird.observe.dto.referential.ReferentialLocale) String
    
    417 417
     
    
    418 418
     referentiel.LengthLengthParameter > referentiel.FormulaSupport | entity
    
    419
    -inputOutputFormula + {*:1} String
    
    420
    -outputInputFormula + {*:1} String
    
    421
    -inputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false
    
    422
    -outputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false
    
    419
    +inputOutputFormula + {*:1} String | notNull
    
    420
    +outputInputFormula + {*:1} String | notNull
    
    421
    +inputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false notNull
    
    422
    +outputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false notNull
    
    423 423
     
    
    424 424
     abstract referentiel.LengthWeightAble
    
    425 425
     
    
    426 426
     referentiel.LengthWeightParameter > referentiel.FormulaSupport | entity
    
    427
    -lengthWeightFormula + {*:1} String
    
    428
    -weightLengthFormula + {*:1} String
    
    427
    +lengthWeightFormula + {*:1} String | notNull
    
    428
    +weightLengthFormula + {*:1} String | notNull
    
    429 429
     meanLength + {*:1} Float
    
    430 430
     meanWeight + {*:1} Float
    
    431
    -sizeMeasureType {*:0..1} referentiel.SizeMeasureType | lazy=false
    
    431
    +sizeMeasureType {*:0..1} referentiel.SizeMeasureType | lazy=false notNull
    
    432 432
     
    
    433 433
     abstract referentiel.ObserveReferentialEntity > ObserveEntity >> fr.ird.observe.dto.reference.ReferentialDtoReferenceAware | entity
    
    434 434
     code + {*:1} String
    

  • persistence/src/main/resources/db/migration/7.1/01_add_not_null_on_length_weight_parameters-common.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- ObServe :: Persistence
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2008 - 2019 IRD, Code Lutin, 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
    +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.299';
    
    23
    +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.158';
    
    24
    +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.157';
    
    25
    +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.298';
    
    26
    +UPDATE observe_common.LengthWeightParameter SET sizeMeasureType = 'fr.ird.observe.entities.referentiel.SizeMeasureType#1433499465700#0.0902433863375336' WHERE sizeMeasureType IS NULL;
    
    27
    +UPDATE observe_common.LengthWeightParameter SET coefficients = 'a=0.5:b=0.0' WHERE coefficients IS NULL;
    
    28
    +
    
    29
    +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN sizeMeasureType SET NOT NULL;
    
    30
    +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN lengthWeightFormula SET NOT NULL;
    
    31
    +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN weightLengthFormula SET NOT NULL;
    
    32
    +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN coefficients SET NOT NULL;
    
    33
    +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN ocean SET NOT NULL;
    
    34
    +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN sex SET NOT NULL;
    
    35
    +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN species SET NOT NULL;

  • persistence/src/main/resources/db/migration/7.1/02_add_not_null_on_length_length_parameters-common.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- ObServe :: Persistence
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2008 - 2019 IRD, Code Lutin, 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
    +
    
    23
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN inputOutputFormula SET NOT NULL;
    
    24
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN outputInputFormula SET NOT NULL;
    
    25
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN inputSizeMeasureType SET NOT NULL;
    
    26
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN outputSizeMeasureType SET NOT NULL;
    
    27
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN coefficients SET NOT NULL;
    
    28
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN species SET NOT NULL;
    
    29
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN ocean SET NOT NULL;
    
    30
    +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN sex SET NOT NULL;

  • pom.xml
    ... ... @@ -31,7 +31,7 @@
    31 31
     
    
    32 32
       <groupId>fr.ird.observe</groupId>
    
    33 33
       <artifactId>ird-observe</artifactId>
    
    34
    -  <version>7.0.9-SNAPSHOT</version>
    
    34
    +  <version>7.1.0-SNAPSHOT</version>
    
    35 35
       <packaging>pom</packaging>
    
    36 36
     
    
    37 37
       <name>ObServe :: Pom</name>
    
    ... ... @@ -149,7 +149,7 @@
    149 149
         <devMode>true</devMode>
    
    150 150
     
    
    151 151
         <!--persistence model version-->
    
    152
    -    <observe.model.version>7.0</observe.model.version>
    
    152
    +    <observe.model.version>7.1</observe.model.version>
    
    153 153
     
    
    154 154
         <!-- build timestamp configuration -->
    
    155 155
         <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
    

  • server-configuration/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>server-configuration</artifactId>
    

  • server-core/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0.9-SNAPSHOT</version>
    
    30
    +    <version>7.1.0-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>server-core</artifactId>
    

  • server-runner/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0.9-SNAPSHOT</version>
    
    30
    +    <version>7.1.0-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>server-runner</artifactId>
    

  • services-client/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0.9-SNAPSHOT</version>
    
    30
    +    <version>7.1.0-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>services-client</artifactId>
    

  • services-local/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0.9-SNAPSHOT</version>
    
    30
    +    <version>7.1.0-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>services-local</artifactId>
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/actions/consolidate/ConsolidateDataServiceLocal.java
    ... ... @@ -665,6 +665,12 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements
    665 665
                 log.error(String.format("No size measure type found for TargetLength (%s) will use the one of the species", lengthWeightComputable.getTopiaId()));
    
    666 666
                 inputSizeMeasureType = species.getSizeMeasureType();
    
    667 667
             }
    
    668
    +
    
    669
    +        if (inputSizeMeasureType == null) {
    
    670
    +            log.error(String.format("No size measure type found for Species (%s), can't continue!", species.getTopiaId()));
    
    671
    +            return;
    
    672
    +        }
    
    673
    +
    
    668 674
             Optional<LengthWeightParameter> optionalLengthWeightParameter = activityContext.findLengthWeightParameter(species, sex, inputSizeMeasureType);
    
    669 675
     
    
    670 676
             if (!optionalLengthWeightParameter.isPresent()) {
    

  • services-local/src/test/java/fr/ird/observe/services/local/entity/LengthWeightParemetersTest.java
    ... ... @@ -31,14 +31,16 @@ import fr.ird.observe.entities.referentiel.Ocean;
    31 31
     import fr.ird.observe.entities.referentiel.OceanTopiaDao;
    
    32 32
     import fr.ird.observe.entities.referentiel.Sex;
    
    33 33
     import fr.ird.observe.entities.referentiel.SexTopiaDao;
    
    34
    +import fr.ird.observe.entities.referentiel.SizeMeasureType;
    
    35
    +import fr.ird.observe.entities.referentiel.SizeMeasureTypeTopiaDao;
    
    34 36
     import fr.ird.observe.entities.referentiel.Species;
    
    35 37
     import fr.ird.observe.entities.referentiel.SpeciesTopiaDao;
    
    36 38
     import fr.ird.observe.persistence.ObserveTopiaDaoSupplier;
    
    37 39
     import fr.ird.observe.persistence.ObserveTopiaPersistenceContext;
    
    38 40
     import fr.ird.observe.services.local.service.ServiceLocalTestSupport;
    
    39 41
     import fr.ird.observe.test.spi.CopyDatabaseConfiguration;
    
    40
    -import org.apache.logging.log4j.Logger;
    
    41 42
     import org.apache.logging.log4j.LogManager;
    
    43
    +import org.apache.logging.log4j.Logger;
    
    42 44
     import org.junit.Assert;
    
    43 45
     import org.junit.Before;
    
    44 46
     import org.junit.Test;
    
    ... ... @@ -64,6 +66,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    64 66
                                                           Species species,
    
    65 67
                                                           Ocean ocean,
    
    66 68
                                                           Sex sex,
    
    69
    +                                                      SizeMeasureType sizeMeasureType,
    
    67 70
                                                           Date startDate,
    
    68 71
                                                           Date endDate) {
    
    69 72
     
    
    ... ... @@ -72,6 +75,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    72 75
             entity.setSpecies(species);
    
    73 76
             entity.setSex(sex);
    
    74 77
             entity.setOcean(ocean);
    
    78
    +        entity.setSizeMeasureType(sizeMeasureType);
    
    75 79
             entity.setStartDate(startDate);
    
    76 80
             entity.setEndDate(endDate);
    
    77 81
             entity.setStatus(ReferenceStatus.enabled);
    
    ... ... @@ -92,6 +96,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    92 96
             SpeciesTopiaDao speciesDAO = persistenceContext.getSpeciesDao();
    
    93 97
             OceanTopiaDao oceanDAO = persistenceContext.getOceanDao();
    
    94 98
             SexTopiaDao sexDao = persistenceContext.getSexDao();
    
    99
    +        SizeMeasureTypeTopiaDao sizeMeasureTypeDao = persistenceContext.getSizeMeasureTypeDao();
    
    95 100
     
    
    96 101
             Optional<Species> optionalSpecies = Optional.ofNullable(speciesDAO.forFaoCodeEquals("ALB").tryFindUnique().orNull());
    
    97 102
             Assert.assertTrue("Could not find species with faoCode: DOL", optionalSpecies.isPresent());
    
    ... ... @@ -105,6 +110,10 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    105 110
             Optional<Sex> optionalFemaleSex = Optional.ofNullable(sexDao.forCodeEquals("2").tryFindUnique().orNull());
    
    106 111
             Assert.assertTrue("Could not find sex with code 2 (female)", optionalFemaleSex.isPresent());
    
    107 112
     
    
    113
    +        Optional<SizeMeasureType> optionalSizeMeasureType = Optional.ofNullable(sizeMeasureTypeDao.forCodeEquals("FL").tryFindUnique().orNull());
    
    114
    +        Assert.assertTrue("Could not find sizeMeasureType with code FL", optionalSizeMeasureType.isPresent());
    
    115
    +        SizeMeasureType sizeMeasureType = optionalSizeMeasureType.get();
    
    116
    +
    
    108 117
             Date firstStartDate = DateUtil.createDate(1, 1, 2010);
    
    109 118
             Date firstEndDate = DateUtil.createDate(31, 12, 2010);
    
    110 119
             Date secondStartDate = DateUtil.createDate(1, 1, 2011);
    
    ... ... @@ -123,13 +132,13 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    123 132
             Ocean indianOcean = optionalIndianOcean.orElse(null);
    
    124 133
     
    
    125 134
             // Ajout parametrage Male / Atlantique (2010)
    
    126
    -        createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, firstStartDate, firstEndDate);
    
    135
    +        createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, sizeMeasureType,firstStartDate, firstEndDate);
    
    127 136
             // Ajout parametrage Male / Atlantique (après 2010)
    
    128
    -        createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, secondStartDate, null);
    
    137
    +        createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, sizeMeasureType,secondStartDate, null);
    
    129 138
             // Ajout parametrage Male / Indien (2010)
    
    130
    -        createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, firstStartDate, firstEndDate);
    
    139
    +        createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, sizeMeasureType,firstStartDate, firstEndDate);
    
    131 140
             // Ajout parametrage Male / Indien (Après 2010)
    
    132
    -        createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, secondStartDate, null);
    
    141
    +        createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, sizeMeasureType,secondStartDate, null);
    
    133 142
     
    
    134 143
         }
    
    135 144
     
    
    ... ... @@ -149,6 +158,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    149 158
             SpeciesTopiaDao speciesDAO = persistenceContext.getSpeciesDao();
    
    150 159
             OceanTopiaDao oceanDAO = persistenceContext.getOceanDao();
    
    151 160
             SexTopiaDao sexDao = persistenceContext.getSexDao();
    
    161
    +        SizeMeasureTypeTopiaDao sizeMeasureTypeDao = persistenceContext.getSizeMeasureTypeDao();
    
    152 162
     
    
    153 163
             Optional<Species> optionalSpecies = Optional.ofNullable(speciesDAO.forFaoCodeEquals("ALB").tryFindUnique().orNull());
    
    154 164
             Assert.assertTrue("Could not find species with faoCode: DOL", optionalSpecies.isPresent());
    
    ... ... @@ -184,47 +194,52 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    184 194
             Ocean indianOcean = optionalIndianOcean.orElse(null);
    
    185 195
             Ocean pacificOcean = optionalPacificOcean.orElse(null);
    
    186 196
     
    
    187
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2009, date1970);
    
    188
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2009, date1970);
    
    189
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, undeterminedSex, date2009, date1970);
    
    190
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2009, date1970);
    
    191 197
     
    
    192
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2010, date1970);
    
    193
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2010, date1970);
    
    194
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2010, date2010);
    
    195
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2010, date1970);
    
    198
    +        Optional<SizeMeasureType> optionalSizeMeasureType = Optional.ofNullable(sizeMeasureTypeDao.forCodeEquals("FL").tryFindUnique().orNull());
    
    199
    +        Assert.assertTrue("Could not find sizeMeasureType with code FL", optionalSizeMeasureType.isPresent());
    
    200
    +        SizeMeasureType sizeMeasureType = optionalSizeMeasureType.get();
    
    201
    +
    
    202
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2009, date1970,sizeMeasureType);
    
    203
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2009, date1970,sizeMeasureType);
    
    204
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, undeterminedSex, date2009, date1970,sizeMeasureType);
    
    205
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2009, date1970,sizeMeasureType);
    
    206
    +
    
    207
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2010, date1970,sizeMeasureType);
    
    208
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2010, date1970,sizeMeasureType);
    
    209
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2010, date2010,sizeMeasureType);
    
    210
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2010, date1970,sizeMeasureType);
    
    196 211
     
    
    197
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2011, date1970);
    
    198
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2011, date1970);
    
    199
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2011, date2011);
    
    200
    -        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2011, date1970);
    
    212
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2011, date1970,sizeMeasureType);
    
    213
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2011, date1970,sizeMeasureType);
    
    214
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2011, date2011,sizeMeasureType);
    
    215
    +        assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2011, date1970,sizeMeasureType);
    
    201 216
     
    
    202 217
             // this test is now working!!! since we manage now perfectly null-null date range
    
    203
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null);
    
    204
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null);
    
    205
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, undeterminedSex, date2009, null);
    
    206
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2009, null);
    
    218
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null,sizeMeasureType);
    
    219
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null,sizeMeasureType);
    
    220
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, undeterminedSex, date2009, null,sizeMeasureType);
    
    221
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2009, null,sizeMeasureType);
    
    207 222
     
    
    208
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2010, null);
    
    209
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2010, date2010);
    
    210
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2010, null);
    
    223
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2010, null,sizeMeasureType);
    
    224
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2010, date2010,sizeMeasureType);
    
    225
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2010, null,sizeMeasureType);
    
    211 226
     
    
    212
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2011, null);
    
    213
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2011, date2011);
    
    214
    -        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2011, null);
    
    227
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2011, null,sizeMeasureType);
    
    228
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2011, date2011,sizeMeasureType);
    
    229
    +        assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2011, null,sizeMeasureType);
    
    215 230
     
    
    216
    -        assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, undeterminedSex, date2010);
    
    217
    -        assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, maleSex, date2010);
    
    218
    -        assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, femaleSex, date2010);
    
    231
    +        assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, undeterminedSex, date2010,sizeMeasureType);
    
    232
    +        assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, maleSex, date2010,sizeMeasureType);
    
    233
    +        assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, femaleSex, date2010,sizeMeasureType);
    
    219 234
     
    
    220 235
         }
    
    221 236
     
    
    222
    -    protected void assertFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Sex expectedSex, Date date, Date expectedStartDate) {
    
    237
    +    protected void assertFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Sex expectedSex, Date date, Date expectedStartDate,SizeMeasureType expectedSizeMeasureType) {
    
    223 238
     
    
    224 239
             if (log.isInfoEnabled()) {
    
    225 240
                 log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date);
    
    226 241
             }
    
    227
    -        LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, null);
    
    242
    +        LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, expectedSizeMeasureType);
    
    228 243
     
    
    229 244
             Assert.assertNotNull("length weith parameter not found for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date, lengthWeightParameter);
    
    230 245
             Assert.assertEquals("Expected sex is " + expectedSex.getLabel1() + " but the one found was " + lengthWeightParameter.getSex().getLabel1(), expectedSex, lengthWeightParameter.getSex());
    
    ... ... @@ -234,13 +249,13 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport {
    234 249
             }
    
    235 250
         }
    
    236 251
     
    
    237
    -    protected void assertNotFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Date date) {
    
    252
    +    protected void assertNotFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Date date,SizeMeasureType expectedSizeMeasureType) {
    
    238 253
     
    
    239 254
             if (log.isInfoEnabled()) {
    
    240 255
                 log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date);
    
    241 256
             }
    
    242 257
             try {
    
    243
    -            LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, null);
    
    258
    +            LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, expectedSizeMeasureType);
    
    244 259
                 Assert.fail();
    
    245 260
             } catch (LengthWeightParameterNotFoundException e) {
    
    246 261
     
    

  • services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java
    ... ... @@ -178,7 +178,7 @@ public class ValidateServiceLocalTest extends ServiceLocalTestSupport {
    178 178
             assertValidateResult(result, SexDto.class, 2);
    
    179 179
             assertValidateResult(result, SensorBrandDto.class, 1);
    
    180 180
             assertValidateResult(result, LightsticksColorDto.class, 2);
    
    181
    -        assertValidateResult(result, LengthWeightParameterDto.class, 4);
    
    181
    +        assertValidateResult(result, LengthWeightParameterDto.class, 3);
    
    182 182
             assertValidateResult(result, LengthLengthParameterDto.class, 0);
    
    183 183
             assertValidateResult(result, GearCaracteristicTypeDto.class, 2);
    
    184 184
             assertValidateResult(result, ObjectOperationDto.class, 2);
    

  • services/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0.9-SNAPSHOT</version>
    
    30
    +    <version>7.1.0-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>services</artifactId>
    

  • test/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>test</artifactId>
    

  • test/src/main/java/fr/ird/observe/test/ObserveFixtures.java
    ... ... @@ -253,7 +253,7 @@ public class ObserveFixtures {
    253 253
                 .put("observe_common.harbour", 74L)
    
    254 254
                 .put("observe_common.lastupdatedate", 104L)
    
    255 255
                 .put("observe_common.lengthlengthparameter", 0L)
    
    256
    -            .put("observe_common.lengthweightparameter", 365L)
    
    256
    +            .put("observe_common.lengthweightparameter", 361L)
    
    257 257
                 .put("observe_common.ocean", 3L)
    
    258 258
                 .put("observe_common.ocean_species", 500L)
    
    259 259
                 .put("observe_common.organism", 9L)
    

  • test/src/main/resources/db/7.1/dataForTestLongline.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.1/dataForTestSeine.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.1/empty_h2.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.1/empty_pg.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.1/referentiel.sql.gz
    No preview for this file type
  • validation/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0.9-SNAPSHOT</version>
    
    29
    +    <version>7.1.0-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>validation</artifactId>