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

Commits:

15 changed files:

Changes:

  • t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ConvertCatchesWeightCategoriesAction.java
    ... ... @@ -20,11 +20,11 @@
    20 20
      */
    
    21 21
     package fr.ird.t3.actions.data.level0;
    
    22 22
     
    
    23
    -import com.google.common.collect.Lists;
    
    24 23
     import com.google.common.collect.Maps;
    
    25 24
     import com.google.common.collect.Multimap;
    
    26 25
     import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertor;
    
    27 26
     import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorProvider;
    
    27
    +import fr.ird.t3.entities.conversion.legacy.LegacyWeightCategoryLogBookConvertorProvider;
    
    28 28
     import fr.ird.t3.entities.data.Activity;
    
    29 29
     import fr.ird.t3.entities.data.CorrectedElementaryCatch;
    
    30 30
     import fr.ird.t3.entities.data.CorrectedElementaryCatchTopiaDao;
    
    ... ... @@ -37,15 +37,16 @@ import fr.ird.t3.entities.reference.SpeciesTopiaDao;
    37 37
     import fr.ird.t3.entities.reference.WeightCategoryLogBook;
    
    38 38
     import fr.ird.t3.entities.reference.WeightCategoryTreatment;
    
    39 39
     import fr.ird.t3.services.ioc.InjectDAO;
    
    40
    -import java.util.Collection;
    
    41
    -import java.util.List;
    
    42
    -import java.util.Map;
    
    43 40
     import org.apache.commons.collections.CollectionUtils;
    
    44 41
     import org.apache.commons.collections.MapUtils;
    
    45 42
     import org.apache.commons.logging.Log;
    
    46 43
     import org.apache.commons.logging.LogFactory;
    
    47 44
     import org.nuiton.topia.persistence.TopiaException;
    
    48 45
     
    
    46
    +import java.util.ArrayList;
    
    47
    +import java.util.Collection;
    
    48
    +import java.util.List;
    
    49
    +import java.util.Map;
    
    49 50
     
    
    50 51
     import static org.nuiton.i18n.I18n.l;
    
    51 52
     
    
    ... ... @@ -59,16 +60,11 @@ import static org.nuiton.i18n.I18n.l;
    59 60
      */
    
    60 61
     public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<ConvertCatchesWeightCategoriesConfiguration> {
    
    61 62
     
    
    62
    -    /** Logger. */
    
    63
    -    private static final Log log = LogFactory.getLog(
    
    64
    -            ConvertCatchesWeightCategoriesAction.class);
    
    65
    -
    
    63
    +    private static final Log log = LogFactory.getLog(ConvertCatchesWeightCategoriesAction.class);
    
    64
    +    Map<Species, CatchWeightResult> specieWeightResult;
    
    66 65
         @InjectDAO(entityType = CorrectedElementaryCatch.class)
    
    67
    -    protected CorrectedElementaryCatchTopiaDao correctedElementaryCatchDAO;
    
    68
    -
    
    69
    -    protected WeightCategoryLogBookConvertorProvider convertorProvider;
    
    70
    -
    
    71
    -    protected Map<Species, CatchWeightResult> specieWeightResult;
    
    66
    +    private CorrectedElementaryCatchTopiaDao correctedElementaryCatchDAO;
    
    67
    +    private WeightCategoryLogBookConvertorProvider convertorProvider;
    
    72 68
     
    
    73 69
         public ConvertCatchesWeightCategoriesAction() {
    
    74 70
             super(Level0Step.CONVERT_CATCHES_WEIGHT_CATEGORIES);
    
    ... ... @@ -82,7 +78,7 @@ public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<C
    82 78
             return specieWeightResult.get(species);
    
    83 79
         }
    
    84 80
     
    
    85
    -    protected CatchWeightResult getCatchWeithResult(Map<Species, CatchWeightResult> specieWeightResult, Species species) {
    
    81
    +    private CatchWeightResult getCatchWeithResult(Map<Species, CatchWeightResult> specieWeightResult, Species species) {
    
    86 82
             CatchWeightResult result = specieWeightResult.get(species);
    
    87 83
             if (result == null) {
    
    88 84
                 result = new CatchWeightResult();
    
    ... ... @@ -96,8 +92,7 @@ public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<C
    96 92
     
    
    97 93
             super.prepareAction();
    
    98 94
     
    
    99
    -        setConvertorProvider(
    
    100
    -                WeightCategoryLogBookConvertorProvider.newInstance(getT3TopiaPersistenceContext().get()));
    
    95
    +        setConvertorProvider(LegacyWeightCategoryLogBookConvertorProvider.newInstance(getT3TopiaPersistenceContext().get()));
    
    101 96
     
    
    102 97
             List<Trip> tripList = getUsableTrips(null, true);
    
    103 98
             setTrips(tripList);
    
    ... ... @@ -130,7 +125,7 @@ public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<C
    130 125
             return result;
    
    131 126
         }
    
    132 127
     
    
    133
    -    protected boolean executeForTrip(Trip trip) throws TopiaException {
    
    128
    +    private boolean executeForTrip(Trip trip) throws TopiaException {
    
    134 129
     
    
    135 130
             incrementsProgression();
    
    136 131
     
    
    ... ... @@ -162,22 +157,19 @@ public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<C
    162 157
                     }
    
    163 158
     
    
    164 159
                     if (log.isInfoEnabled()) {
    
    165
    -                    log.info("Treat activity " + activity.getDate() +
    
    166
    -                             " with " + activity.sizeElementaryCatch());
    
    160
    +                    log.info(String.format("Treat activity %s with %d", activity.getDate(), activity.sizeElementaryCatch()));
    
    167 161
                     }
    
    168 162
                     Ocean currentOcean = activity.getOcean();
    
    169 163
                     SchoolType schoolType = activity.getSchoolType();
    
    170 164
     
    
    171 165
                     // get converter for this ocean and school type
    
    172
    -                WeightCategoryLogBookConvertor converter =
    
    173
    -                        convertorProvider.getConvertor(currentOcean, schoolType);
    
    166
    +                WeightCategoryLogBookConvertor converter = convertorProvider.getConvertor(currentOcean, schoolType);
    
    174 167
     
    
    175 168
                     if (converter == null) {
    
    176 169
     
    
    177 170
                         // can not redistribute if no weight categories found
    
    178 171
                         message = l(locale, "t3.level0.convertCatchesWeightCategories.warning.noconvertor.found",
    
    179
    -                                 currentOcean.getLabel1(),
    
    180
    -                                 schoolType.getLabel1());
    
    172
    +                            currentOcean.getLabel1(), schoolType.getLabel1());
    
    181 173
                         if (log.isWarnEnabled()) {
    
    182 174
                             log.warn(message);
    
    183 175
                         }
    
    ... ... @@ -185,33 +177,24 @@ public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<C
    185 177
                         continue;
    
    186 178
                     }
    
    187 179
     
    
    188
    -                if (log.isDebugEnabled()) {
    
    189
    -                    log.debug("Use converter " + converter);
    
    190
    -                }
    
    191
    -
    
    192 180
                     // split catches by species
    
    193
    -                Multimap<Species, ElementaryCatch> catchesBySpecie =
    
    194
    -                        SpeciesTopiaDao.groupBySpecies(activity.getElementaryCatch());
    
    181
    +                Multimap<Species, ElementaryCatch> catchesBySpecie = SpeciesTopiaDao.groupBySpecies(activity.getElementaryCatch());
    
    195 182
     
    
    196 183
                     for (Species species : catchesBySpecie.keySet()) {
    
    197 184
     
    
    198
    -                    CatchWeightResult catchWeightResult =
    
    199
    -                            getCatchWeithResult(tripResult, species);
    
    185
    +                    CatchWeightResult catchWeightResult = getCatchWeithResult(tripResult, species);
    
    200 186
     
    
    201
    -                    Collection<ElementaryCatch> catches =
    
    202
    -                            catchesBySpecie.get(species);
    
    187
    +                    Collection<ElementaryCatch> catches = catchesBySpecie.get(species);
    
    203 188
     
    
    204 189
                         catchWeightResult.addLogBookWeight(catches);
    
    205 190
     
    
    206 191
                         if (log.isInfoEnabled()) {
    
    207
    -                        log.info("Treat species " + species.getCode() + " with " +
    
    208
    -                                 catches.size() + " catches");
    
    192
    +                        log.info(String.format("Treat species %d with %d catches", species.getCode(), catches.size()));
    
    209 193
                         }
    
    210 194
     
    
    211 195
                         // converts to weight category treatment for this species
    
    212 196
     
    
    213
    -                    Map<WeightCategoryTreatment, Float> distribution =
    
    214
    -                            converter.distribute(species, catches);
    
    197
    +                    Map<WeightCategoryTreatment, Float> distribution = converter.distribute(species, catches);
    
    215 198
     
    
    216 199
                         if (MapUtils.isEmpty(distribution)) {
    
    217 200
     
    
    ... ... @@ -219,20 +202,17 @@ public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<C
    219 202
                             continue;
    
    220 203
                         }
    
    221 204
     
    
    222
    -                    Collection<CorrectedElementaryCatch> newCatches =
    
    223
    -                            Lists.newArrayList();
    
    205
    +                    Collection<CorrectedElementaryCatch> newCatches = new ArrayList<>();
    
    224 206
     
    
    225 207
                         // create new catches
    
    226
    -                    for (Map.Entry<WeightCategoryTreatment, Float> e2 :
    
    227
    -                            distribution.entrySet()) {
    
    208
    +                    for (Map.Entry<WeightCategoryTreatment, Float> e2 : distribution.entrySet()) {
    
    228 209
                             WeightCategoryTreatment weightCategoryTreatment = e2.getKey();
    
    229 210
                             Float weight = e2.getValue();
    
    230 211
                             CorrectedElementaryCatch correctedElementaryCatch =
    
    231 212
                                     correctedElementaryCatchDAO.create(
    
    232 213
                                             CorrectedElementaryCatch.PROPERTY_WEIGHT_CATEGORY_TREATMENT, weightCategoryTreatment,
    
    233 214
                                             CorrectedElementaryCatch.PROPERTY_SPECIES, species,
    
    234
    -                                        CorrectedElementaryCatch.PROPERTY_CATCH_WEIGHT, weight
    
    235
    -                                );
    
    215
    +                                        CorrectedElementaryCatch.PROPERTY_CATCH_WEIGHT, weight);
    
    236 216
     
    
    237 217
                             newCatches.add(correctedElementaryCatch);
    
    238 218
                         }
    
    ... ... @@ -272,15 +252,14 @@ public class ConvertCatchesWeightCategoriesAction extends AbstractLevel0Action<C
    272 252
             return true;
    
    273 253
         }
    
    274 254
     
    
    275
    -    public void setConvertorProvider(WeightCategoryLogBookConvertorProvider convertorProvider) {
    
    255
    +    private void setConvertorProvider(WeightCategoryLogBookConvertorProvider convertorProvider) {
    
    276 256
             this.convertorProvider = convertorProvider;
    
    277 257
         }
    
    278 258
     
    
    279 259
         public static class CatchWeightResult {
    
    280 260
     
    
    281
    -        protected float logBookTotalWeight;
    
    282
    -
    
    283
    -        protected float treatmentTotalWeight;
    
    261
    +        float logBookTotalWeight;
    
    262
    +        float treatmentTotalWeight;
    
    284 263
     
    
    285 264
             public float getLogBookTotalWeight() {
    
    286 265
                 return logBookTotalWeight;
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorProvider.java
    ... ... @@ -8,28 +8,27 @@
    8 8
      * it under the terms of the GNU Affero General Public License as published by
    
    9 9
      * the Free Software Foundation, either version 3 of the License, or
    
    10 10
      * (at your option) any later version.
    
    11
    - * 
    
    11
    + *
    
    12 12
      * This program is distributed in the hope that it will be useful,
    
    13 13
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14 14
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15 15
      * GNU General Public License for more details.
    
    16
    - * 
    
    16
    + *
    
    17 17
      * You should have received a copy of the GNU Affero General Public License
    
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21 21
     package fr.ird.t3.entities.conversion;
    
    22 22
     
    
    23
    -import com.google.common.base.Preconditions;
    
    24
    -import com.google.common.collect.Lists;
    
    25
    -import fr.ird.t3.entities.T3TopiaPersistenceContext;
    
    26 23
     import fr.ird.t3.entities.reference.Ocean;
    
    27 24
     import fr.ird.t3.entities.reference.SchoolType;
    
    28 25
     import fr.ird.t3.entities.reference.WeightCategoryTreatment;
    
    29 26
     import fr.ird.t3.entities.reference.WeightCategoryTreatmentTopiaDao;
    
    30
    -import java.util.Collection;
    
    31 27
     import org.nuiton.topia.persistence.TopiaException;
    
    32 28
     
    
    29
    +import java.util.Collection;
    
    30
    +import java.util.Objects;
    
    31
    +
    
    33 32
     /**
    
    34 33
      * To obtain a  ll available wieght convertors.
    
    35 34
      *
    
    ... ... @@ -38,157 +37,23 @@ import org.nuiton.topia.persistence.TopiaException;
    38 37
      */
    
    39 38
     public class WeightCategoryLogBookConvertorProvider {
    
    40 39
     
    
    41
    -    protected static final String OCEAN =
    
    42
    -            WeightCategoryTreatment.PROPERTY_OCEAN + "." + Ocean.PROPERTY_CODE;
    
    43
    -
    
    44
    -    protected static final String SCHOOL_TYPE =
    
    45
    -            WeightCategoryTreatment.PROPERTY_SCHOOL_TYPE + "." +
    
    46
    -                    SchoolType.PROPERTY_CODE;
    
    47
    -
    
    48
    -    protected final Collection<WeightCategoryLogBookConvertor> convertors;
    
    49
    -
    
    50
    -    public static final int OA = 1;
    
    51
    -
    
    52
    -    public static final int OI = 2;
    
    53
    -
    
    54
    -    public static final int OP = 5;
    
    55
    -
    
    56
    -    public static final int BO = 1;
    
    57
    -
    
    58
    -    public static final int BL = 2;
    
    59
    -
    
    60
    -    public static final int BI = 3;
    
    61
    -
    
    62
    -    public static WeightCategoryLogBookConvertorProvider newInstance(T3TopiaPersistenceContext transaction) throws TopiaException {
    
    63
    -
    
    64
    -        WeightCategoryTreatmentTopiaDao dao = transaction.getWeightCategoryTreatmentDao();
    
    65
    -
    
    66
    -        Collection<WeightCategoryLogBookConvertor> converters =
    
    67
    -                Lists.newArrayList();
    
    68
    -
    
    69
    -        // BO = 1, BL = 2, BI = 3
    
    70
    -        // OA = 1, OI = 2, OP = 5
    
    71
    -
    
    72
    -        prepareForOA(dao, converters);
    
    73
    -        prepareForOI(dao, converters);
    
    74
    -        prepareForOP(dao, converters);
    
    75
    -
    
    76
    -        return new WeightCategoryLogBookConvertorProvider(converters);
    
    77
    -    }
    
    78
    -
    
    79
    -    private static void prepareForOA(WeightCategoryTreatmentTopiaDao dao,
    
    80
    -                                     Collection<WeightCategoryLogBookConvertor> converters) throws TopiaException {
    
    81
    -        {
    
    82
    -            // BO Convertor
    
    83
    -            WeightCategoryLogBookConvertor convertor =
    
    84
    -                    new WeightCategoryLogBookConvertorFOR_OABO(
    
    85
    -                            getCategory(dao, OA, BO, null, null),
    
    86
    -                            getCategory(dao, OA, BO, 0, 10),
    
    87
    -                            getCategory(dao, OA, BO, 10, null)
    
    88
    -                    );
    
    89
    -            converters.add(convertor);
    
    90
    -        }
    
    91
    -        {
    
    92
    -            // BL Convertor
    
    93
    -            WeightCategoryLogBookConvertor convertor =
    
    94
    -                    new WeightCategoryLogBookConvertorFOR_OABL(
    
    95
    -                            getCategory(dao, OA, BL, null, null),
    
    96
    -                            getCategory(dao, OA, BL, 0, 10),
    
    97
    -                            getCategory(dao, OA, BL, 10, 30),
    
    98
    -                            getCategory(dao, OA, BL, 30, null)
    
    99
    -                    );
    
    100
    -            converters.add(convertor);
    
    101
    -        }
    
    102
    -        {
    
    103
    -            // BI Convertor
    
    104
    -            WeightCategoryLogBookConvertor convertor =
    
    105
    -                    new WeightCategoryLogBookConvertorFOR_OABI(
    
    106
    -                            getCategory(dao, OA, BI, null, null),
    
    107
    -                            getCategory(dao, OA, BI, 0, 10),
    
    108
    -                            getCategory(dao, OA, BI, 10, 30),
    
    109
    -                            getCategory(dao, OA, BI, 30, null)
    
    110
    -                    );
    
    111
    -            converters.add(convertor);
    
    112
    -        }
    
    113
    -
    
    114
    -    }
    
    115
    -
    
    116
    -    private static void prepareForOI(WeightCategoryTreatmentTopiaDao dao,
    
    117
    -                                     Collection<WeightCategoryLogBookConvertor> converters) throws TopiaException {
    
    118
    -
    
    119
    -        {
    
    120
    -            // BO Convertor
    
    121
    -            WeightCategoryLogBookConvertor convertor =
    
    122
    -                    new WeightCategoryLogBookConvertorFOR_OIBO(
    
    123
    -                            getCategory(dao, OI, BO, null, null),
    
    124
    -                            getCategory(dao, OI, BO, 0, 10),
    
    125
    -                            getCategory(dao, OI, BO, 10, null)
    
    126
    -                    );
    
    127
    -            converters.add(convertor);
    
    128
    -        }
    
    129
    -        {
    
    130
    -            // BL Convertor
    
    131
    -            WeightCategoryLogBookConvertor convertor =
    
    132
    -                    new WeightCategoryLogBookConvertorFOR_OIBL(
    
    133
    -                            getCategory(dao, OI, BL, null, null),
    
    134
    -                            getCategory(dao, OI, BL, 0, 10),
    
    135
    -                            getCategory(dao, OI, BL, 10, null)
    
    136
    -                    );
    
    137
    -            converters.add(convertor);
    
    138
    -        }
    
    139
    -        {
    
    140
    -            // BI Convertor
    
    141
    -            WeightCategoryLogBookConvertor convertor =
    
    142
    -                    new WeightCategoryLogBookConvertorFOR_OIBI(
    
    143
    -                            getCategory(dao, OI, BI, null, null),
    
    144
    -                            getCategory(dao, OI, BI, 0, 10),
    
    145
    -                            getCategory(dao, OI, BI, 10, null)
    
    146
    -                    );
    
    147
    -            converters.add(convertor);
    
    148
    -        }
    
    149
    -    }
    
    150
    -
    
    151
    -    private static void prepareForOP(WeightCategoryTreatmentTopiaDao dao,
    
    152
    -                                     Collection<WeightCategoryLogBookConvertor> converters) throws TopiaException {
    
    153
    -
    
    154
    -        {
    
    155
    -            // BO Convertor
    
    156
    -            WeightCategoryLogBookConvertor convertor =
    
    157
    -                    new WeightCategoryLogBookConvertorFOR_OPBO(
    
    158
    -                            getCategory(dao, OP, BO, null, null),
    
    159
    -                            getCategory(dao, OP, BO, 0, 10),
    
    160
    -                            getCategory(dao, OP, BO, 10, null)
    
    161
    -                    );
    
    162
    -            converters.add(convertor);
    
    163
    -        }
    
    164
    -        {
    
    165
    -            // BL Convertor
    
    166
    -            WeightCategoryLogBookConvertor convertor =
    
    167
    -                    new WeightCategoryLogBookConvertorFOR_OPBL(
    
    168
    -                            getCategory(dao, OP, BL, null, null),
    
    169
    -                            getCategory(dao, OP, BL, 0, 10),
    
    170
    -                            getCategory(dao, OP, BL, 10, null)
    
    171
    -                    );
    
    172
    -            converters.add(convertor);
    
    173
    -        }
    
    174
    -        {
    
    175
    -            // BI Convertor
    
    176
    -            WeightCategoryLogBookConvertor convertor =
    
    177
    -                    new WeightCategoryLogBookConvertorFOR_OPBI(
    
    178
    -                            getCategory(dao, OP, BI, null, null),
    
    179
    -                            getCategory(dao, OP, BI, 0, 10),
    
    180
    -                            getCategory(dao, OP, BI, 10, null)
    
    181
    -                    );
    
    182
    -            converters.add(convertor);
    
    183
    -        }
    
    184
    -    }
    
    40
    +    private final Collection<WeightCategoryLogBookConvertor> convertors;
    
    185 41
     
    
    186 42
         protected WeightCategoryLogBookConvertorProvider(Collection<WeightCategoryLogBookConvertor> convertors) {
    
    187 43
             this.convertors = convertors;
    
    188 44
         }
    
    189 45
     
    
    190
    -    public WeightCategoryLogBookConvertor getConvertor(Ocean ocean,
    
    191
    -                                                       SchoolType schoolType) {
    
    46
    +    protected static WeightCategoryTreatment getCategory(WeightCategoryTreatmentTopiaDao dao,
    
    47
    +                                                         int oceanCode,
    
    48
    +                                                         int schoolTypeCode,
    
    49
    +                                                         Integer min,
    
    50
    +                                                         Integer max) throws TopiaException {
    
    51
    +        WeightCategoryTreatment result = dao.findByOceanSchoolTypeAndBound(oceanCode, schoolTypeCode, min, max);
    
    52
    +        return Objects.requireNonNull(result,
    
    53
    +                String.format("Could not find weight treatment category with parameters : [ocean:%d, schoolType:%d, min:%d, max:%d]", oceanCode, schoolTypeCode, min, max));
    
    54
    +    }
    
    55
    +
    
    56
    +    public WeightCategoryLogBookConvertor getConvertor(Ocean ocean, SchoolType schoolType) {
    
    192 57
             WeightCategoryLogBookConvertor result = null;
    
    193 58
             for (WeightCategoryLogBookConvertor converter : convertors) {
    
    194 59
                 if (converter.accept(ocean, schoolType)) {
    
    ... ... @@ -198,26 +63,4 @@ public class WeightCategoryLogBookConvertorProvider {
    198 63
             }
    
    199 64
             return result;
    
    200 65
         }
    
    201
    -
    
    202
    -    private static WeightCategoryTreatment getCategory(WeightCategoryTreatmentTopiaDao dao,
    
    203
    -                                                       int oceanCode,
    
    204
    -                                                       int schoolTypeCode,
    
    205
    -                                                       Integer min,
    
    206
    -                                                       Integer max) throws TopiaException {
    
    207
    -
    
    208
    -        WeightCategoryTreatment result = dao.findByOceanSchoolTypeAndBound(
    
    209
    -                oceanCode,
    
    210
    -                schoolTypeCode,
    
    211
    -                min,
    
    212
    -                max
    
    213
    -        );
    
    214
    -
    
    215
    -        Preconditions.checkNotNull(
    
    216
    -                result,
    
    217
    -                "Could not find weight treatment category with " +
    
    218
    -                        "parameters : [ocean:" + oceanCode + ", schoolType:" +
    
    219
    -                        schoolTypeCode + ", min:" + min + ", max:" + max + "]"
    
    220
    -        );
    
    221
    -        return result;
    
    222
    -    }
    
    223 66
     }

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/AbstractWeightCategoryLogBookConvertor.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/AbstractWeightCategoryLogBookConvertor.java
    ... ... @@ -18,8 +18,9 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertor;
    
    23 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    24 25
     import fr.ird.t3.entities.reference.Ocean;
    
    25 26
     import fr.ird.t3.entities.reference.SchoolType;
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/LegacyWeightCategoryLogBookConvertorProvider.java
    1
    +/*
    
    2
    + * #%L
    
    3
    + * T3 :: Domain
    
    4
    + * %%
    
    5
    + * Copyright (C) 2010 - 2017 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
    +package fr.ird.t3.entities.conversion.legacy;
    
    22
    +
    
    23
    +import com.google.common.collect.Lists;
    
    24
    +import fr.ird.t3.entities.T3TopiaPersistenceContext;
    
    25
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertor;
    
    26
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorProvider;
    
    27
    +import fr.ird.t3.entities.reference.WeightCategoryTreatmentTopiaDao;
    
    28
    +import org.nuiton.topia.persistence.TopiaException;
    
    29
    +
    
    30
    +import java.util.Collection;
    
    31
    +
    
    32
    +/**
    
    33
    + * To obtain a  ll available wieght convertors.
    
    34
    + *
    
    35
    + * @author Tony Chemit - dev@tchemit.fr
    
    36
    + * @since 1.0
    
    37
    + */
    
    38
    +public class LegacyWeightCategoryLogBookConvertorProvider extends WeightCategoryLogBookConvertorProvider {
    
    39
    +
    
    40
    +    public static final int OA = 1;
    
    41
    +    public static final int OI = 2;
    
    42
    +    public static final int OP = 5;
    
    43
    +    public static final int BO = 1;
    
    44
    +    public static final int BL = 2;
    
    45
    +    public static final int BI = 3;
    
    46
    +
    
    47
    +    private LegacyWeightCategoryLogBookConvertorProvider(Collection<WeightCategoryLogBookConvertor> convertors) {
    
    48
    +        super(convertors);
    
    49
    +    }
    
    50
    +
    
    51
    +    public static WeightCategoryLogBookConvertorProvider newInstance(T3TopiaPersistenceContext transaction) throws TopiaException {
    
    52
    +
    
    53
    +        WeightCategoryTreatmentTopiaDao dao = transaction.getWeightCategoryTreatmentDao();
    
    54
    +
    
    55
    +        Collection<WeightCategoryLogBookConvertor> converters =
    
    56
    +                Lists.newArrayList();
    
    57
    +
    
    58
    +        // BO = 1, BL = 2, BI = 3
    
    59
    +        // OA = 1, OI = 2, OP = 5
    
    60
    +
    
    61
    +        prepareForOA(dao, converters);
    
    62
    +        prepareForOI(dao, converters);
    
    63
    +        prepareForOP(dao, converters);
    
    64
    +
    
    65
    +        return new LegacyWeightCategoryLogBookConvertorProvider(converters);
    
    66
    +    }
    
    67
    +
    
    68
    +    private static void prepareForOA(WeightCategoryTreatmentTopiaDao dao,
    
    69
    +                                     Collection<WeightCategoryLogBookConvertor> converters) throws TopiaException {
    
    70
    +        {
    
    71
    +            // BO Convertor
    
    72
    +            WeightCategoryLogBookConvertor convertor =
    
    73
    +                    new WeightCategoryLogBookConvertorFOR_OABO(
    
    74
    +                            getCategory(dao, OA, BO, null, null),
    
    75
    +                            getCategory(dao, OA, BO, 0, 10),
    
    76
    +                            getCategory(dao, OA, BO, 10, null)
    
    77
    +                    );
    
    78
    +            converters.add(convertor);
    
    79
    +        }
    
    80
    +        {
    
    81
    +            // BL Convertor
    
    82
    +            WeightCategoryLogBookConvertor convertor =
    
    83
    +                    new WeightCategoryLogBookConvertorFOR_OABL(
    
    84
    +                            getCategory(dao, OA, BL, null, null),
    
    85
    +                            getCategory(dao, OA, BL, 0, 10),
    
    86
    +                            getCategory(dao, OA, BL, 10, 30),
    
    87
    +                            getCategory(dao, OA, BL, 30, null)
    
    88
    +                    );
    
    89
    +            converters.add(convertor);
    
    90
    +        }
    
    91
    +        {
    
    92
    +            // BI Convertor
    
    93
    +            WeightCategoryLogBookConvertor convertor =
    
    94
    +                    new WeightCategoryLogBookConvertorFOR_OABI(
    
    95
    +                            getCategory(dao, OA, BI, null, null),
    
    96
    +                            getCategory(dao, OA, BI, 0, 10),
    
    97
    +                            getCategory(dao, OA, BI, 10, 30),
    
    98
    +                            getCategory(dao, OA, BI, 30, null)
    
    99
    +                    );
    
    100
    +            converters.add(convertor);
    
    101
    +        }
    
    102
    +
    
    103
    +    }
    
    104
    +
    
    105
    +    private static void prepareForOI(WeightCategoryTreatmentTopiaDao dao,
    
    106
    +                                     Collection<WeightCategoryLogBookConvertor> converters) throws TopiaException {
    
    107
    +
    
    108
    +        {
    
    109
    +            // BO Convertor
    
    110
    +            WeightCategoryLogBookConvertor convertor =
    
    111
    +                    new WeightCategoryLogBookConvertorFOR_OIBO(
    
    112
    +                            getCategory(dao, OI, BO, null, null),
    
    113
    +                            getCategory(dao, OI, BO, 0, 10),
    
    114
    +                            getCategory(dao, OI, BO, 10, null)
    
    115
    +                    );
    
    116
    +            converters.add(convertor);
    
    117
    +        }
    
    118
    +        {
    
    119
    +            // BL Convertor
    
    120
    +            WeightCategoryLogBookConvertor convertor =
    
    121
    +                    new WeightCategoryLogBookConvertorFOR_OIBL(
    
    122
    +                            getCategory(dao, OI, BL, null, null),
    
    123
    +                            getCategory(dao, OI, BL, 0, 10),
    
    124
    +                            getCategory(dao, OI, BL, 10, null)
    
    125
    +                    );
    
    126
    +            converters.add(convertor);
    
    127
    +        }
    
    128
    +        {
    
    129
    +            // BI Convertor
    
    130
    +            WeightCategoryLogBookConvertor convertor =
    
    131
    +                    new WeightCategoryLogBookConvertorFOR_OIBI(
    
    132
    +                            getCategory(dao, OI, BI, null, null),
    
    133
    +                            getCategory(dao, OI, BI, 0, 10),
    
    134
    +                            getCategory(dao, OI, BI, 10, null)
    
    135
    +                    );
    
    136
    +            converters.add(convertor);
    
    137
    +        }
    
    138
    +    }
    
    139
    +
    
    140
    +    private static void prepareForOP(WeightCategoryTreatmentTopiaDao dao,
    
    141
    +                                     Collection<WeightCategoryLogBookConvertor> converters) throws TopiaException {
    
    142
    +
    
    143
    +        {
    
    144
    +            // BO Convertor
    
    145
    +            WeightCategoryLogBookConvertor convertor =
    
    146
    +                    new WeightCategoryLogBookConvertorFOR_OPBO(
    
    147
    +                            getCategory(dao, OP, BO, null, null),
    
    148
    +                            getCategory(dao, OP, BO, 0, 10),
    
    149
    +                            getCategory(dao, OP, BO, 10, null)
    
    150
    +                    );
    
    151
    +            converters.add(convertor);
    
    152
    +        }
    
    153
    +        {
    
    154
    +            // BL Convertor
    
    155
    +            WeightCategoryLogBookConvertor convertor =
    
    156
    +                    new WeightCategoryLogBookConvertorFOR_OPBL(
    
    157
    +                            getCategory(dao, OP, BL, null, null),
    
    158
    +                            getCategory(dao, OP, BL, 0, 10),
    
    159
    +                            getCategory(dao, OP, BL, 10, null)
    
    160
    +                    );
    
    161
    +            converters.add(convertor);
    
    162
    +        }
    
    163
    +        {
    
    164
    +            // BI Convertor
    
    165
    +            WeightCategoryLogBookConvertor convertor =
    
    166
    +                    new WeightCategoryLogBookConvertorFOR_OPBI(
    
    167
    +                            getCategory(dao, OP, BI, null, null),
    
    168
    +                            getCategory(dao, OP, BI, 0, 10),
    
    169
    +                            getCategory(dao, OP, BI, 10, null)
    
    170
    +                    );
    
    171
    +            converters.add(convertor);
    
    172
    +        }
    
    173
    +    }
    
    174
    +
    
    175
    +
    
    176
    +}

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OABI.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OABI.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    24 24
     import fr.ird.t3.entities.reference.Species;
    
    ... ... @@ -47,7 +47,7 @@ public class WeightCategoryLogBookConvertorFOR_OABI extends AbstractWeightCatego
    47 47
                 WeightCategoryTreatment plus10Category,
    
    48 48
                 WeightCategoryTreatment plus30Category) {
    
    49 49
     
    
    50
    -        super(WeightCategoryLogBookConvertorProvider.OA, WeightCategoryLogBookConvertorProvider.BI, minus10Category, unknownCategory);
    
    50
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OA, LegacyWeightCategoryLogBookConvertorProvider.BI, minus10Category, unknownCategory);
    
    51 51
             this.plus10Category = plus10Category;
    
    52 52
             this.plus30Category = plus30Category;
    
    53 53
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OABL.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OABL.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import com.google.common.collect.Maps;
    
    24 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    ... ... @@ -45,8 +45,8 @@ public class WeightCategoryLogBookConvertorFOR_OABL extends AbstractWeightCatego
    45 45
                 WeightCategoryTreatment plus10Category,
    
    46 46
                 WeightCategoryTreatment plus30Category) {
    
    47 47
     
    
    48
    -        super(WeightCategoryLogBookConvertorProvider.OA,
    
    49
    -              WeightCategoryLogBookConvertorProvider.BL,
    
    48
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OA,
    
    49
    +              LegacyWeightCategoryLogBookConvertorProvider.BL,
    
    50 50
                   minus10Category, unknownCategory);
    
    51 51
             this.plus10Category = plus10Category;
    
    52 52
             this.plus30Category = plus30Category;
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OABO.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OABO.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import com.google.common.collect.Maps;
    
    24 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    ... ... @@ -42,8 +42,8 @@ public class WeightCategoryLogBookConvertorFOR_OABO extends AbstractWeightCatego
    42 42
                 WeightCategoryTreatment minus10Category,
    
    43 43
                 WeightCategoryTreatment plus10Category) {
    
    44 44
     
    
    45
    -        super(WeightCategoryLogBookConvertorProvider.OA,
    
    46
    -              WeightCategoryLogBookConvertorProvider.BO,
    
    45
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OA,
    
    46
    +              LegacyWeightCategoryLogBookConvertorProvider.BO,
    
    47 47
                   minus10Category, unknownCategory);
    
    48 48
             this.plus10Category = plus10Category;
    
    49 49
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OIBI.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OIBI.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    24 24
     import fr.ird.t3.entities.reference.Species;
    
    ... ... @@ -44,8 +44,8 @@ public class WeightCategoryLogBookConvertorFOR_OIBI extends AbstractWeightCatego
    44 44
                 WeightCategoryTreatment minus10Category,
    
    45 45
                 WeightCategoryTreatment plus10Category) {
    
    46 46
     
    
    47
    -        super(WeightCategoryLogBookConvertorProvider.OI,
    
    48
    -              WeightCategoryLogBookConvertorProvider.BI,
    
    47
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OI,
    
    48
    +              LegacyWeightCategoryLogBookConvertorProvider.BI,
    
    49 49
                   minus10Category, unknownCategory);
    
    50 50
             this.plus10Category = plus10Category;
    
    51 51
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OIBL.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OIBL.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import com.google.common.collect.Maps;
    
    24 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    ... ... @@ -42,8 +42,8 @@ public class WeightCategoryLogBookConvertorFOR_OIBL extends AbstractWeightCatego
    42 42
                 WeightCategoryTreatment minus10Category,
    
    43 43
                 WeightCategoryTreatment plus10Category) {
    
    44 44
     
    
    45
    -        super(WeightCategoryLogBookConvertorProvider.OI,
    
    46
    -              WeightCategoryLogBookConvertorProvider.BL,
    
    45
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OI,
    
    46
    +              LegacyWeightCategoryLogBookConvertorProvider.BL,
    
    47 47
                   minus10Category, unknownCategory);
    
    48 48
             this.plus10Category = plus10Category;
    
    49 49
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OIBO.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OIBO.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import com.google.common.collect.Maps;
    
    24 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    ... ... @@ -42,8 +42,8 @@ public class WeightCategoryLogBookConvertorFOR_OIBO extends AbstractWeightCatego
    42 42
                 WeightCategoryTreatment minus10Category,
    
    43 43
                 WeightCategoryTreatment plus10Category) {
    
    44 44
     
    
    45
    -        super(WeightCategoryLogBookConvertorProvider.OI,
    
    46
    -              WeightCategoryLogBookConvertorProvider.BO,
    
    45
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OI,
    
    46
    +              LegacyWeightCategoryLogBookConvertorProvider.BO,
    
    47 47
                   minus10Category, unknownCategory);
    
    48 48
             this.plus10Category = plus10Category;
    
    49 49
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OPBI.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OPBI.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import com.google.common.collect.Maps;
    
    24 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    ... ... @@ -42,8 +42,8 @@ public class WeightCategoryLogBookConvertorFOR_OPBI extends AbstractWeightCatego
    42 42
                 WeightCategoryTreatment minus10Category,
    
    43 43
                 WeightCategoryTreatment plus10Category) {
    
    44 44
     
    
    45
    -        super(WeightCategoryLogBookConvertorProvider.OP,
    
    46
    -              WeightCategoryLogBookConvertorProvider.BI,
    
    45
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OP,
    
    46
    +              LegacyWeightCategoryLogBookConvertorProvider.BI,
    
    47 47
                   minus10Category, unknownCategory);
    
    48 48
             this.plus10Category = plus10Category;
    
    49 49
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OPBL.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OPBL.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import com.google.common.collect.Maps;
    
    24 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    ... ... @@ -42,8 +42,8 @@ public class WeightCategoryLogBookConvertorFOR_OPBL extends AbstractWeightCatego
    42 42
                 WeightCategoryTreatment minus10Category,
    
    43 43
                 WeightCategoryTreatment plus10Category) {
    
    44 44
     
    
    45
    -        super(WeightCategoryLogBookConvertorProvider.OP,
    
    46
    -              WeightCategoryLogBookConvertorProvider.BL,
    
    45
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OP,
    
    46
    +              LegacyWeightCategoryLogBookConvertorProvider.BL,
    
    47 47
                   minus10Category, unknownCategory);
    
    48 48
             this.plus10Category = plus10Category;
    
    49 49
         }
    

  • t3-domain/src/main/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorFOR_OPBO.javat3-domain/src/main/java/fr/ird/t3/entities/conversion/legacy/WeightCategoryLogBookConvertorFOR_OPBO.java
    ... ... @@ -18,7 +18,7 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import com.google.common.collect.Maps;
    
    24 24
     import fr.ird.t3.entities.data.ElementaryCatch;
    
    ... ... @@ -42,8 +42,8 @@ public class WeightCategoryLogBookConvertorFOR_OPBO extends AbstractWeightCatego
    42 42
                 WeightCategoryTreatment minus10Category,
    
    43 43
                 WeightCategoryTreatment plus10Category) {
    
    44 44
     
    
    45
    -        super(WeightCategoryLogBookConvertorProvider.OP,
    
    46
    -              WeightCategoryLogBookConvertorProvider.BO,
    
    45
    +        super(LegacyWeightCategoryLogBookConvertorProvider.OP,
    
    46
    +              LegacyWeightCategoryLogBookConvertorProvider.BO,
    
    47 47
                   minus10Category, unknownCategory);
    
    48 48
             this.plus10Category = plus10Category;
    
    49 49
         }
    

  • t3-domain/src/test/java/fr/ird/t3/entities/conversion/WeightCategoryLogBookConvertorProviderTest.javat3-domain/src/test/java/fr/ird/t3/entities/conversion/legacy/LegacyWeightCategoryLogBookConvertorProviderTest.java
    ... ... @@ -18,10 +18,11 @@
    18 18
      * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    19 19
      * #L%
    
    20 20
      */
    
    21
    -package fr.ird.t3.entities.conversion;
    
    21
    +package fr.ird.t3.entities.conversion.legacy;
    
    22 22
     
    
    23 23
     import fr.ird.t3.entities.AbstractDatabaseTest;
    
    24 24
     import fr.ird.t3.entities.T3TopiaPersistenceContext;
    
    25
    +import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorProvider;
    
    25 26
     import org.junit.Assert;
    
    26 27
     import org.junit.Test;
    
    27 28
     
    
    ... ... @@ -31,15 +32,15 @@ import org.junit.Test;
    31 32
      * @author Tony Chemit - dev@tchemit.fr
    
    32 33
      * @since 1.0
    
    33 34
      */
    
    34
    -public class WeightCategoryLogBookConvertorProviderTest extends AbstractDatabaseTest {
    
    35
    +public class LegacyWeightCategoryLogBookConvertorProviderTest extends AbstractDatabaseTest {
    
    35 36
     
    
    36 37
         @Test
    
    37
    -    public void newInstance() throws Exception {
    
    38
    +    public void newInstance() {
    
    38 39
     
    
    39 40
             db.loadClassPathScript("/db/WeightCategoryLogBookConvertorProviderTest.sql");
    
    40 41
     
    
    41 42
             try (T3TopiaPersistenceContext tx = beginTransaction()) {
    
    42
    -            WeightCategoryLogBookConvertorProvider provider = WeightCategoryLogBookConvertorProvider.newInstance(tx);
    
    43
    +            WeightCategoryLogBookConvertorProvider provider = LegacyWeightCategoryLogBookConvertorProvider.newInstance(tx);
    
    43 44
                 Assert.assertNotNull(provider);
    
    44 45
             }
    
    45 46
     
    

  • t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java
    ... ... @@ -24,16 +24,17 @@ package fr.ird.t3.services.migration;
    24 24
     import fr.ird.t3.entities.T3TopiaApplicationContext;
    
    25 25
     import fr.ird.t3.entities.T3TopiaPersistenceContext;
    
    26 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 27
     import fr.ird.t3.entities.conversion.WeightCategoryLogBookConvertorProvider;
    
    28
    +import fr.ird.t3.entities.conversion.legacy.LegacyWeightCategoryLogBookConvertorProvider;
    
    29
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OABI;
    
    30
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OABL;
    
    31
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OABO;
    
    32
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OIBI;
    
    33
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OIBL;
    
    34
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OIBO;
    
    35
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OPBI;
    
    36
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OPBL;
    
    37
    +import fr.ird.t3.entities.conversion.legacy.WeightCategoryLogBookConvertorFOR_OPBO;
    
    37 38
     import fr.ird.t3.entities.reference.Ocean;
    
    38 39
     import fr.ird.t3.entities.reference.OceanTopiaDao;
    
    39 40
     import fr.ird.t3.entities.reference.SchoolType;
    
    ... ... @@ -119,7 +120,7 @@ public class T3MigrationTest {
    119 120
     
    
    120 121
                 try (T3TopiaPersistenceContext persistenceContext = rootContext.newPersistenceContext()) {
    
    121 122
     
    
    122
    -                WeightCategoryLogBookConvertorProvider convertorProvider = WeightCategoryLogBookConvertorProvider.newInstance(persistenceContext);
    
    123
    +                WeightCategoryLogBookConvertorProvider convertorProvider = LegacyWeightCategoryLogBookConvertorProvider.newInstance(persistenceContext);
    
    123 124
     
    
    124 125
                     OceanTopiaDao oceanDao = persistenceContext.getOceanDao();
    
    125 126
                     speciesDao = persistenceContext.getSpeciesDao();