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

Commits:

16 changed files:

Changes:

  • pom.xml
    ... ... @@ -431,6 +431,10 @@
    431 431
             <file>
    
    432 432
               <exists>.mvn/load-test-data</exists>
    
    433 433
             </file>
    
    434
    +        <property>
    
    435
    +          <name>skipTests</name>
    
    436
    +          <value>!true</value>
    
    437
    +        </property>
    
    434 438
           </activation>
    
    435 439
     
    
    436 440
           <build>
    

  • t3-domain/pom.xml
    ... ... @@ -107,6 +107,10 @@
    107 107
           <groupId>com.google.guava</groupId>
    
    108 108
           <artifactId>guava</artifactId>
    
    109 109
         </dependency>
    
    110
    +    <dependency>
    
    111
    +      <groupId>com.google.code.gson</groupId>
    
    112
    +      <artifactId>gson</artifactId>
    
    113
    +    </dependency>
    
    110 114
     
    
    111 115
         <dependency>
    
    112 116
           <groupId>com.google.auto.service</groupId>
    

  • 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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#00', 1, '2018-02-22 21:36:22.566000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#01', 1, '2018-02-22 21:36:22.636000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#02', 1, '2018-02-22 21:36:22.637000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#03', 1, '2018-02-22 21:36:22.638000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#04', 1, '2018-02-22 21:36:22.638000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#05', 1, '2018-02-22 21:36:22.639000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#06', 1, '2018-02-22 21:36:22.642000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#07', 1, '2018-02-22 21:36:22.645000', '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 weightcategorylogbookconversion (topiaid, topiaversion, topiacreatedate, ocean, schooltype, version, begindate, enddate) VALUES ('fr.ird.t3.entities.reference.WeightCategoryLogBookConversion#1519311532526#08', 1, '2018-02-22 21:36:22.645000', '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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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_
    
    ... ... @@ -34,6 +33,13 @@ fr.ird.t3.entities.data.Route.attribute.activity.tagvalue.orderBy=date
    34 33
     fr.ird.t3.entities.data.Route.attribute.date.tagvalue.hibernateAttributeType.java.util.Date=date
    
    35 34
     fr.ird.t3.entities.data.Activity.attribute.time.tagvalue.hibernateAttributeType.java.util.Date=time
    
    36 35
     
    
    36
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.beginDate.tagValue.hibernateAttributeType.java.util.Date=date
    
    37
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.endDate.tagValue.hibernateAttributeType.java.util.Date=date
    
    38
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.distributions.stereotype=ordered
    
    39
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.distribution.tagValue.sqlType=text
    
    40
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.species.stereotype=unique
    
    41
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.species.tagvalue.manyToManyTableName=WeightCategoryLogBookConversionSpecies_Species
    
    42
    +
    
    37 43
     fr.ird.t3.entities.data.Activity.attribute.comment.tagvalue.sqlType=text
    
    38 44
     fr.ird.t3.entities.data.LocalMarketBatch.attribute.origin.tagvalue.sqlType=text
    
    39 45
     fr.ird.t3.entities.data.LocalMarketBatch.attribute.comment.tagvalue.sqlType=text
    
    ... ... @@ -122,6 +128,21 @@ fr.ird.t3.entities.reference.LengthWeightConversion.attribute.sexe.tagValue.notN
    122 128
     fr.ird.t3.entities.reference.LengthWeightConversion.attribute.beginDate.tagValue.naturalId=true
    
    123 129
     fr.ird.t3.entities.reference.LengthWeightConversion.attribute.beginDate.tagValue.notNull=true
    
    124 130
     
    
    131
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.ocean.tagValue.notNull=true
    
    132
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.schoolType.tagValue.notNull=true
    
    133
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.beginDate.tagValue.notNull=true
    
    134
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.version.tagValue.notNull=true
    
    135
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.class.tagValue.naturalIdMutable=false
    
    136
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.ocean.tagValue.naturalId=true
    
    137
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.schoolType.tagValue.naturalId=true
    
    138
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.beginDate.tagValue.naturalId=true
    
    139
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.version.tagValue.naturalId=true
    
    140
    +
    
    141
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.distribution.tagValue.notNull=true
    
    142
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.parent.tagValue.notNull=true
    
    143
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.class.tagValue.naturalIdMutable=false
    
    144
    +fr.ird.t3.entities.reference.WeightCategoryLogBookConversionSpecies.attribute.parent.tagValue.naturalId=true
    
    145
    +
    
    125 146
     ###############################################################################
    
    126 147
     ### Natural id  for data ######################################################
    
    127 148
     ###############################################################################
    

  • 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
     }