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

Commits:

3 changed files:

Changes:

  • t3-domain/src/main/java/fr/ird/t3/entities/data/ActivityImpl.java
    ... ... @@ -59,6 +59,17 @@ public class ActivityImpl extends ActivityAbstract {
    59 59
         );
    
    60 60
     
    
    61 61
         protected Integer quadrant;
    
    62
    +    private transient Date date;
    
    63
    +
    
    64
    +    @Override
    
    65
    +    public Date getDate() {
    
    66
    +        return date != null ? date : getRoute().getDate();
    
    67
    +    }
    
    68
    +
    
    69
    +    @Override
    
    70
    +    public void setDate(Date date) {
    
    71
    +        this.date = date;
    
    72
    +    }
    
    62 73
     
    
    63 74
         @Override
    
    64 75
         public Trip getTrip() {
    

  • t3-domain/src/main/java/fr/ird/t3/services/migration/T3MigrationCallbackV2_2.java
    ... ... @@ -77,13 +77,13 @@ public class T3MigrationCallbackV2_2 extends T3MigrationCallbackSupport {
    77 77
             for (String tripId : tripList) {
    
    78 78
     
    
    79 79
                 int i = tripId.indexOf('#');
    
    80
    -            String routeIdPrefix = "fr.ird.t3.entities.data.Route#" + tripId.substring(i + 1, tripId.lastIndexOf('#') + 1);
    
    80
    +            String routeIdPrefix = "fr.ird.t3.entities.data.Route#" + tripId.substring(i + 1).replace(".", "").replace("#", "") + "#";
    
    81 81
     
    
    82 82
                 log.info("Route prefix: " + routeIdPrefix);
    
    83 83
                 List<TripActivity> activityList = sqlSupport.findMultipleResult(new TopiaSqlQuery<TripActivity>() {
    
    84 84
                     @Override
    
    85 85
                     public PreparedStatement prepareQuery(Connection connection) throws SQLException {
    
    86
    -                    PreparedStatement preparedStatement = connection.prepareStatement("SELECT a.topiaId, a.date FROM activity a WHERE a.trip = ?");
    
    86
    +                    PreparedStatement preparedStatement = connection.prepareStatement("SELECT a.topiaId, a.date FROM activity a WHERE a.trip = ? ORDER BY date");
    
    87 87
                         preparedStatement.setString(1, tripId);
    
    88 88
                         return preparedStatement;
    
    89 89
                     }
    
    ... ... @@ -94,9 +94,8 @@ public class T3MigrationCallbackV2_2 extends T3MigrationCallbackSupport {
    94 94
                     }
    
    95 95
                 });
    
    96 96
     
    
    97
    -
    
    98
    -            Set<Date> days = new LinkedHashSet<>();
    
    99 97
                 int activityIndex = 0;
    
    98
    +            Set<Date> days = new LinkedHashSet<>();
    
    100 99
                 for (TripActivity activity : activityList) {
    
    101 100
     
    
    102 101
                     String dayDateStr = df.format(activity.date);
    
    ... ... @@ -105,10 +104,10 @@ public class T3MigrationCallbackV2_2 extends T3MigrationCallbackSupport {
    105 104
                     if (days.add(activity.date)) {
    
    106 105
     
    
    107 106
                         log.info(String.format("[%s] new Route: %s", tripId, routeId));
    
    108
    -                    // create new route
    
    107
    +                    activityIndex = 0;
    
    109 108
                         queries.add(String.format("INSERT INTO Route(topiaId, topiaVersion, topiaCreateDate, trip, trip_idx, date) VALUES('%s', 0, CURRENT_TIMESTAMP, '%s', %d, to_date('%s', 'YYY-MM-DD'));", routeId, tripId, days.size() - 1, dayDateStr));
    
    110 109
                     }
    
    111
    -                queries.add(String.format("UPDATE Activity SET route = '%s', route_idx = %d , topiaVersion = topiaVersion + 1 WHERE topiaId = '%s';", routeId, (activityIndex++), activity.activity));
    
    110
    +                queries.add(String.format("UPDATE Activity SET route = '%s', route_idx = %d , topiaVersion = topiaVersion + 1 WHERE topiaId = '%s';", routeId, activityIndex++, activity.activity));
    
    112 111
                 }
    
    113 112
     
    
    114 113
                 if (!activityList.isEmpty()) {
    

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