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

Commits:

6 changed files:

Changes:

  • t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeTripEffortsAction.java
    ... ... @@ -130,7 +130,7 @@ public class ComputeTripEffortsAction extends AbstractLevel0Action<ComputeTripEf
    130 130
         }
    
    131 131
     
    
    132 132
         private boolean executeForTrip(Trip trip) throws TopiaException {
    
    133
    -        List<Route> routes = trip.getRoute();
    
    133
    +        List<Route> routes = (List<Route>) trip.getRoute();
    
    134 134
             Route firstRoute = Objects.requireNonNull(routes.get(0));
    
    135 135
             Route lastRoute = Objects.requireNonNull(Iterables.getLast(routes));
    
    136 136
             for (Route route : routes) {
    

  • t3-domain/src/main/java/fr/ird/t3/entities/data/TripImpl.java
    ... ... @@ -31,7 +31,9 @@ import fr.ird.t3.entities.reference.Vessel;
    31 31
     import fr.ird.t3.entities.reference.VesselImpl;
    
    32 32
     import org.nuiton.util.DateUtil;
    
    33 33
     
    
    34
    +import java.util.ArrayList;
    
    34 35
     import java.util.Collection;
    
    36
    +import java.util.Comparator;
    
    35 37
     import java.util.Date;
    
    36 38
     import java.util.HashSet;
    
    37 39
     import java.util.LinkedList;
    
    ... ... @@ -550,15 +552,14 @@ public class TripImpl extends TripAbstract {
    550 552
     
    
    551 553
         @Override
    
    552 554
         public List<Route> getRoute() {
    
    553
    -        List<Route> route = super.getRoute();
    
    554
    -        if (route == null) {
    
    555
    -            setRoute(route = new LinkedList<>());
    
    555
    +        if (super.getRoute() == null) {
    
    556
    +            setRoute(new LinkedList<>());
    
    556 557
             }
    
    557
    -        return route;
    
    558
    +        return new LinkedList<>(route);
    
    558 559
         }
    
    559 560
     
    
    560 561
         private Stream<Route> routeStream() {
    
    561
    -        return getRoute().stream();
    
    562
    +        return getRoute().stream().sorted(Comparator.comparing(Route::getDate));
    
    562 563
         }
    
    563 564
     
    
    564 565
         private Stream<Activity> activityStream() {
    

  • t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_4.java
    1
    +package fr.ird.t3.services.migration;
    
    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.auto.service.AutoService;
    
    25
    +import org.nuiton.topia.migration.TopiaMigrationCallbackByClassNG;
    
    26
    +import org.nuiton.topia.persistence.TopiaException;
    
    27
    +import org.nuiton.topia.persistence.support.TopiaSqlSupport;
    
    28
    +import org.nuiton.version.Versions;
    
    29
    +
    
    30
    +import java.util.List;
    
    31
    +
    
    32
    +/**
    
    33
    + * Created by tchemit on 03/03/2018.
    
    34
    + *
    
    35
    + * @author Tony Chemit - dev@tchemit.fr
    
    36
    + */
    
    37
    +@AutoService(TopiaMigrationCallbackByClassNG.MigrationCallBackForVersion.class)
    
    38
    +public class T3MigrationCallbackV2_4 extends T3MigrationCallbackSupport {
    
    39
    +
    
    40
    +    public T3MigrationCallbackV2_4() {
    
    41
    +        super(Versions.valueOf("2.4"));
    
    42
    +    }
    
    43
    +
    
    44
    +    @Override
    
    45
    +    protected void prepareMigrationScript(TopiaSqlSupport sqlSupport, List<String> queries, boolean showSql, boolean showProgression) throws TopiaException {
    
    46
    +        addScript("01", "delete_idx", queries);
    
    47
    +    }
    
    48
    +
    
    49
    +}

  • t3-domain/src/main/resources/db/migration/V_2_4_01_delete_idx.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
    +ALTER TABLE Route DROP COLUMN trip_idx;
    
    22
    +ALTER TABLE Activity DROP COLUMN route_idx;
    \ No newline at end of file

  • t3-domain/src/main/xmi/t3-persistence.properties
    ... ... @@ -21,15 +21,13 @@
    21 21
     model.tagValue.notGenerateToString=true
    
    22 22
     model.tagValue.generateOperatorForDAOHelper=true
    
    23 23
     model.tagValue.constantPrefix=PROPERTY_
    
    24
    -model.tagValue.version=2.3
    
    24
    +model.tagValue.version=2.4
    
    25 25
     model.tagValue.indexForeignKeys=true
    
    26 26
     
    
    27
    -fr.ird.t3.entities.data.Trip.attribute.route.stereotype=ordered
    
    28
    -fr.ird.t3.entities.data.Route.attribute.activity.stereotype=ordered
    
    29 27
     fr.ird.t3.entities.reference.WeightCategoryLogBookConversion.attribute.distributions.stereotype=ordered
    
    30 28
     
    
    31 29
     fr.ird.t3.entities.data.Trip.attribute.route.tagvalue.orderBy=date
    
    32
    -fr.ird.t3.entities.data.Route.attribute.activity.tagvalue.orderBy=date
    
    30
    +fr.ird.t3.entities.data.Route.attribute.activity.tagvalue.orderBy=number
    
    33 31
     
    
    34 32
     fr.ird.t3.entities.data.Route.attribute.date.tagvalue.hibernateAttributeType.java.util.Date=date
    
    35 33
     fr.ird.t3.entities.data.Activity.attribute.time.tagvalue.hibernateAttributeType.java.util.Date=time
    

  • t3-domain/src/main/xmi/t3-persistence.zargo
    No preview for this file type