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

Commits:

25 changed files:

Changes:

  • .mvn/deploy

  • pom.xml
    ... ... @@ -23,7 +23,7 @@
    23 23
       <parent>
    
    24 24
         <groupId>io.ultreia.maven</groupId>
    
    25 25
         <artifactId>pom</artifactId>
    
    26
    -    <version>2018.20</version>
    
    26
    +    <version>2018.21</version>
    
    27 27
       </parent>
    
    28 28
     
    
    29 29
       <groupId>fr.ird.t3</groupId>
    
    ... ... @@ -132,9 +132,6 @@
    132 132
         <gitlab.changesAuthorEmail>dev@tchemit.fr</gitlab.changesAuthorEmail>
    
    133 133
         <gitlab.trackers>Anomalie,Evolution,Tâche</gitlab.trackers>
    
    134 134
     
    
    135
    -    <!-- deploy nothing -->
    
    136
    -    <maven.deploy.skip>true</maven.deploy.skip>
    
    137
    -
    
    138 135
       </properties>
    
    139 136
     
    
    140 137
       <dependencyManagement>
    
    ... ... @@ -461,7 +458,7 @@
    461 458
                 <artifactId>wagon-maven-plugin</artifactId>
    
    462 459
                 <executions>
    
    463 460
                   <execution>
    
    464
    -                <id>get-referential-files</id>
    
    461
    +                <id>get-h2-files</id>
    
    465 462
                     <phase>test-compile</phase>
    
    466 463
                     <goals>
    
    467 464
                       <goal>download-single</goal>
    
    ... ... @@ -469,7 +466,7 @@
    469 466
                     <configuration>
    
    470 467
                       <serverId>doc.ultreia.io</serverId>
    
    471 468
                       <url>scpexe://ultreia.io/var/www/t3/private</url>
    
    472
    -                  <fromFile>t3-data-${t3-data.version}-referential.zip</fromFile>
    
    469
    +                  <fromFile>t3-data-${t3-data.version}-h2.zip</fromFile>
    
    473 470
                       <toDir>${project.build.directory}</toDir>
    
    474 471
                     </configuration>
    
    475 472
                   </execution>
    

  • t3-domain/.mvn/deploy

  • t3-domain/pom.xml
    ... ... @@ -37,6 +37,11 @@
    37 37
         <config.generatePropertyChangeSupport>true</config.generatePropertyChangeSupport>
    
    38 38
         <config.packageName>fr.ird.t3</config.packageName>
    
    39 39
         <config.useNuitonI18n>true</config.useNuitonI18n>
    
    40
    +
    
    41
    +    <maven.deploy.skip>false</maven.deploy.skip>
    
    42
    +    <maven.javadoc.skip>false</maven.javadoc.skip>
    
    43
    +    <maven.source.skip>false</maven.source.skip>
    
    44
    +    <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
    
    40 45
       </properties>
    
    41 46
     
    
    42 47
       <dependencies>
    
    ... ... @@ -107,6 +112,10 @@
    107 112
           <groupId>com.google.guava</groupId>
    
    108 113
           <artifactId>guava</artifactId>
    
    109 114
         </dependency>
    
    115
    +    <dependency>
    
    116
    +      <groupId>com.google.code.gson</groupId>
    
    117
    +      <artifactId>gson</artifactId>
    
    118
    +    </dependency>
    
    110 119
     
    
    111 120
         <dependency>
    
    112 121
           <groupId>com.google.auto.service</groupId>
    

  • t3-domain/src/main/java/fr/ird/t3/entities/T3JdbcHelper.java
    ... ... @@ -21,6 +21,17 @@ package fr.ird.t3.entities;
    21 21
      * #L%
    
    22 22
      */
    
    23 23
     
    
    24
    +import com.google.common.base.Preconditions;
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    26
    +import com.google.common.collect.Lists;
    
    27
    +import org.apache.commons.logging.Log;
    
    28
    +import org.apache.commons.logging.LogFactory;
    
    29
    +import org.nuiton.topia.persistence.jdbc.JdbcConfiguration;
    
    30
    +import org.nuiton.topia.persistence.jdbc.JdbcHelper;
    
    31
    +import org.nuiton.util.ZipUtil;
    
    32
    +import org.nuiton.util.sql.SqlFileReader;
    
    33
    +import org.nuiton.version.Version;
    
    34
    +
    
    24 35
     import java.io.BufferedReader;
    
    25 36
     import java.io.File;
    
    26 37
     import java.io.IOException;
    
    ... ... @@ -29,12 +40,12 @@ import java.io.InputStreamReader;
    29 40
     import java.io.Reader;
    
    30 41
     import java.nio.charset.StandardCharsets;
    
    31 42
     import java.nio.file.Files;
    
    43
    +import java.nio.file.Paths;
    
    32 44
     import java.sql.Connection;
    
    33 45
     import java.sql.SQLException;
    
    34 46
     import java.sql.Statement;
    
    35
    -import org.nuiton.topia.persistence.jdbc.JdbcConfiguration;
    
    36
    -import org.nuiton.topia.persistence.jdbc.JdbcHelper;
    
    37
    -import org.nuiton.util.sql.SqlFileReader;
    
    47
    +import java.util.Collections;
    
    48
    +import java.util.List;
    
    38 49
     
    
    39 50
     /**
    
    40 51
      * Created by tchemit on 03/04/17.
    
    ... ... @@ -43,7 +54,9 @@ import org.nuiton.util.sql.SqlFileReader;
    43 54
      */
    
    44 55
     public class T3JdbcHelper extends JdbcHelper {
    
    45 56
     
    
    46
    -    public static final int BUZZER_SIZE = 100;
    
    57
    +    private static final Log log = LogFactory.getLog(T3JdbcHelper.class);
    
    58
    +
    
    59
    +    private static final int BUZZER_SIZE = 100;
    
    47 60
     
    
    48 61
         T3JdbcHelper(JdbcConfiguration jdbcConfiguration) {
    
    49 62
             super(jdbcConfiguration);
    
    ... ... @@ -120,4 +133,49 @@ public class T3JdbcHelper extends JdbcHelper {
    120 133
             runSelectOnString("SCRIPT TO '" + file.getAbsolutePath() + "'" + options);
    
    121 134
         }
    
    122 135
     
    
    136
    +    public static File getScriptsDirectory(File buildRootDirectory, String classifier, Version version) throws IOException {
    
    137
    +
    
    138
    +        File scriptsZip = Paths.get(buildRootDirectory.getAbsolutePath())
    
    139
    +                .resolve("target")
    
    140
    +                .resolve(String.format("t3-data-%s-%s.zip", version, classifier))
    
    141
    +                .toFile();
    
    142
    +        ZipUtil.uncompress(scriptsZip, scriptsZip.getParentFile());
    
    143
    +
    
    144
    +        File target = Paths.get(buildRootDirectory.getAbsolutePath())
    
    145
    +                .resolve("target")
    
    146
    +                .resolve(String.format("t3-data-%s-%s", classifier, version))
    
    147
    +                .toFile();
    
    148
    +        Preconditions.checkState(target.exists(), "Could not find script directory: " + target);
    
    149
    +        if (log.isInfoEnabled()) {
    
    150
    +            log.info(String.format("Scripts directory: %s", target));
    
    151
    +        }
    
    152
    +        return target;
    
    153
    +    }
    
    154
    +
    
    155
    +    public static void importReferential(File buildRootDirectory, Version t3DataVersion, T3JdbcHelper jdbcH2Helper) throws IOException {
    
    156
    +
    
    157
    +        File scriptsDirectory = getScriptsDirectory(buildRootDirectory, "referential", t3DataVersion);
    
    158
    +
    
    159
    +        String[] list = scriptsDirectory.list((dir, name) -> name.endsWith(".sql"));
    
    160
    +        ImmutableSet.Builder<File> filesBuilder = ImmutableSet.builder();
    
    161
    +        if (list != null) {
    
    162
    +            List<String> scriptsName = Lists.newArrayList(list);
    
    163
    +            Collections.sort(scriptsName);
    
    164
    +            for (String ddlScriptName : scriptsName) {
    
    165
    +                filesBuilder.add(new File(scriptsDirectory, ddlScriptName));
    
    166
    +            }
    
    167
    +        }
    
    168
    +        ImmutableSet<File> scriptsFile = filesBuilder.build();
    
    169
    +
    
    170
    +        if (log.isInfoEnabled()) {
    
    171
    +            log.info("Will load referentiel in h2 database ");
    
    172
    +        }
    
    173
    +
    
    174
    +        for (File file : scriptsFile) {
    
    175
    +            if (log.isInfoEnabled()) {
    
    176
    +                log.info(" o Loading sql script ...(" + file.getName() + ")");
    
    177
    +            }
    
    178
    +            jdbcH2Helper.executeSql(file);
    
    179
    +        }
    
    180
    +    }
    
    123 181
     }

  • t3-domain/src/main/java/fr/ird/t3/entities/T3TopiaApplicationContext.java
    ... ... @@ -24,12 +24,8 @@ package fr.ird.t3.entities;
    24 24
     import com.google.common.base.Charsets;
    
    25 25
     import fr.ird.t3.T3IOUtil;
    
    26 26
     import fr.ird.t3.entities.user.JdbcConfiguration;
    
    27
    -import java.io.File;
    
    28
    -import java.io.IOException;
    
    29
    -import java.io.InputStream;
    
    30
    -import java.io.InputStreamReader;
    
    31
    -import java.net.URL;
    
    32
    -import java.util.Properties;
    
    27
    +import org.apache.commons.logging.Log;
    
    28
    +import org.apache.commons.logging.LogFactory;
    
    33 29
     import org.nuiton.topia.persistence.BeanTopiaConfiguration;
    
    34 30
     import org.nuiton.topia.persistence.HibernateAvailableSettings;
    
    35 31
     import org.nuiton.topia.persistence.TopiaConfiguration;
    
    ... ... @@ -37,11 +33,19 @@ import org.nuiton.topia.persistence.TopiaConfigurationBuilder;
    37 33
     import org.nuiton.topia.persistence.TopiaException;
    
    38 34
     import org.nuiton.util.RecursiveProperties;
    
    39 35
     
    
    36
    +import java.io.File;
    
    37
    +import java.io.IOException;
    
    38
    +import java.io.InputStream;
    
    39
    +import java.io.InputStreamReader;
    
    40
    +import java.net.URL;
    
    41
    +import java.util.Objects;
    
    42
    +import java.util.Properties;
    
    43
    +
    
    40 44
     public class T3TopiaApplicationContext extends AbstractT3TopiaApplicationContext {
    
    41 45
     
    
    42 46
         private static final String T3_EMBEDDED_DB_PROPERTIES = "/t3-TopiaContextImpl.properties";
    
    43
    -
    
    44 47
         private static final String T3_USER_DB_PROPERTIES = "/t3-datadb.properties";
    
    48
    +    private static final Log log = LogFactory.getLog(T3TopiaApplicationContext.class);
    
    45 49
     
    
    46 50
         /**
    
    47 51
          * Open a new topia root context from the given jdbc configuration.
    
    ... ... @@ -81,8 +85,7 @@ public class T3TopiaApplicationContext extends AbstractT3TopiaApplicationContext
    81 85
     
    
    82 86
     
    
    83 87
         /**
    
    84
    -     * Open a new topia root context for the user t3 db using a embedded db (
    
    85
    -     * this should be a h2 db).
    
    88
    +     * Open a new topia root context for the user t3 db using a embedded db (this should be a h2 db).
    
    86 89
          * <p/>
    
    87 90
          * This is mainly used by tests.
    
    88 91
          *
    
    ... ... @@ -107,6 +110,35 @@ public class T3TopiaApplicationContext extends AbstractT3TopiaApplicationContext
    107 110
             return new T3TopiaApplicationContext(topiaConfiguration);
    
    108 111
         }
    
    109 112
     
    
    113
    +    /**
    
    114
    +     * Open a new topia root context for the user t3 db using a embedded db (this should be a h2 db).
    
    115
    +     * <p/>
    
    116
    +     * This is mainly used by tests.
    
    117
    +     *
    
    118
    +     * @param dbLocation file where to store the db.
    
    119
    +     * @param backupFile backup file to load in db
    
    120
    +     * @return the new fresh root context of the db
    
    121
    +     */
    
    122
    +    public static T3TopiaApplicationContext newEmbeddedBackupDb(File dbLocation, File backupFile) {
    
    123
    +
    
    124
    +        Properties configuration = new Properties();
    
    125
    +
    
    126
    +        try (InputStream stream = T3TopiaApplicationContext.class.getResourceAsStream(T3_EMBEDDED_DB_PROPERTIES)) {
    
    127
    +            configuration.load(stream);
    
    128
    +        } catch (IOException e) {
    
    129
    +            throw new TopiaException("Could not load input file " + T3_EMBEDDED_DB_PROPERTIES, e);
    
    130
    +        }
    
    131
    +
    
    132
    +        configuration.put(HibernateAvailableSettings.URL, "jdbc:h2:file:" + dbLocation);
    
    133
    +        BeanTopiaConfiguration topiaConfiguration = new TopiaConfigurationBuilder().readProperties(configuration);
    
    134
    +        topiaConfiguration.setValidateSchema(false);
    
    135
    +        topiaConfiguration.setInitSchema(false);
    
    136
    +        T3TopiaApplicationContext topiaApplicationContext = new T3TopiaApplicationContext(topiaConfiguration);
    
    137
    +        log.info("Laoding database from a backup: " + backupFile);
    
    138
    +        topiaApplicationContext.newJdbcHelper().executeSql(Objects.requireNonNull(backupFile));
    
    139
    +        return topiaApplicationContext;
    
    140
    +    }
    
    141
    +
    
    110 142
         public T3JdbcHelper newJdbcHelper() {
    
    111 143
             return new T3JdbcHelper(getConfiguration());
    
    112 144
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/AbstractWeightCategoryLogBookConvertor.java
    ... ... @@ -20,14 +20,16 @@
    20 20
      */
    
    21 21
     package fr.ird.t3.entities.conversion;
    
    22 22
     
    
    23
    -import com.google.common.collect.Maps;
    
    24 23
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    25 24
     import fr.ird.t3.entities.reference.Ocean;
    
    26 25
     import fr.ird.t3.entities.reference.SchoolType;
    
    27 26
     import fr.ird.t3.entities.reference.WeightCategoryTreatment;
    
    27
    +import org.apache.commons.collections.CollectionUtils;
    
    28
    +
    
    28 29
     import java.util.Collection;
    
    30
    +import java.util.HashMap;
    
    31
    +import java.util.LinkedHashMap;
    
    29 32
     import java.util.Map;
    
    30
    -import org.apache.commons.collections.CollectionUtils;
    
    31 33
     
    
    32 34
     /**
    
    33 35
      * Abstract log book convertor.
    
    ... ... @@ -122,8 +124,7 @@ public abstract class AbstractWeightCategoryLogBookConvertor implements WeightCa
    122 124
     
    
    123 125
             if (CollectionUtils.isNotEmpty(catches)) {
    
    124 126
                 for (ElementaryCatch aCatch : catches) {
    
    125
    -                Integer weightCategoryCode =
    
    126
    -                        aCatch.getWeightCategoryLogBook().getCode();
    
    127
    +                Integer weightCategoryCode = aCatch.getWeightCategoryLogBook().getCode();
    
    127 128
                     Float ratio = distribution.get(weightCategoryCode);
    
    128 129
                     if (ratio != null) {
    
    129 130
                         result += ratio * aCatch.getCatchWeightRf2();
    
    ... ... @@ -141,6 +142,7 @@ public abstract class AbstractWeightCategoryLogBookConvertor implements WeightCa
    141 142
          *
    
    142 143
          * @return the distributions
    
    143 144
          */
    
    145
    +    @Override
    
    144 146
         public Map<WeightCategoryTreatment, Map<Integer, Float>> getDistributions() {
    
    145 147
             if (distributions == null) {
    
    146 148
                 distributions = buildDistributions();
    
    ... ... @@ -149,6 +151,20 @@ public abstract class AbstractWeightCategoryLogBookConvertor implements WeightCa
    149 151
         }
    
    150 152
     
    
    151 153
         @Override
    
    154
    +    public Map<String, Map<Integer, Float>> getDistributionsByIds() {
    
    155
    +        Map<String, Map<Integer, Float>> distributionsToSave = new LinkedHashMap<>();
    
    156
    +        for (Map.Entry<WeightCategoryTreatment, Map<Integer, Float>> e : getDistributions().entrySet()) {
    
    157
    +            distributionsToSave.put(e.getKey().getTopiaId(), e.getValue());
    
    158
    +        }
    
    159
    +        return distributionsToSave;
    
    160
    +    }
    
    161
    +
    
    162
    +    @Override
    
    163
    +    public Map<Integer, Float> getDistributions(WeightCategoryTreatment treatment) {
    
    164
    +        return getDistributions().get(treatment);
    
    165
    +    }
    
    166
    +
    
    167
    +    @Override
    
    152 168
         public final WeightCategoryTreatment getMinus10Category() {
    
    153 169
             return minus10Category;
    
    154 170
         }
    
    ... ... @@ -165,12 +181,11 @@ public abstract class AbstractWeightCategoryLogBookConvertor implements WeightCa
    165 181
                 Map<WeightCategoryTreatment, Map<Integer, Float>> distributions,
    
    166 182
                 float unknownWeight) {
    
    167 183
     
    
    168
    -        Map<WeightCategoryTreatment, Float> unknownResult = Maps.newHashMap();
    
    184
    +        Map<WeightCategoryTreatment, Float> unknownResult = new HashMap<>();
    
    169 185
     
    
    170 186
             float totalWeight = 0f;
    
    171 187
     
    
    172
    -        for (Map.Entry<WeightCategoryTreatment, Map<Integer, Float>> e :
    
    173
    -                distributions.entrySet()) {
    
    188
    +        for (Map.Entry<WeightCategoryTreatment, Map<Integer, Float>> e : distributions.entrySet()) {
    
    174 189
     
    
    175 190
                 WeightCategoryTreatment category = e.getKey();
    
    176 191
     
    
    ... ... @@ -193,7 +208,7 @@ public abstract class AbstractWeightCategoryLogBookConvertor implements WeightCa
    193 208
             } else {
    
    194 209
     
    
    195 210
                 // there is some unknown weight to redistribute
    
    196
    -            result = Maps.newHashMap();
    
    211
    +            result = new HashMap<>();
    
    197 212
     
    
    198 213
                 if (totalWeight == 0) {
    
    199 214
     
    
    ... ... @@ -224,9 +239,9 @@ public abstract class AbstractWeightCategoryLogBookConvertor implements WeightCa
    224 239
         protected final Map<WeightCategoryTreatment, Float> defaultDistributeForSpecie2(
    
    225 240
                 float totalWeight) {
    
    226 241
     
    
    227
    -        Map<WeightCategoryTreatment, Float> result = Maps.newHashMap();
    
    242
    +        Map<WeightCategoryTreatment, Float> result = new HashMap<>();
    
    228 243
     
    
    229
    -        // for species SKJ (code 2) : all goes to -10 kg categorie
    
    244
    +        // for species SKJ (code 2) : all goes to -10 kg category
    
    230 245
             result.put(getMinus10Category(), totalWeight);
    
    231 246
             return result;
    
    232 247
         }
    
    ... ... @@ -234,9 +249,9 @@ public abstract class AbstractWeightCategoryLogBookConvertor implements WeightCa
    234 249
         protected final Map<WeightCategoryTreatment, Float> defaultDistributeForOtherSpecie(
    
    235 250
                 float unknownWeight) {
    
    236 251
     
    
    237
    -        Map<WeightCategoryTreatment, Float> result = Maps.newHashMap();
    
    252
    +        Map<WeightCategoryTreatment, Float> result = new HashMap<>();
    
    238 253
     
    
    239
    -        // only keep unknown categorie weight
    
    254
    +        // only keep unknown category weight
    
    240 255
             result.put(getUnkownCategory(), unknownWeight);
    
    241 256
             return result;
    
    242 257
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertor.java
    ... ... @@ -25,6 +25,7 @@ import fr.ird.t3.entities.reference.Ocean;
    25 25
     import fr.ird.t3.entities.reference.SchoolType;
    
    26 26
     import fr.ird.t3.entities.reference.Species;
    
    27 27
     import fr.ird.t3.entities.reference.WeightCategoryTreatment;
    
    28
    +
    
    28 29
     import java.util.Collection;
    
    29 30
     import java.util.Map;
    
    30 31
     
    
    ... ... @@ -39,8 +40,13 @@ public interface WeightCategoryLogBookConvertor {
    39 40
     
    
    40 41
         boolean accept(Ocean ocean, SchoolType schoolType);
    
    41 42
     
    
    42
    -    Map<WeightCategoryTreatment, Float> distribute(Species species,
    
    43
    -                                                   Collection<ElementaryCatch> catches);
    
    43
    +    Map<WeightCategoryTreatment, Float> distribute(Species species, Collection<ElementaryCatch> catches);
    
    44
    +
    
    45
    +    Map<String, Map<Integer, Float>> getDistributionsByIds() ;
    
    46
    +
    
    47
    +    Map<WeightCategoryTreatment, Map<Integer, Float>> getDistributions();
    
    48
    +
    
    49
    +    Map<Integer, Float> getDistributions(WeightCategoryTreatment treatment);
    
    44 50
     
    
    45 51
         WeightCategoryTreatment getMinus10Category();
    
    46 52
     
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OABI.java
    ... ... @@ -20,12 +20,14 @@
    20 20
      */
    
    21 21
     package fr.ird.t3.entities.conversion;
    
    22 22
     
    
    23
    -import com.google.common.collect.Maps;
    
    24 23
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    25 24
     import fr.ird.t3.entities.reference.Species;
    
    26 25
     import fr.ird.t3.entities.reference.WeightCategoryTreatment;
    
    26
    +
    
    27 27
     import java.util.Collection;
    
    28
    +import java.util.HashMap;
    
    28 29
     import java.util.Map;
    
    30
    +import java.util.TreeMap;
    
    29 31
     
    
    30 32
     /**
    
    31 33
      * To convert weight categories for Atlantic ocean and undetermined school type.
    
    ... ... @@ -45,19 +47,16 @@ public class WeightCategoryLogBookConvertorFOR_OABI extends AbstractWeightCatego
    45 47
                 WeightCategoryTreatment plus10Category,
    
    46 48
                 WeightCategoryTreatment plus30Category) {
    
    47 49
     
    
    48
    -        super(WeightCategoryLogBookConvertorProvider.OA,
    
    49
    -              WeightCategoryLogBookConvertorProvider.BI,
    
    50
    -              minus10Category, unknownCategory);
    
    50
    +        super(WeightCategoryLogBookConvertorProvider.OA, WeightCategoryLogBookConvertorProvider.BI, minus10Category, unknownCategory);
    
    51 51
             this.plus10Category = plus10Category;
    
    52 52
             this.plus30Category = plus30Category;
    
    53 53
         }
    
    54 54
     
    
    55 55
         @Override
    
    56 56
         protected Map<WeightCategoryTreatment, Map<Integer, Float>> buildDistributions() {
    
    57
    -        Map<WeightCategoryTreatment, Map<Integer, Float>> result =
    
    58
    -                Maps.newHashMap();
    
    57
    +        Map<WeightCategoryTreatment, Map<Integer, Float>> result = new HashMap<>();
    
    59 58
     
    
    60
    -        Map<Integer, Float> distributionMinus10 = Maps.newTreeMap();
    
    59
    +        Map<Integer, Float> distributionMinus10 = new TreeMap<>();
    
    61 60
     
    
    62 61
             // 1 + 2 + 4*(0.2) + 10
    
    63 62
             distributionMinus10.put(1, 1f);
    
    ... ... @@ -68,7 +67,7 @@ public class WeightCategoryLogBookConvertorFOR_OABI extends AbstractWeightCatego
    68 67
             result.put(minus10Category, distributionMinus10);
    
    69 68
     
    
    70 69
             // 3 + 4*(0.8) + 6*(0.5) + 11*(0.1) + 12
    
    71
    -        Map<Integer, Float> distributionPlus10 = Maps.newTreeMap();
    
    70
    +        Map<Integer, Float> distributionPlus10 = new TreeMap<>();
    
    72 71
             distributionPlus10.put(3, 1f);
    
    73 72
             distributionPlus10.put(4, 0.8f);
    
    74 73
             distributionPlus10.put(6, 0.5f);
    
    ... ... @@ -78,7 +77,7 @@ public class WeightCategoryLogBookConvertorFOR_OABI extends AbstractWeightCatego
    78 77
             result.put(plus10Category, distributionPlus10);
    
    79 78
     
    
    80 79
             // 5 + 6*(0.5) + 7 + 8 + 11*(0.9) + 13
    
    81
    -        Map<Integer, Float> distributionPlus30 = Maps.newTreeMap();
    
    80
    +        Map<Integer, Float> distributionPlus30 = new TreeMap<>();
    
    82 81
             distributionPlus30.put(5, 1f);
    
    83 82
             distributionPlus30.put(6, 0.5f);
    
    84 83
             distributionPlus30.put(7, 1f);
    
    ... ... @@ -92,14 +91,13 @@ public class WeightCategoryLogBookConvertorFOR_OABI extends AbstractWeightCatego
    92 91
         }
    
    93 92
     
    
    94 93
         @Override
    
    95
    -    public final Map<WeightCategoryTreatment, Float> distribute(Species species,
    
    96
    -                                                                Collection<ElementaryCatch> catches) {
    
    94
    +    public final Map<WeightCategoryTreatment, Float> distribute(Species species, Collection<ElementaryCatch> catches) {
    
    97 95
     
    
    98 96
             float totalWeight = getTotalWeight(catches);
    
    99 97
             if (totalWeight == 0) {
    
    100 98
     
    
    101 99
                 // this means no catches
    
    102
    -            return Maps.newHashMap();
    
    100
    +            return new HashMap<>();
    
    103 101
             }
    
    104 102
     
    
    105 103
             Map<WeightCategoryTreatment, Float> result;
    
    ... ... @@ -111,20 +109,22 @@ public class WeightCategoryLogBookConvertorFOR_OABI extends AbstractWeightCatego
    111 109
     
    
    112 110
                     float unknownWeight = getUnknownWeight(catches);
    
    113 111
     
    
    114
    -                result = defaultDistributeForSpecie1or3or4(catches,
    
    115
    -                                                           getDistributions(),
    
    116
    -                                                           unknownWeight
    
    117
    -                );
    
    112
    +                result = defaultDistributeForSpecie1or3or4(catches, getDistributions(), unknownWeight);
    
    118 113
     
    
    119 114
                     break;
    
    120 115
                 case 2:
    
    121
    -
    
    122
    -                result = defaultDistributeForSpecie2(totalWeight);
    
    123
    -
    
    116
    +//                result = defaultDistributeForSpecie2(totalWeight);
    
    117
    +                result = new HashMap<>();
    
    118
    +                // for species SKJ (code 2) : all goes to -10 kg category
    
    119
    +                result.put(getMinus10Category(), totalWeight);
    
    124 120
                     break;
    
    125 121
                 default:
    
    126 122
     
    
    127
    -                result = defaultDistributeForOtherSpecie(totalWeight);
    
    123
    +//                result = defaultDistributeForOtherSpecie(totalWeight);
    
    124
    +                result = new HashMap<>();
    
    125
    +
    
    126
    +                // only keep unknown category weight
    
    127
    +                result.put(getUnkownCategory(), totalWeight);
    
    128 128
             }
    
    129 129
             return result;
    
    130 130
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OIBI.java
    ... ... @@ -20,12 +20,14 @@
    20 20
      */
    
    21 21
     package fr.ird.t3.entities.conversion;
    
    22 22
     
    
    23
    -import com.google.common.collect.Maps;
    
    24 23
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    25 24
     import fr.ird.t3.entities.reference.Species;
    
    26 25
     import fr.ird.t3.entities.reference.WeightCategoryTreatment;
    
    26
    +
    
    27 27
     import java.util.Collection;
    
    28
    +import java.util.HashMap;
    
    28 29
     import java.util.Map;
    
    30
    +import java.util.TreeMap;
    
    29 31
     
    
    30 32
     /**
    
    31 33
      * To convert weight categories for Indian ocean and undetermined school type.
    
    ... ... @@ -50,11 +52,10 @@ public class WeightCategoryLogBookConvertorFOR_OIBI extends AbstractWeightCatego
    50 52
     
    
    51 53
         @Override
    
    52 54
         protected Map<WeightCategoryTreatment, Map<Integer, Float>> buildDistributions() {
    
    53
    -        Map<WeightCategoryTreatment, Map<Integer, Float>> result =
    
    54
    -                Maps.newHashMap();
    
    55
    +        Map<WeightCategoryTreatment, Map<Integer, Float>> result = new HashMap<>();
    
    55 56
     
    
    56 57
             // 1 + 2 + 4*(0.2) + 10
    
    57
    -        Map<Integer, Float> distributionMinus10 = Maps.newTreeMap();
    
    58
    +        Map<Integer, Float> distributionMinus10 = new TreeMap<>();
    
    58 59
             distributionMinus10.put(1, 1f);
    
    59 60
             distributionMinus10.put(2, 1f);
    
    60 61
             distributionMinus10.put(4, 0.2f);
    
    ... ... @@ -63,7 +64,7 @@ public class WeightCategoryLogBookConvertorFOR_OIBI extends AbstractWeightCatego
    63 64
             result.put(minus10Category, distributionMinus10);
    
    64 65
     
    
    65 66
             // 3 + 4*(0.8) + 5 + 6 + 7 + 8 + 11 + 12 + 13
    
    66
    -        Map<Integer, Float> distributionPlus10 = Maps.newTreeMap();
    
    67
    +        Map<Integer, Float> distributionPlus10 = new TreeMap<>();
    
    67 68
             distributionPlus10.put(3, 1f);
    
    68 69
             distributionPlus10.put(4, 0.8f);
    
    69 70
             distributionPlus10.put(5, 1f);
    
    ... ... @@ -79,14 +80,13 @@ public class WeightCategoryLogBookConvertorFOR_OIBI extends AbstractWeightCatego
    79 80
         }
    
    80 81
     
    
    81 82
         @Override
    
    82
    -    public final Map<WeightCategoryTreatment, Float> distribute(Species species,
    
    83
    -                                                                Collection<ElementaryCatch> catches) {
    
    83
    +    public final Map<WeightCategoryTreatment, Float> distribute(Species species, Collection<ElementaryCatch> catches) {
    
    84 84
     
    
    85 85
             float totalWeight = getTotalWeight(catches);
    
    86 86
             if (totalWeight == 0) {
    
    87 87
     
    
    88 88
                 // this means no catches
    
    89
    -            return Maps.newHashMap();
    
    89
    +            return new HashMap<>();
    
    90 90
             }
    
    91 91
     
    
    92 92
             Map<WeightCategoryTreatment, Float> result;
    
    ... ... @@ -95,22 +95,13 @@ public class WeightCategoryLogBookConvertorFOR_OIBI extends AbstractWeightCatego
    95 95
                 case 1:
    
    96 96
                 case 3:
    
    97 97
                 case 4:
    
    98
    -
    
    99 98
                     float unknownWeight = getUnknownWeight(catches);
    
    100
    -
    
    101
    -                result = defaultDistributeForSpecie1or3or4(catches,
    
    102
    -                                                           getDistributions(),
    
    103
    -                                                           unknownWeight
    
    104
    -                );
    
    105
    -
    
    99
    +                result = defaultDistributeForSpecie1or3or4(catches, getDistributions(), unknownWeight);
    
    106 100
                     break;
    
    107 101
                 case 2:
    
    108
    -
    
    109 102
                     result = defaultDistributeForSpecie2(totalWeight);
    
    110
    -
    
    111 103
                     break;
    
    112 104
                 default:
    
    113
    -
    
    114 105
                     result = defaultDistributeForOtherSpecie(totalWeight);
    
    115 106
             }
    
    116 107
             return result;
    

  • t3-domain/src/main/java/fr/ird/t3/entities/reference/LengthWeightConversionImpl.java
    ... ... @@ -20,29 +20,22 @@
    20 20
      */
    
    21 21
     package fr.ird.t3.entities.reference;
    
    22 22
     
    
    23
    -import com.google.common.collect.Maps;
    
    24 23
     import fr.ird.t3.entities.LengthWeightConversionHelper;
    
    24
    +import org.apache.commons.logging.Log;
    
    25
    +import org.apache.commons.logging.LogFactory;
    
    26
    +
    
    25 27
     import java.util.Map;
    
    28
    +import java.util.TreeMap;
    
    26 29
     import java.util.regex.Matcher;
    
    27 30
     import java.util.regex.Pattern;
    
    28
    -import org.apache.commons.logging.Log;
    
    29
    -import org.apache.commons.logging.LogFactory;
    
    30 31
     
    
    31 32
     public class LengthWeightConversionImpl extends LengthWeightConversionAbstract {
    
    32 33
     
    
    33
    -    /** Logger. */
    
    34
    -    private static final Log log =
    
    35
    -            LogFactory.getLog(LengthWeightConversionImpl.class);
    
    36
    -
    
    34
    +    private static final Log log = LogFactory.getLog(LengthWeightConversionImpl.class);
    
    37 35
         private static final long serialVersionUID = 1L;
    
    38
    -
    
    39
    -
    
    40
    -    private static final Pattern COEFFICIENTS_PATTERN =
    
    41
    -            Pattern.compile("(.+)=(.+)");
    
    42
    -
    
    36
    +    private static final Pattern COEFFICIENTS_PATTERN = Pattern.compile("(.+)=(.+)");
    
    43 37
         /** variable poids à utiliser dans la relation taille */
    
    44 38
         public static final String VARIABLE_POIDS = "P";
    
    45
    -
    
    46 39
         /** variable taille à utiliser dans la relation poids */
    
    47 40
         public static final String VARIABLE_TAILLE = "L";
    
    48 41
     
    
    ... ... @@ -59,19 +52,19 @@ public class LengthWeightConversionImpl extends LengthWeightConversionAbstract {
    59 52
         }
    
    60 53
     
    
    61 54
         @Override
    
    62
    -    public float computeWeight(float longueur) {
    
    55
    +    public Float computeWeight(float longueur) {
    
    63 56
             return LengthWeightConversionHelper.computeWeight(this, longueur);
    
    64 57
         }
    
    65 58
     
    
    66 59
         @Override
    
    67
    -    public float computeWeightFromLFLengthClass(int lengthClass) {
    
    60
    +    public Float computeWeightFromLFLengthClass(int lengthClass) {
    
    68 61
             Integer lfLengthClassStep = species.getLfLengthClassStep();
    
    69 62
             float longueur = lengthClass + lfLengthClassStep / 2f;
    
    70 63
             return LengthWeightConversionHelper.computeWeight(this, longueur);
    
    71 64
         }
    
    72 65
     
    
    73 66
         @Override
    
    74
    -    public float computeLength(float poids) {
    
    67
    +    public Float computeLength(float poids) {
    
    75 68
             return LengthWeightConversionHelper.computeLength(this, poids);
    
    76 69
         }
    
    77 70
     
    
    ... ... @@ -92,31 +85,27 @@ public class LengthWeightConversionImpl extends LengthWeightConversionAbstract {
    92 85
         @Override
    
    93 86
         public Map<String, Double> getCoefficientValues() {
    
    94 87
     
    
    95
    -        Map<String, Double> result = Maps.newTreeMap();
    
    88
    +        Map<String, Double> result = new TreeMap<>();
    
    96 89
             String coefficients = getCoefficients();
    
    97 90
             if (coefficients != null) {
    
    98 91
                 for (String coefficientDef : coefficients.split(":")) {
    
    99
    -                Matcher matcher =
    
    100
    -                        COEFFICIENTS_PATTERN.matcher(coefficientDef.trim());
    
    92
    +                Matcher matcher = COEFFICIENTS_PATTERN.matcher(coefficientDef.trim());
    
    101 93
                     if (log.isDebugEnabled()) {
    
    102
    -                    log.debug("constant to test = " + coefficientDef);
    
    94
    +                    log.debug(String.format("constant to test = %s", coefficientDef));
    
    103 95
                     }
    
    104 96
                     if (matcher.matches()) {
    
    105
    -
    
    106 97
                         String key = matcher.group(1);
    
    107 98
                         String val = matcher.group(2);
    
    108 99
                         try {
    
    109 100
                             Double d = Double.valueOf(val);
    
    110 101
                             result.put(key, d);
    
    111 102
                             if (log.isDebugEnabled()) {
    
    112
    -                            log.debug("detets coefficient " + key + '=' +
    
    113
    -                                              val);
    
    103
    +                            log.debug(String.format("detect coefficient %s=%s", key, val));
    
    114 104
                             }
    
    115 105
                         } catch (NumberFormatException e) {
    
    116 106
                             // pas pu recupere le nombre...
    
    117 107
                             if (log.isWarnEnabled()) {
    
    118
    -                            log.warn("could not parse double " + val +
    
    119
    -                                             " for coefficient " + key);
    
    108
    +                            log.warn(String.format("could not parse double %s for coefficient %s", val, key));
    
    120 109
                             }
    
    121 110
                         }
    
    122 111
                     }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/reference/WeightCategoryLogBookConversionImpl.java
    1
    +package fr.ird.t3.entities.reference;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * T3 :: Domain
    
    6
    + * %%
    
    7
    + * Copyright (C) 2010 - 2018 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 Affero General Public License as published by
    
    11
    + * the Free Software Foundation, either version 3 of the License, or
    
    12
    + * (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 Affero General Public License
    
    20
    + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    21
    + * #L%
    
    22
    + */
    
    23
    +
    
    24
    +import java.util.Date;
    
    25
    +
    
    26
    +public class WeightCategoryLogBookConversionImpl extends WeightCategoryLogBookConversionAbstract {
    
    27
    +
    
    28
    +    private static final long serialVersionUID = 1L;
    
    29
    +
    
    30
    +    @Override
    
    31
    +    public int getCode() {
    
    32
    +        return 0;
    
    33
    +    }
    
    34
    +
    
    35
    +    @Override
    
    36
    +    public String getLabel1() {
    
    37
    +        return null;
    
    38
    +    }
    
    39
    +
    
    40
    +    @Override
    
    41
    +    public boolean isStatus() {
    
    42
    +        return true;
    
    43
    +    }
    
    44
    +
    
    45
    +    @Override
    
    46
    +    public boolean acceptDate(Date date) {
    
    47
    +        return !date.before(getBeginDate()) && (getEndDate() == null || !date.after(getEndDate()));
    
    48
    +    }
    
    49
    +}

  • t3-domain/src/main/java/fr/ird/t3/entities/reference/WeightCategoryLogBookConversionSpeciesImpl.java
    1
    +package fr.ird.t3.entities.reference;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * T3 :: Domain
    
    6
    + * %%
    
    7
    + * Copyright (C) 2010 - 2018 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 Affero General Public License as published by
    
    11
    + * the Free Software Foundation, either version 3 of the License, or
    
    12
    + * (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 Affero General Public License
    
    20
    + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    21
    + * #L%
    
    22
    + */
    
    23
    +
    
    24
    +import com.google.gson.Gson;
    
    25
    +import com.google.gson.GsonBuilder;
    
    26
    +
    
    27
    +import java.util.Map;
    
    28
    +
    
    29
    +public class WeightCategoryLogBookConversionSpeciesImpl extends WeightCategoryLogBookConversionSpeciesAbstract {
    
    30
    +
    
    31
    +    private static final long serialVersionUID = 1L;
    
    32
    +
    
    33
    +    private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
    
    34
    +
    
    35
    +    public static String toString(Map<String, Map<Integer, Float>> distributions) {
    
    36
    +        return gson.toJson(distributions);
    
    37
    +    }
    
    38
    +
    
    39
    +    @Override
    
    40
    +    public int getCode() {
    
    41
    +        return 0;
    
    42
    +    }
    
    43
    +
    
    44
    +    @Override
    
    45
    +    public String getLabel1() {
    
    46
    +        return null;
    
    47
    +    }
    
    48
    +
    
    49
    +    @Override
    
    50
    +    public boolean isStatus() {
    
    51
    +        return true;
    
    52
    +    }
    
    53
    +
    
    54
    +    @SuppressWarnings("unchecked")
    
    55
    +    @Override
    
    56
    +    public Map<String, Map<Integer, Float>> getDistributions2() {
    
    57
    +        return gson.fromJson(getDistribution(), Map.class);
    
    58
    +    }
    
    59
    +}

  • t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_1.java
    ... ... @@ -123,6 +123,8 @@ public class T3MigrationCallbackV2_1 extends T3MigrationCallbackSupport {
    123 123
     
    
    124 124
             addScript("08", "remove-Trip-fields", queries);
    
    125 125
             addScript("09", "fill-Harbour-ocean.sql", queries);
    
    126
    +        addScript("10", "add-WeightCategoryLogBookConversion-table.sql", queries);
    
    127
    +        addScript("11", "fill-WeightCategoryLogBookConversion-table.sql", queries);
    
    126 128
         }
    
    127 129
     
    
    128 130
     
    

  • t3-domain/src/main/resources/db/migration/V2_1_10_add-WeightCategoryLogBookConversion-table.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- T3 :: Domain
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2010 - 2018 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 Affero General Public License as published by
    
    9
    +-- the Free Software Foundation, either version 3 of the License, or
    
    10
    +-- (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 Affero General Public License
    
    18
    +-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19
    +-- #L%
    
    20
    +---
    
    21
    +-- drop TABLE IF EXISTS weightcategorylogbookconversion CASCADE ;
    
    22
    +-- drop TABLE IF EXISTS weightcategorylogbookconversionspecies CASCADE ;
    
    23
    +-- drop TABLE IF EXISTS weightcategorylogbookconversionspecies_species CASCADE ;
    
    24
    +
    
    25
    +CREATE TABLE WeightCategoryLogBookConversion( topiaid VARCHAR(255) PRIMARY KEY NOT NULL, topiaversion BIGINT NOT NULL, topiacreatedate TIMESTAMP NOT NULL, ocean VARCHAR(255) NOT NULL, schoolType VARCHAR(255) NOT NULL, version VARCHAR(255) NOT NULL, beginDate DATE NOT NULL, endDate DATE);
    
    26
    +CREATE UNIQUE INDEX uk_WeightCategoryLogBookConversion ON WeightCategoryLogBookConversion(version, ocean, schoolType, beginDate);
    
    27
    +ALTER TABLE WeightCategoryLogBookConversion ADD CONSTRAINT fk_WeightCategoryLogBookConversion_ocean FOREIGN KEY (ocean) REFERENCES Ocean(topiaid);
    
    28
    +ALTER TABLE WeightCategoryLogBookConversion ADD CONSTRAINT fk_WeightCategoryLogBookConversion_schoolType FOREIGN KEY (schoolType) REFERENCES SchoolType(topiaid);
    
    29
    +CREATE INDEX idx_WeightCategoryLogBookConversion_ocean ON WeightCategoryLogBookConversion(ocean);
    
    30
    +CREATE INDEX idx_WeightCategoryLogBookConversion_schoolType ON WeightCategoryLogBookConversion(schoolType);
    
    31
    +
    
    32
    +CREATE TABLE WeightCategoryLogBookConversionSpecies( topiaid VARCHAR(255) PRIMARY KEY NOT NULL, topiaversion BIGINT NOT NULL, topiacreatedate TIMESTAMP NOT NULL, parent VARCHAR(255) NOT NULL, parent_idx int, distribution TEXT NOT NULL);
    
    33
    +ALTER TABLE WeightCategoryLogBookConversionSpecies ADD CONSTRAINT fk_WeightCategoryLogBookConversionSpecies_parent FOREIGN KEY (parent) REFERENCES WeightCategoryLogBookConversion(topiaid);
    
    34
    +CREATE INDEX idx_WeightCategoryLogBookConversion_parent ON WeightCategoryLogBookConversionSpecies(parent);
    
    35
    +
    
    36
    +CREATE TABLE WeightCategoryLogBookConversionSpecies_Species(weightCategoryLogBookConversionSpecies VARCHAR(255) NOT NULL, species VARCHAR(255) NOT NULL);
    
    37
    +ALTER TABLE WeightCategoryLogBookConversionSpecies_Species ADD CONSTRAINT pk_WeightCategoryLogBookConversionS PRIMARY KEY (weightCategoryLogBookConversionSpecies,species);
    
    38
    +ALTER TABLE WeightCategoryLogBookConversionSpecies_Species ADD CONSTRAINT fk_WeightCategoryLogBookConversionS_w FOREIGN KEY (weightCategoryLogBookConversionSpecies) REFERENCES WeightCategoryLogBookConversionSpecies(topiaid);
    
    39
    +ALTER TABLE WeightCategoryLogBookConversionSpecies_Species ADD CONSTRAINT fk_WeightCategoryLogBookConversionS_s FOREIGN KEY (species) REFERENCES Species(topiaid);
    \ No newline at end of file

  • t3-domain/src/main/resources/db/migration/V2_1_11_fill-WeightCategoryLogBookConversion-table.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- T3 :: Domain
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2010 - 2018 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 Affero General Public License as published by
    
    9
    +-- the Free Software Foundation, either version 3 of the License, or
    
    10
    +-- (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 Affero General Public License
    
    18
    +-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19
    +-- #L%
    
    20
    +---
    
    21
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#00', 1, '2018-02-22 21:43:17.612000', 'fr.ird.t3.entities.reference.Ocean#1297580528924#0.4917298410119624', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.9747685881931636', '1.0', '1970-01-01', null);
    
    22
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#01', 1, '2018-02-22 21:43:17.676000', 'fr.ird.t3.entities.reference.Ocean#1297580528924#0.4917298410119624', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.8923578380543445', '1.0', '1970-01-01', null);
    
    23
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#02', 1, '2018-02-22 21:43:17.677000', 'fr.ird.t3.entities.reference.Ocean#1297580528924#0.4917298410119624', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.633774803291473', '1.0', '1970-01-01', null);
    
    24
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#03', 1, '2018-02-22 21:43:17.677000', 'fr.ird.t3.entities.reference.Ocean#1297580528924#0.02462443299831396', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.9747685881931636', '1.0', '1970-01-01', null);
    
    25
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#04', 1, '2018-02-22 21:43:17.680000', 'fr.ird.t3.entities.reference.Ocean#1297580528924#0.02462443299831396', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.8923578380543445', '1.0', '1970-01-01', null);
    
    26
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#05', 1, '2018-02-22 21:43:17.681000', 'fr.ird.t3.entities.reference.Ocean#1297580528924#0.02462443299831396', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.633774803291473', '1.0', '1970-01-01', null);
    
    27
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#06', 1, '2018-02-22 21:43:17.685000', 'fr.ird.t3.entities.reference.Ocean#1297580528925#0.868563686958073', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.9747685881931636', '1.0', '1970-01-01', null);
    
    28
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#07', 1, '2018-02-22 21:43:17.689000', 'fr.ird.t3.entities.reference.Ocean#1297580528925#0.868563686958073', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.8923578380543445', '1.0', '1970-01-01', null);
    
    29
    +INSERT INTO public.weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#08', 1, '2018-02-22 21:43:17.690000', 'fr.ird.t3.entities.reference.Ocean#1297580528925#0.868563686958073', 'fr.ird.t3.entities.reference.SchoolType#1297580528908#0.633774803291473', '1.0', '1970-01-01', null);
    
    30
    +
    
    31
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#00', 1, '2018-02-22 21:43:17.758000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#00', 0, '{
    
    32
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830509#0.5499777108807193": {}
    
    33
    +}');
    
    34
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#01', 1, '2018-02-22 21:43:17.790000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#00', 1, '{
    
    35
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830509#0.44386731073429053": {}
    
    36
    +}');
    
    37
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#02', 1, '2018-02-22 21:43:17.808000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#00', 2, '{
    
    38
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830509#0.5237318856431237": {
    
    39
    +    "3": 1.0,
    
    40
    +    "4": 0.8,
    
    41
    +    "6": 0.5,
    
    42
    +    "11": 0.1,
    
    43
    +    "12": 1.0
    
    44
    +  },
    
    45
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830509#0.5499777108807192": {
    
    46
    +    "5": 1.0,
    
    47
    +    "6": 0.5,
    
    48
    +    "7": 1.0,
    
    49
    +    "8": 1.0,
    
    50
    +    "11": 0.9,
    
    51
    +    "13": 1.0
    
    52
    +  },
    
    53
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830509#0.44386731073429053": {
    
    54
    +    "1": 1.0,
    
    55
    +    "2": 1.0,
    
    56
    +    "4": 0.2,
    
    57
    +    "10": 1.0
    
    58
    +  }
    
    59
    +}');
    
    60
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#03', 1, '2018-02-22 21:43:17.811000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#01', 0, '{
    
    61
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830505#0.988038536400382": {}
    
    62
    +}');
    
    63
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#04', 1, '2018-02-22 21:43:17.821000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#01', 1, '{
    
    64
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830500#0.6310700924396421": {}
    
    65
    +}');
    
    66
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#05', 1, '2018-02-22 21:43:17.826000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#01', 2, '{
    
    67
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830505#0.988038536400381": {
    
    68
    +    "3": 1.0,
    
    69
    +    "4": 0.8,
    
    70
    +    "5": 1.0,
    
    71
    +    "6": 1.0,
    
    72
    +    "7": 1.0,
    
    73
    +    "8": 1.0,
    
    74
    +    "11": 1.0,
    
    75
    +    "12": 1.0,
    
    76
    +    "13": 1.0
    
    77
    +  },
    
    78
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830500#0.6310700924396421": {
    
    79
    +    "1": 1.0,
    
    80
    +    "2": 1.0,
    
    81
    +    "4": 0.2,
    
    82
    +    "10": 1.0
    
    83
    +  }
    
    84
    +}');
    
    85
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#06', 1, '2018-02-22 21:43:17.840000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#02', 0, '{
    
    86
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830506#0.5499777108807193": {}
    
    87
    +}');
    
    88
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#07', 1, '2018-02-22 21:43:17.843000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#02', 1, '{
    
    89
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830505#0.44386731073429053": {}
    
    90
    +}');
    
    91
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#08', 1, '2018-02-22 21:43:17.855000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#02', 2, '{
    
    92
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830506#0.5237318856431237": {
    
    93
    +    "3": 1.0,
    
    94
    +    "4": 0.8,
    
    95
    +    "6": 0.5,
    
    96
    +    "11": 0.1,
    
    97
    +    "12": 1.0
    
    98
    +  },
    
    99
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830506#0.5499777108807192": {
    
    100
    +    "5": 1.0,
    
    101
    +    "6": 0.5,
    
    102
    +    "7": 1.0,
    
    103
    +    "8": 1.0,
    
    104
    +    "11": 0.9,
    
    105
    +    "13": 1.0
    
    106
    +  },
    
    107
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830505#0.44386731073429053": {
    
    108
    +    "1": 1.0,
    
    109
    +    "2": 1.0,
    
    110
    +    "4": 0.2,
    
    111
    +    "10": 1.0
    
    112
    +  }
    
    113
    +}');
    
    114
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#017', 1, '2018-02-22 21:43:17.943000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#02', 3, '{
    
    115
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830508#0.8969775036221255": {
    
    116
    +    "3": 1.0,
    
    117
    +    "4": 0.8,
    
    118
    +    "5": 1.0,
    
    119
    +    "6": 1.0,
    
    120
    +    "7": 1.0,
    
    121
    +    "8": 1.0,
    
    122
    +    "11": 1.0,
    
    123
    +    "12": 1.0,
    
    124
    +    "13": 1.0
    
    125
    +  },
    
    126
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830507#0.6434841998774135": {
    
    127
    +    "1": 1.0,
    
    128
    +    "2": 1.0,
    
    129
    +    "4": 0.2,
    
    130
    +    "10": 1.0
    
    131
    +  }
    
    132
    +}');
    
    133
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#09', 1, '2018-02-22 21:43:17.858000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#03', 0, '{
    
    134
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830510#0.8969775036221247": {}
    
    135
    +}');
    
    136
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#010', 1, '2018-02-22 21:43:17.875000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#03', 1, '{
    
    137
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830510#0.6434841998774145": {}
    
    138
    +}');
    
    139
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#011', 1, '2018-02-22 21:43:17.891000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#03', 2, '{
    
    140
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830510#0.8969775036221246": {
    
    141
    +    "3": 1.0,
    
    142
    +    "4": 0.8,
    
    143
    +    "5": 1.0,
    
    144
    +    "6": 1.0,
    
    145
    +    "7": 1.0,
    
    146
    +    "8": 1.0,
    
    147
    +    "11": 1.0,
    
    148
    +    "12": 1.0,
    
    149
    +    "13": 1.0
    
    150
    +  },
    
    151
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830510#0.6434841998774145": {
    
    152
    +    "1": 1.0,
    
    153
    +    "2": 1.0,
    
    154
    +    "4": 0.2,
    
    155
    +    "10": 1.0
    
    156
    +  }
    
    157
    +}');
    
    158
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#012', 1, '2018-02-22 21:43:17.897000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#04', 0, '{
    
    159
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830507#0.14752652961660063": {}
    
    160
    +}');
    
    161
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#013', 1, '2018-02-22 21:43:17.903000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#04', 1, '{
    
    162
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830506#0.4807760142660965": {}
    
    163
    +}');
    
    164
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#014', 1, '2018-02-22 21:43:17.920000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#04', 2, '{
    
    165
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830507#0.14752652961660062": {
    
    166
    +    "3": 1.0,
    
    167
    +    "4": 0.8,
    
    168
    +    "5": 1.0,
    
    169
    +    "6": 1.0,
    
    170
    +    "7": 1.0,
    
    171
    +    "8": 1.0,
    
    172
    +    "11": 1.0,
    
    173
    +    "12": 1.0,
    
    174
    +    "13": 1.0
    
    175
    +  },
    
    176
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830506#0.4807760142660965": {
    
    177
    +    "1": 1.0,
    
    178
    +    "2": 1.0,
    
    179
    +    "4": 0.2,
    
    180
    +    "10": 1.0
    
    181
    +  }
    
    182
    +}');
    
    183
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#015', 1, '2018-02-22 21:43:17.929000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#05', 0, '{
    
    184
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830508#0.8969775036221256": {}
    
    185
    +}');
    
    186
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#016', 1, '2018-02-22 21:43:17.939000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#05', 1, '{
    
    187
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#1308925830507#0.6434841998774135": {}
    
    188
    +}');
    
    189
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#018', 1, '2018-02-22 21:43:17.951000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#06', 0, '{
    
    190
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830510#0.8969775036221247": {}
    
    191
    +}');
    
    192
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#019', 1, '2018-02-22 21:43:17.956000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#06', 1, '{
    
    193
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830510#0.6434841998774145": {}
    
    194
    +}');
    
    195
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#020', 1, '2018-02-22 21:43:17.961000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#06', 2, '{
    
    196
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830510#0.8969775036221246": {
    
    197
    +    "3": 1.0,
    
    198
    +    "4": 0.8,
    
    199
    +    "5": 1.0,
    
    200
    +    "6": 1.0,
    
    201
    +    "7": 1.0,
    
    202
    +    "8": 1.0,
    
    203
    +    "11": 1.0,
    
    204
    +    "12": 1.0,
    
    205
    +    "13": 1.0
    
    206
    +  },
    
    207
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830510#0.6434841998774145": {
    
    208
    +    "1": 1.0,
    
    209
    +    "2": 1.0,
    
    210
    +    "4": 0.2,
    
    211
    +    "10": 1.0
    
    212
    +  }
    
    213
    +}');
    
    214
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#021', 1, '2018-02-22 21:43:17.970000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#07', 0, '{
    
    215
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830507#0.14752652961660063": {}
    
    216
    +}');
    
    217
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#022', 1, '2018-02-22 21:43:17.975000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#07', 1, '{
    
    218
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830506#0.4807760142660965": {}
    
    219
    +}');
    
    220
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#023', 1, '2018-02-22 21:43:17.988000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#07', 2, '{
    
    221
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830507#0.14752652961660062": {
    
    222
    +    "3": 1.0,
    
    223
    +    "4": 0.8,
    
    224
    +    "5": 1.0,
    
    225
    +    "6": 1.0,
    
    226
    +    "7": 1.0,
    
    227
    +    "8": 1.0,
    
    228
    +    "11": 1.0,
    
    229
    +    "12": 1.0,
    
    230
    +    "13": 1.0
    
    231
    +  },
    
    232
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830506#0.4807760142660965": {
    
    233
    +    "1": 1.0,
    
    234
    +    "2": 1.0,
    
    235
    +    "4": 0.2,
    
    236
    +    "10": 1.0
    
    237
    +  }
    
    238
    +}');
    
    239
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#024', 1, '2018-02-22 21:43:17.991000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#08', 0, '{
    
    240
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830508#0.8969775036221256": {}
    
    241
    +}');
    
    242
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#025', 1, '2018-02-22 21:43:17.994000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#08', 1, '{
    
    243
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830507#0.6434841998774135": {}
    
    244
    +}');
    
    245
    +INSERT INTO public.weightcategorylogbookconversionspecies (topiaid, topiaversion, topiacreatedate, parent, parent_idx, distribution) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#026', 1, '2018-02-22 21:43:18.006000', 'fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#08', 2, '{
    
    246
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830508#0.8969775036221255": {
    
    247
    +    "3": 1.0,
    
    248
    +    "4": 0.8,
    
    249
    +    "5": 1.0,
    
    250
    +    "6": 1.0,
    
    251
    +    "7": 1.0,
    
    252
    +    "8": 1.0,
    
    253
    +    "11": 1.0,
    
    254
    +    "12": 1.0,
    
    255
    +    "13": 1.0
    
    256
    +  },
    
    257
    +  "fr.ird.t3.entities.reference.WeightCategoryTreatment#2308925830507#0.6434841998774135": {
    
    258
    +    "1": 1.0,
    
    259
    +    "2": 1.0,
    
    260
    +    "4": 0.2,
    
    261
    +    "10": 1.0
    
    262
    +  }
    
    263
    +}');
    
    264
    +
    
    265
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#01', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    266
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#02', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    267
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#02', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    268
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#02', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    269
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#04', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    270
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#05', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    271
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#05', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    272
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#05', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    273
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#07', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    274
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#08', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    275
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#08', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    276
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#08', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    277
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#010', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    278
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#011', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    279
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#011', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    280
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#011', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    281
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#013', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    282
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#014', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    283
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#014', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    284
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#014', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    285
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#016', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    286
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#017', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    287
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#017', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    288
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#017', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    289
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#019', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    290
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#020', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    291
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#020', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    292
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#020', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    293
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#022', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    294
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#023', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    295
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#023', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    296
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#023', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');
    
    297
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#025', 'fr.ird.t3.entities.reference.Species#1297580528889#0.21694502845340558');
    
    298
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#026', 'fr.ird.t3.entities.reference.Species#1297580528889#0.5520768903332204');
    
    299
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#026', 'fr.ird.t3.entities.reference.Species#1297580528889#0.44612689800927063');
    
    300
    +INSERT INTO weightcategorylogbookconversionspecies_species (weightcategorylogbookconversionspecies, species) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies#1519311532526#026', 'fr.ird.t3.entities.reference.Species#1297580528889#0.7537605030704515');

  • t3-domain/src/main/resources/t3-datadb.properties
    ... ... @@ -38,4 +38,5 @@ topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine
    38 38
     topia.service.migration.callback=fr.ird.t3.services.migration.T3MigrationCallback
    
    39 39
     topia.service.migration.showSql=true
    
    40 40
     topia.service.migration.showProgression=true
    
    41
    +topia.persistence.topiaIdFactoryClassName=org.nuiton.topia.persistence.internal.LegacyTopiaIdFactory
    
    41 42
     

  • t3-domain/src/main/xmi/t3-persistence.properties
    ... ... @@ -18,7 +18,6 @@
    18 18
     # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
     # #L%
    
    20 20
     ###
    
    21
    -#model.tagValue.i18n=t3.common.
    
    22 21
     model.tagValue.notGenerateToString=true
    
    23 22
     model.tagValue.generateOperatorForDAOHelper=true
    
    24 23
     model.tagValue.constantPrefix=PROPERTY_
    
    ... ... @@ -27,6 +26,7 @@ model.tagValue.indexForeignKeys=true
    27 26
     
    
    28 27
     fr.ird.t3.entities.data.Trip.attribute.route.stereotype=ordered
    
    29 28
     fr.ird.t3.entities.data.Route.attribute.activity.stereotype=ordered
    
    29
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.distributions.stereotype=ordered
    
    30 30
     
    
    31 31
     fr.ird.t3.entities.data.Trip.attribute.route.tagvalue.orderBy=date
    
    32 32
     fr.ird.t3.entities.data.Route.attribute.activity.tagvalue.orderBy=date
    
    ... ... @@ -34,6 +34,11 @@ fr.ird.t3.entities.data.Route.attribute.activity.tagvalue.orderBy=date
    34 34
     fr.ird.t3.entities.data.Route.attribute.date.tagvalue.hibernateAttributeType.java.util.Date=date
    
    35 35
     fr.ird.t3.entities.data.Activity.attribute.time.tagvalue.hibernateAttributeType.java.util.Date=time
    
    36 36
     
    
    37
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.beginDate.tagValue.hibernateAttributeType.java.util.Date=date
    
    38
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.endDate.tagValue.hibernateAttributeType.java.util.Date=date
    
    39
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.distribution.tagValue.hibernateAttributeType.java.lang.String=text
    
    40
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.species.tagvalue.manyToManyTableName=WeightCategoryLogBookConversionSpecies_Species
    
    41
    +
    
    37 42
     fr.ird.t3.entities.data.Activity.attribute.comment.tagvalue.sqlType=text
    
    38 43
     fr.ird.t3.entities.data.LocalMarketBatch.attribute.origin.tagvalue.sqlType=text
    
    39 44
     fr.ird.t3.entities.data.LocalMarketBatch.attribute.comment.tagvalue.sqlType=text
    
    ... ... @@ -50,6 +55,7 @@ fr.ird.t3.entities.reference.Vessel.attribute.vesselSizeCategory.tagvalue.lazy=f
    50 55
     fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.species.tagvalue.lazy=false
    
    51 56
     
    
    52 57
     fr.ird.t3.entities.reference.WeightCategoryLogBook.attribute.species.tagvalue.lazy=false
    
    58
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.species.tagValue.lazy=false
    
    53 59
     
    
    54 60
     fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.ocean.tagvalue.lazy=false
    
    55 61
     fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.schoolType.tagvalue.lazy=false
    
    ... ... @@ -74,6 +80,7 @@ fr.ird.t3.entities.reference.VesselActivity.attribute.code.stereotype=unique
    74 80
     fr.ird.t3.entities.reference.VesselSizeCategory.attribute.code.stereotype=unique
    
    75 81
     fr.ird.t3.entities.reference.VesselType.attribute.code.stereotype=unique
    
    76 82
     #fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.code.stereotype=unique
    
    83
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.species.stereotype=unique
    
    77 84
     fr.ird.t3.entities.reference.WellDestiny.attribute.code.stereotype=unique
    
    78 85
     fr.ird.t3.entities.reference.Species.attribute.faoId.stereotype=unique
    
    79 86
     fr.ird.t3.entities.reference.Species.attribute.wormsId.stereotype=unique
    
    ... ... @@ -87,40 +94,66 @@ fr.ird.t3.entities.reference.ElementaryCatchFate.attribute.code.stereotype=uniqu
    87 94
     fr.ird.t3.entities.reference.Company.attribute.code.stereotype=unique
    
    88 95
     
    
    89 96
     ###############################################################################
    
    97
    +### Not null for references ###################################################
    
    98
    +###############################################################################
    
    99
    +
    
    100
    +fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.code.tagValue.notNull=true
    
    101
    +fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.species.tagValue.notNull=true
    
    102
    +fr.ird.t3.entities.reference.WeightCategoryLogBook.attribute.code.tagValue.notNull=true
    
    103
    +fr.ird.t3.entities.reference.WeightCategoryLogBook.attribute.species.tagValue.notNull=true
    
    104
    +fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.ocean.tagValue.notNull=true
    
    105
    +fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.schoolType.tagValue.notNull=true
    
    106
    +fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.min.tagValue.notNull=false
    
    107
    +fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.max.tagValue.notNull=false
    
    108
    +fr.ird.t3.entities.reference.LengthWeightConversion.attribute.species.tagValue.notNull=true
    
    109
    +fr.ird.t3.entities.reference.LengthWeightConversion.attribute.ocean.tagValue.notNull=false
    
    110
    +fr.ird.t3.entities.reference.LengthWeightConversion.attribute.sexe.tagValue.notNull=false
    
    111
    +fr.ird.t3.entities.reference.LengthWeightConversion.attribute.beginDate.tagValue.notNull=true
    
    112
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.ocean.tagValue.notNull=true
    
    113
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.schoolType.tagValue.notNull=true
    
    114
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.beginDate.tagValue.notNull=true
    
    115
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.version.tagValue.notNull=true
    
    116
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.distribution.tagValue.notNull=true
    
    117
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.parent.tagValue.notNull=true
    
    118
    +
    
    119
    +###############################################################################
    
    90 120
     ### Natural id  for references ################################################
    
    91 121
     ###############################################################################
    
    92 122
     
    
    93 123
     fr.ird.t3.entities.reference.WeightCategoryLanding.class.tagValue.naturalIdMutable=false
    
    94 124
     fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.code.tagValue.naturalId=true
    
    95
    -fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.code.tagValue.notNull=true
    
    96 125
     fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.species.tagValue.naturalId=true
    
    97
    -fr.ird.t3.entities.reference.WeightCategoryLanding.attribute.species.tagValue.notNull=true
    
    126
    +
    
    98 127
     
    
    99 128
     fr.ird.t3.entities.reference.WeightCategoryLogBook.class.tagValue.naturalIdMutable=false
    
    100 129
     fr.ird.t3.entities.reference.WeightCategoryLogBook.attribute.code.tagValue.naturalId=true
    
    101
    -fr.ird.t3.entities.reference.WeightCategoryLogBook.attribute.code.tagValue.notNull=true
    
    102 130
     fr.ird.t3.entities.reference.WeightCategoryLogBook.attribute.species.tagValue.naturalId=true
    
    103
    -fr.ird.t3.entities.reference.WeightCategoryLogBook.attribute.species.tagValue.notNull=true
    
    104 131
     
    
    105 132
     fr.ird.t3.entities.reference.WeightCategoryTreatment.class.tagValue.naturalIdMutable=false
    
    106 133
     fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.ocean.tagValue.naturalId=true
    
    107
    -fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.ocean.tagValue.notNull=true
    
    108 134
     fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.schoolType.tagValue.naturalId=true
    
    109
    -fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.schoolType.tagValue.notNull=true
    
    110 135
     fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.min.tagValue.naturalId=true
    
    111
    -fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.min.tagValue.notNull=false
    
    112 136
     fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.max.tagValue.naturalId=true
    
    113
    -fr.ird.t3.entities.reference.WeightCategoryTreatment.attribute.max.tagValue.notNull=false
    
    114 137
     
    
    115 138
     fr.ird.t3.entities.reference.LengthWeightConversion.class.tagValue.naturalIdMutable=true
    
    116 139
     fr.ird.t3.entities.reference.LengthWeightConversion.attribute.species.tagValue.naturalId=true
    
    117
    -fr.ird.t3.entities.reference.LengthWeightConversion.attribute.species.tagValue.notNull=true
    
    118 140
     fr.ird.t3.entities.reference.LengthWeightConversion.attribute.ocean.tagValue.naturalId=true
    
    119
    -fr.ird.t3.entities.reference.LengthWeightConversion.attribute.ocean.tagValue.notNull=false
    
    120 141
     fr.ird.t3.entities.reference.LengthWeightConversion.attribute.sexe.tagValue.naturalId=true
    
    121
    -fr.ird.t3.entities.reference.LengthWeightConversion.attribute.sexe.tagValue.notNull=false
    
    122 142
     fr.ird.t3.entities.reference.LengthWeightConversion.attribute.beginDate.tagValue.naturalId=true
    
    123
    -fr.ird.t3.entities.reference.LengthWeightConversion.attribute.beginDate.tagValue.notNull=true
    
    143
    +
    
    144
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.class.tagValue.naturalIdMutable=false
    
    145
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.ocean.tagValue.naturalId=true
    
    146
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.schoolType.tagValue.naturalId=true
    
    147
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.beginDate.tagValue.naturalId=true
    
    148
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.version.tagValue.naturalId=true
    
    149
    +
    
    150
    +###############################################################################
    
    151
    +### Not null for data #########################################################
    
    152
    +###############################################################################
    
    153
    +
    
    154
    +fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.activity.tagValue.notNull=true
    
    155
    +fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.species.tagValue.notNull=true
    
    156
    +fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.lfLengthClass.tagValue.notNull=true
    
    124 157
     
    
    125 158
     ###############################################################################
    
    126 159
     ### Natural id  for data ######################################################
    
    ... ... @@ -128,8 +161,5 @@ fr.ird.t3.entities.reference.LengthWeightConversion.attribute.beginDate.tagValue
    128 161
     
    
    129 162
     fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.class.tagValue.naturalIdMutable=false
    
    130 163
     fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.activity.tagValue.naturalId=true
    
    131
    -fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.activity.tagValue.notNull=true
    
    132 164
     fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.species.tagValue.naturalId=true
    
    133
    -fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.species.tagValue.notNull=true
    
    134 165
     fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.lfLengthClass.tagValue.naturalId=true
    135
    -fr.ird.t3.entities.data.ExtrapolatedAllSetSpeciesFrequency.attribute.lfLengthClass.tagValue.notNull=true

  • t3-domain/src/main/xmi/t3-persistence.zargo
    No preview for this file type
  • t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
    ... ... @@ -22,11 +22,49 @@ package fr.ird.t3.services.migration;
    22 22
      */
    
    23 23
     
    
    24 24
     import fr.ird.t3.entities.T3TopiaApplicationContext;
    
    25
    +import fr.ird.t3.entities.T3TopiaPersistenceContext;
    
    26
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertor;
    
    27
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OABI;
    
    28
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OABL;
    
    29
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OABO;
    
    30
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OIBI;
    
    31
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OIBL;
    
    32
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OIBO;
    
    33
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OPBI;
    
    34
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OPBL;
    
    35
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorFOR_OPBO;
    
    36
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorProvider;
    
    37
    +import fr.ird.t3.entities.reference.Ocean;
    
    38
    +import fr.ird.t3.entities.reference.OceanTopiaDao;
    
    39
    +import fr.ird.t3.entities.reference.SchoolType;
    
    40
    +import fr.ird.t3.entities.reference.SchoolTypeTopiaDao;
    
    41
    +import fr.ird.t3.entities.reference.Species;
    
    42
    +import fr.ird.t3.entities.reference.SpeciesTopiaDao;
    
    43
    +import fr.ird.t3.entities.reference.WeightCategoryLogBookConversion;
    
    44
    +import fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies;
    
    45
    +import fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpeciesImpl;
    
    46
    +import fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpeciesTopiaDao;
    
    47
    +import fr.ird.t3.entities.reference.WeightCategoryLogBookConversionTopiaDao;
    
    48
    +import fr.ird.t3.entities.reference.WeightCategoryTreatment;
    
    49
    +import fr.ird.t3.entities.reference.WeightCategoryTreatmentTopiaDao;
    
    25 50
     import fr.ird.t3.entities.user.JdbcConfiguration;
    
    26 51
     import fr.ird.t3.entities.user.JdbcConfigurationHelper;
    
    27 52
     import org.junit.Assert;
    
    28 53
     import org.junit.Ignore;
    
    29 54
     import org.junit.Test;
    
    55
    +import org.nuiton.topia.persistence.BeanTopiaConfiguration;
    
    56
    +import org.nuiton.topia.persistence.TopiaEntity;
    
    57
    +import org.nuiton.topia.persistence.internal.LegacyTopiaIdFactory;
    
    58
    +import org.nuiton.util.DateUtil;
    
    59
    +
    
    60
    +import java.util.Collections;
    
    61
    +import java.util.Date;
    
    62
    +import java.util.HashSet;
    
    63
    +import java.util.LinkedHashMap;
    
    64
    +import java.util.List;
    
    65
    +import java.util.Map;
    
    66
    +import java.util.stream.Collectors;
    
    67
    +import java.util.stream.Stream;
    
    30 68
     
    
    31 69
     /**
    
    32 70
      * Created by tchemit on 20/02/2018.
    
    ... ... @@ -36,6 +74,11 @@ import org.junit.Test;
    36 74
     @Ignore
    
    37 75
     public class T3MigrationTest {
    
    38 76
     
    
    77
    +    private int count = 0;
    
    78
    +    private SpeciesTopiaDao speciesDao;
    
    79
    +    private WeightCategoryLogBookConversionTopiaDao weightCategoryLogBookConversionDao;
    
    80
    +    private WeightCategoryLogBookConversionSpeciesTopiaDao weightCategoryLogBookConversionSpeciesDao;
    
    81
    +
    
    39 82
         @Test
    
    40 83
         public void migratePostgres() {
    
    41 84
     
    
    ... ... @@ -52,4 +95,159 @@ public class T3MigrationTest {
    52 95
             }
    
    53 96
     
    
    54 97
         }
    
    98
    +
    
    99
    +    @Test
    
    100
    +    public void generateWeightCategoryLogBookConversions() {
    
    101
    +
    
    102
    +        String url = "jdbc:postgresql:t3";
    
    103
    +        String login = "t3-admin";
    
    104
    +        String password = "a";
    
    105
    +
    
    106
    +        JdbcConfiguration jdbcConfiguration = JdbcConfigurationHelper.newJdbcConfiguration();
    
    107
    +        jdbcConfiguration.setUrl(url);
    
    108
    +        jdbcConfiguration.setLogin(login);
    
    109
    +        jdbcConfiguration.setPassword(password);
    
    110
    +        try (T3TopiaApplicationContext rootContext = T3TopiaApplicationContext.newDb(jdbcConfiguration)) {
    
    111
    +
    
    112
    +            ((BeanTopiaConfiguration) rootContext.getConfiguration()).setTopiaIdFactory(new LegacyTopiaIdFactory() {
    
    113
    +
    
    114
    +                @Override
    
    115
    +                public <E extends TopiaEntity> String newTopiaId(Class<E> entityClass, TopiaEntity topiaEntity) {
    
    116
    +                    return entityClass.getName() + "#1519311532526#0" + count++;
    
    117
    +                }
    
    118
    +            });
    
    119
    +
    
    120
    +            try (T3TopiaPersistenceContext persistenceContext = rootContext.newPersistenceContext()) {
    
    121
    +
    
    122
    +                WeightCategoryLogBookConvertorProvider convertorProvider = WeightCategoryLogBookConvertorProvider.newInstance(persistenceContext);
    
    123
    +
    
    124
    +                OceanTopiaDao oceanDao = persistenceContext.getOceanDao();
    
    125
    +                speciesDao = persistenceContext.getSpeciesDao();
    
    126
    +                SchoolTypeTopiaDao schoolTypeDao = persistenceContext.getSchoolTypeDao();
    
    127
    +                WeightCategoryTreatmentTopiaDao weightCategoryTreatmentDao = persistenceContext.getWeightCategoryTreatmentDao();
    
    128
    +                weightCategoryLogBookConversionDao = persistenceContext.getWeightCategoryLogBookConversionDao();
    
    129
    +                weightCategoryLogBookConversionSpeciesDao = persistenceContext.getWeightCategoryLogBookConversionSpeciesDao();
    
    130
    +
    
    131
    +                weightCategoryLogBookConversionDao.deleteAll(weightCategoryLogBookConversionDao.findAll());
    
    132
    +                persistenceContext.getHibernateSupport().getHibernateSession().flush();
    
    133
    +
    
    134
    +                Date beginDate = DateUtil.createDate(1, 1, 1970);
    
    135
    +
    
    136
    +                Ocean oceanA = oceanDao.forCodeEquals(1).findUnique();
    
    137
    +                Ocean oceanI = oceanDao.forCodeEquals(2).findUnique();
    
    138
    +                Ocean oceanP = oceanDao.forCodeEquals(5).findUnique();
    
    139
    +                SchoolType schoolTypeBo = schoolTypeDao.forCodeEquals(1).findUnique();
    
    140
    +                SchoolType schoolTypeBl = schoolTypeDao.forCodeEquals(2).findUnique();
    
    141
    +                SchoolType schoolTypeBi = schoolTypeDao.forCodeEquals(3).findUnique();
    
    142
    +
    
    143
    +                String version = "1.0";
    
    144
    +
    
    145
    +                this.count = 0;
    
    146
    +
    
    147
    +                // OA
    
    148
    +                WeightCategoryLogBookConversion oaBi = addConversion(version, beginDate, oceanA, schoolTypeBi);
    
    149
    +                WeightCategoryLogBookConversion oaBo = addConversion(version, beginDate, oceanA, schoolTypeBo);
    
    150
    +                WeightCategoryLogBookConversion oaBl = addConversion(version, beginDate, oceanA, schoolTypeBl);
    
    151
    +
    
    152
    +                // OI
    
    153
    +                WeightCategoryLogBookConversion oiBi = addConversion(version, beginDate, oceanI, schoolTypeBi);
    
    154
    +                WeightCategoryLogBookConversion oiBo = addConversion(version, beginDate, oceanI, schoolTypeBo);
    
    155
    +                WeightCategoryLogBookConversion oiBl = addConversion(version, beginDate, oceanI, schoolTypeBl);
    
    156
    +
    
    157
    +                // OP
    
    158
    +                WeightCategoryLogBookConversion opBi = addConversion(version, beginDate, oceanP, schoolTypeBi);
    
    159
    +                WeightCategoryLogBookConversion opBo = addConversion(version, beginDate, oceanP, schoolTypeBo);
    
    160
    +                WeightCategoryLogBookConversion opBl = addConversion(version, beginDate, oceanP, schoolTypeBl);
    
    161
    +
    
    162
    +                persistenceContext.commit();
    
    163
    +
    
    164
    +                this.count = 0;
    
    165
    +
    
    166
    +                //OA
    
    167
    +                {
    
    168
    +                    WeightCategoryLogBookConvertorFOR_OABI convertor = getConvertor(convertorProvider, oaBi, WeightCategoryLogBookConvertorFOR_OABI.class);
    
    169
    +                    addEmptyConversionSpecies(oaBi, convertor.getUnkownCategory());
    
    170
    +                    addEmptyConversionSpecies(oaBi, convertor.getMinus10Category(), 2);
    
    171
    +                    addConversionSpecies(oaBi, convertor, 1, 3, 4);
    
    172
    +                }
    
    173
    +                {
    
    174
    +                    WeightCategoryLogBookConvertorFOR_OABO convertor = getConvertor(convertorProvider, oaBo, WeightCategoryLogBookConvertorFOR_OABO.class);
    
    175
    +                    addEmptyConversionSpecies(oaBo, convertor.getUnkownCategory());
    
    176
    +                    addEmptyConversionSpecies(oaBo, convertor.getMinus10Category(), 2);
    
    177
    +                    addConversionSpecies(oaBo, convertor, 1, 3, 4);
    
    178
    +                }
    
    179
    +                {
    
    180
    +                    WeightCategoryLogBookConvertorFOR_OABL convertor = getConvertor(convertorProvider, oaBl, WeightCategoryLogBookConvertorFOR_OABL.class);
    
    181
    +                    addEmptyConversionSpecies(oaBl, convertor.getUnkownCategory());
    
    182
    +                    addEmptyConversionSpecies(oaBl, convertor.getMinus10Category(), 2);
    
    183
    +                    addConversionSpecies(oaBl, convertor, 1, 3, 4);
    
    184
    +                }
    
    185
    +                //OI
    
    186
    +                {
    
    187
    +                    WeightCategoryLogBookConvertorFOR_OIBI convertor = getConvertor(convertorProvider, oiBi, WeightCategoryLogBookConvertorFOR_OIBI.class);
    
    188
    +                    addEmptyConversionSpecies(oiBi, convertor.getUnkownCategory());
    
    189
    +                    addEmptyConversionSpecies(oiBi, convertor.getMinus10Category(), 2);
    
    190
    +                    addConversionSpecies(oiBi, convertor, 1, 3, 4);
    
    191
    +                }
    
    192
    +                {
    
    193
    +                    WeightCategoryLogBookConvertorFOR_OIBO convertor = getConvertor(convertorProvider, oiBo, WeightCategoryLogBookConvertorFOR_OIBO.class);
    
    194
    +                    addEmptyConversionSpecies(oiBo, convertor.getUnkownCategory());
    
    195
    +                    addEmptyConversionSpecies(oiBo, convertor.getMinus10Category(), 2);
    
    196
    +                    addConversionSpecies(oiBo, convertor, 1, 3, 4);
    
    197
    +                }
    
    198
    +                {
    
    199
    +                    WeightCategoryLogBookConvertorFOR_OIBL convertor = getConvertor(convertorProvider, oiBl, WeightCategoryLogBookConvertorFOR_OIBL.class);
    
    200
    +                    addEmptyConversionSpecies(oiBl, convertor.getUnkownCategory());
    
    201
    +                    addEmptyConversionSpecies(oiBl, convertor.getMinus10Category(), 2);
    
    202
    +                    addConversionSpecies(oaBl, convertor, 1, 3, 4);
    
    203
    +                }
    
    204
    +                //OP
    
    205
    +                {
    
    206
    +                    WeightCategoryLogBookConvertorFOR_OPBI convertor = getConvertor(convertorProvider, opBi, WeightCategoryLogBookConvertorFOR_OPBI.class);
    
    207
    +                    addEmptyConversionSpecies(opBi, convertor.getUnkownCategory());
    
    208
    +                    addEmptyConversionSpecies(opBi, convertor.getMinus10Category(), 2);
    
    209
    +                    addConversionSpecies(opBi, convertor, 1, 3, 4);
    
    210
    +                }
    
    211
    +                {
    
    212
    +                    WeightCategoryLogBookConvertorFOR_OPBO convertor = getConvertor(convertorProvider, opBo, WeightCategoryLogBookConvertorFOR_OPBO.class);
    
    213
    +                    addEmptyConversionSpecies(opBo, convertor.getUnkownCategory());
    
    214
    +                    addEmptyConversionSpecies(opBo, convertor.getMinus10Category(), 2);
    
    215
    +                    addConversionSpecies(opBo, convertor, 1, 3, 4);
    
    216
    +                }
    
    217
    +                {
    
    218
    +                    WeightCategoryLogBookConvertorFOR_OPBL convertor = getConvertor(convertorProvider, opBl, WeightCategoryLogBookConvertorFOR_OPBL.class);
    
    219
    +                    addEmptyConversionSpecies(opBl, convertor.getUnkownCategory());
    
    220
    +                    addEmptyConversionSpecies(opBl, convertor.getMinus10Category(), 2);
    
    221
    +                    addConversionSpecies(opBl, convertor, 1, 3, 4);
    
    222
    +                }
    
    223
    +                persistenceContext.commit();
    
    224
    +            }
    
    225
    +        }
    
    226
    +    }
    
    227
    +
    
    228
    +    private void addConversionSpecies(WeightCategoryLogBookConversion conversion, WeightCategoryLogBookConvertor convertor, Integer... speciesCode) {
    
    229
    +        List<Species> species = speciesDao.forCodeIn(Stream.of(speciesCode).collect(Collectors.toSet())).findAll();
    
    230
    +        Map<String, Map<Integer, Float>> distributionsToSave = convertor.getDistributionsByIds();
    
    231
    +        WeightCategoryLogBookConversionSpecies conversionSpecies = weightCategoryLogBookConversionSpeciesDao.createByNotNull(WeightCategoryLogBookConversionSpeciesImpl.toString(distributionsToSave), conversion);
    
    232
    +        conversionSpecies.setSpecies(new HashSet<>(species));
    
    233
    +        conversion.addDistributions(conversionSpecies);
    
    234
    +    }
    
    235
    +
    
    236
    +    private void addEmptyConversionSpecies(WeightCategoryLogBookConversion conversion, WeightCategoryTreatment weightCategoryTreatment, Integer... speciesCode) {
    
    237
    +        List<Species> species = speciesDao.forCodeIn(Stream.of(speciesCode).collect(Collectors.toSet())).findAll();
    
    238
    +        Map<String, Map<Integer, Float>> distributionsToSave = new LinkedHashMap<>();
    
    239
    +        distributionsToSave.put(weightCategoryTreatment.getTopiaId(), Collections.emptyMap());
    
    240
    +        WeightCategoryLogBookConversionSpecies conversionSpecies = weightCategoryLogBookConversionSpeciesDao.createByNotNull(WeightCategoryLogBookConversionSpeciesImpl.toString(distributionsToSave), conversion);
    
    241
    +        conversionSpecies.setSpecies(new HashSet<>(species));
    
    242
    +        conversion.addDistributions(conversionSpecies);
    
    243
    +    }
    
    244
    +
    
    245
    +
    
    246
    +    private <C extends WeightCategoryLogBookConvertor> C getConvertor(WeightCategoryLogBookConvertorProvider convertorProvider, WeightCategoryLogBookConversion conversion, Class<C> convertorType) {
    
    247
    +        return convertorType.cast(convertorProvider.getConvertor(conversion.getOcean(), conversion.getSchoolType()));
    
    248
    +    }
    
    249
    +
    
    250
    +    private WeightCategoryLogBookConversion addConversion(String version, Date beginDate, Ocean ocean, SchoolType schoolType) {
    
    251
    +        return weightCategoryLogBookConversionDao.createByNotNull(version, beginDate, ocean, schoolType);
    
    252
    +    }
    
    55 253
     }

  • t3-installer/pom.xml
    ... ... @@ -258,6 +258,16 @@
    258 258
                       <fromFile>t3-data-${t3-data.version}-zones.zip</fromFile>
    
    259 259
                     </configuration>
    
    260 260
                   </execution>
    
    261
    +              <execution>
    
    262
    +                <id>get-h2-files</id>
    
    263
    +                <phase>prepare-package</phase>
    
    264
    +                <goals>
    
    265
    +                  <goal>download-single</goal>
    
    266
    +                </goals>
    
    267
    +                <configuration>
    
    268
    +                  <fromFile>t3-data-${t3-data.version}-h2.zip</fromFile>
    
    269
    +                </configuration>
    
    270
    +              </execution>
    
    261 271
                 </executions>
    
    262 272
               </plugin>
    
    263 273
     
    
    ... ... @@ -272,6 +282,7 @@
    272 282
                         <unzip src="${explodedDataDirection}/t3-data-${t3-data.version}-ddl.zip" dest="${explodedDataDirection}" />
    
    273 283
                         <unzip src="${explodedDataDirection}/t3-data-${t3-data.version}-referential.zip" dest="${explodedDataDirection}" />
    
    274 284
                         <unzip src="${explodedDataDirection}/t3-data-${t3-data.version}-zones.zip" dest="${explodedDataDirection}" />
    
    285
    +                    <unzip src="${explodedDataDirection}/t3-data-${t3-data.version}-h2.zip" dest="${explodedDataDirection}" />
    
    275 286
                       </tasks>
    
    276 287
                     </configuration>
    
    277 288
                     <goals>
    

  • t3-installer/src/main/assembly/bin.xml
    ... ... @@ -82,6 +82,14 @@
    82 82
         </fileSet>
    
    83 83
     
    
    84 84
         <fileSet>
    
    85
    +      <directory>${explodedDataDirection}/t3-data-h2-${t3-data.version}</directory>
    
    86
    +      <outputDirectory>scripts/h2</outputDirectory>
    
    87
    +      <includes>
    
    88
    +        <include>**/*</include>
    
    89
    +      </includes>
    
    90
    +    </fileSet>
    
    91
    +
    
    92
    +    <fileSet>
    
    85 93
           <directory>src/main/assembly/dist</directory>
    
    86 94
           <outputDirectory/>
    
    87 95
           <includes>
    

  • t3-test/src/main/java/fr/ird/t3/FakeT3ServiceContext.java
    ... ... @@ -21,6 +21,7 @@
    21 21
     package fr.ird.t3;
    
    22 22
     
    
    23 23
     import fr.ird.t3.entities.T3EntityHelper;
    
    24
    +import fr.ird.t3.entities.T3JdbcHelper;
    
    24 25
     import fr.ird.t3.entities.T3TopiaApplicationContext;
    
    25 26
     import fr.ird.t3.entities.T3TopiaPersistenceContext;
    
    26 27
     import fr.ird.t3.entities.T3UserTopiaApplicationContext;
    
    ... ... @@ -28,13 +29,6 @@ import fr.ird.t3.entities.T3UserTopiaPersistenceContext;
    28 29
     import fr.ird.t3.services.T3Service;
    
    29 30
     import fr.ird.t3.services.T3ServiceContext;
    
    30 31
     import fr.ird.t3.services.T3ServiceFactory;
    
    31
    -import java.io.Closeable;
    
    32
    -import java.io.File;
    
    33
    -import java.io.IOException;
    
    34
    -import java.util.Date;
    
    35
    -import java.util.Locale;
    
    36
    -import java.util.Properties;
    
    37
    -import java.util.function.Supplier;
    
    38 32
     import org.apache.commons.logging.Log;
    
    39 33
     import org.apache.commons.logging.LogFactory;
    
    40 34
     import org.junit.rules.TestWatcher;
    
    ... ... @@ -44,6 +38,13 @@ import org.nuiton.topia.persistence.TopiaException;
    44 38
     import org.nuiton.util.FileUtil;
    
    45 39
     import org.nuiton.version.Version;
    
    46 40
     
    
    41
    +import java.io.Closeable;
    
    42
    +import java.io.File;
    
    43
    +import java.util.Date;
    
    44
    +import java.util.Locale;
    
    45
    +import java.util.Properties;
    
    46
    +import java.util.function.Supplier;
    
    47
    +
    
    47 48
     /**
    
    48 49
      * TODO
    
    49 50
      *
    
    ... ... @@ -91,26 +92,6 @@ public class FakeT3ServiceContext extends TestWatcher implements T3ServiceContex
    91 92
     
    
    92 93
             Properties defaultProps = new Properties();
    
    93 94
             defaultProps.put(T3ConfigOption.DATA_DIRECTORY.getKey(), testDir);
    
    94
    -//        applicationConfiguration = new T3Config(defaultProps);
    
    95
    -//        try {
    
    96
    -//
    
    97
    -//            // where to put h2 database
    
    98
    -//            File dbDirectory = new File(testDir, "h2-database");
    
    99
    -//
    
    100
    -//            rootContext = T3TopiaApplicationContext.newEmbeddedDb(dbDirectory);
    
    101
    -//
    
    102
    -//            initOk = true;
    
    103
    -//        } catch (Exception e) {
    
    104
    -//            initOk = false;
    
    105
    -//            throw new IllegalStateException("Could not strat db", e);
    
    106
    -//        }
    
    107
    -//
    
    108
    -//        testDir = T3IOUtil.getTestSpecificDirectory(description.getTestClass(),
    
    109
    -//                                                    description.getMethodName());
    
    110
    -//        if (log.isInfoEnabled()) {
    
    111
    -//            log.info("Test dir = " + testDir);
    
    112
    -//        }
    
    113
    -//
    
    114 95
             File treatmentDirectory = new File(testDir, "treatment");
    
    115 96
             FileUtil.createDirectoryIfNecessary(treatmentDirectory);
    
    116 97
     
    
    ... ... @@ -128,19 +109,28 @@ public class FakeT3ServiceContext extends TestWatcher implements T3ServiceContex
    128 109
             Mockito.when(applicationConfiguration.getTreatmentWorkingDirectory()).thenReturn(treatmentDirectory);
    
    129 110
             Mockito.when(applicationConfiguration.getT3DataVersion()).thenReturn(t3DataVersion);
    
    130 111
             Mockito.when(applicationConfiguration.getTreatmentWorkingDirectory(Mockito.anyString(), Mockito.anyBoolean())).thenCallRealMethod();
    
    112
    +        Mockito.when(applicationConfiguration.getApplicationVersion()).thenReturn(realConfiguration.getApplicationVersion());
    
    131 113
     
    
    132 114
             try {
    
    133 115
     
    
    134 116
                 // where to put h2 database
    
    135 117
                 File dbDirectory = new File(testDir, "h2-database");
    
    136 118
     
    
    137
    -            rootContext = T3TopiaApplicationContext.newEmbeddedDb(dbDirectory);
    
    138
    -
    
    139 119
                 if (injectReferential) {
    
    140
    -                // inject in db the referentiel
    
    141
    -                T3SqlScriptsImporter.importReferential(new File(""), this, T3SqlScriptsImporter.SKIP_SPECIES_LENGTH_STEP_FILE);
    
    142
    -
    
    120
    +                File scriptsDirectory = T3JdbcHelper.getScriptsDirectory(new File(""), "h2", t3DataVersion);
    
    121
    +
    
    122
    +                String[] list = scriptsDirectory.list((dir, name) -> name.endsWith(".sql") && name.contains("-referential"));
    
    123
    +                if (list == null || list.length != 1) {
    
    124
    +                    throw new IllegalStateException(String.format("Can't find h2 referential db from %s", scriptsDirectory));
    
    125
    +                }
    
    126
    +                rootContext = T3TopiaApplicationContext.newEmbeddedBackupDb(dbDirectory, scriptsDirectory.toPath().resolve(list[0]).toFile());
    
    127
    +            } else {
    
    128
    +                rootContext = T3TopiaApplicationContext.newEmbeddedDb(dbDirectory);
    
    143 129
                 }
    
    130
    +//            if (injectReferential) {
    
    131
    +//                // inject in db the referentiel
    
    132
    +//                T3SqlScriptsImporter.importReferential(new File(""), this, T3SqlScriptsImporter.SKIP_SPECIES_LENGTH_STEP_FILE);
    
    133
    +//            }
    
    144 134
                 initOk = true;
    
    145 135
     
    
    146 136
             } catch (Exception e) {
    
    ... ... @@ -233,7 +223,7 @@ public class FakeT3ServiceContext extends TestWatcher implements T3ServiceContex
    233 223
         }
    
    234 224
     
    
    235 225
         @Override
    
    236
    -    public void close() throws IOException {
    
    226
    +    public void close() {
    
    237 227
             if (transaction != null) {
    
    238 228
                 transaction.close();
    
    239 229
             }
    

  • t3-test/src/main/resources/t3-TopiaContextImpl.properties
    ... ... @@ -19,12 +19,23 @@
    19 19
     # #L%
    
    20 20
     ###
    
    21 21
     
    
    22
    -# Proprietes par defaut pour une base de donnees de type H2
    
    22
    +# DB configuration
    
    23
    +#hibernate.dialect=org.hibernate.dialect.H2Dialect
    
    24
    +hibernate.connection.driver_class=org.h2.Driver
    
    25
    +hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider
    
    23 26
     hibernate.show_sql=false
    
    24
    -
    
    25
    -hibernate.dialect=org.hibernate.dialect.H2Dialect
    
    27
    +hibernate.format_sql=false
    
    28
    +hibernate.use_sql_comments=false
    
    26 29
     hibernate.connection.username=sa
    
    27
    -hibernate.connection.password=
    
    28
    -hibernate.connection.driver_class=org.h2.Driver
    
    29
    -# tchemit 2010-11-28 : comment this line, each test must define his own db path
    
    30
    -#hibernate.connection.url=jdbc:h2:file:target/surefire-workdir/h2data
    30
    +hibernate.connection.password=sa
    
    31
    +hibernate.hikari.minimumIdle=2
    
    32
    +hibernate.hikari.maximumPoolSize=20
    
    33
    +hibernate.hikari.autoCommit=false
    
    34
    +hibernate.hikari.registerMbeans=true
    
    35
    +
    
    36
    +# Migration configuration
    
    37
    +#topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine
    
    38
    +#topia.service.migration.callback=fr.ird.t3.services.migration.T3MigrationCallback
    
    39
    +#topia.service.migration.showSql=true
    
    40
    +#topia.service.migration.showProgression=true
    
    41
    +#topia.persistence.topiaIdFactoryClassName=org.nuiton.topia.persistence.internal.LegacyTopiaIdFactory

  • t3/.mvn/deploy