Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe

Commits:

12 changed files:

Changes:

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUI.jaxx
    ... ... @@ -157,6 +157,22 @@ protected boolean canEditOcean(java.util.LinkedHashSet<RouteStubDto> routes) {
    157 157
                 </cell>
    
    158 158
               </row>
    
    159 159
     
    
    160
    +          <!-- homeId -->
    
    161
    +          <row>
    
    162
    +
    
    163
    +            <cell anchor='west'>
    
    164
    +              <JLabel id='homeIdLabel'/>
    
    165
    +            </cell>
    
    166
    +            <cell anchor='east' weightx="1" fill="both">
    
    167
    +              <JPanel layout='{new BorderLayout()}'>
    
    168
    +                <JToolBar id='homeIdToolbar' constraints='BorderLayout.WEST'>
    
    169
    +                  <JButton id='resetHomeId' styleClass='resetButton'/>
    
    170
    +                </JToolBar>
    
    171
    +                <JTextField id='homeId' constraints='BorderLayout.CENTER'/>
    
    172
    +              </JPanel>
    
    173
    +            </cell>
    
    174
    +          </row>
    
    175
    +
    
    160 176
               <!-- id ers  -->
    
    161 177
               <row>
    
    162 178
     
    

  • client-core/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUI.jcss
    ... ... @@ -77,6 +77,16 @@ NumberEditor {
    77 77
       selectedItem:{bean.getLandingHarbour()};
    
    78 78
     }
    
    79 79
     
    
    80
    +#resetHomeId {
    
    81
    +  toolTipText:"observe.common.DataDto.action.reset.homeId.tip";
    
    82
    +  _resetPropertyName: {TripSeineDto.PROPERTY_HOME_ID};
    
    83
    +}
    
    84
    +
    
    85
    +#homeId {
    
    86
    +  text:{getStringValue(bean.getHomeId())};
    
    87
    +  _propertyName: {TripSeineDto.PROPERTY_HOME_ID};
    
    88
    +}
    
    89
    +
    
    80 90
     #resetErsId {
    
    81 91
       toolTipText:"observe.common.DataDto.action.reset.ersId.tip";
    
    82 92
       _resetPropertyName:{TripSeineDto.PROPERTY_ERS_ID};
    

  • dto/src/main/models/Observe.model
    ... ... @@ -817,6 +817,7 @@ formsUrl + {*:1} String
    817 817
     reportsUrl + {*:1} String
    
    818 818
     historicalData + {*:1} boolean
    
    819 819
     ersId + {*:1} String
    
    820
    +homeId + {*:1} String
    
    820 821
     routeCount + {*:1} int
    
    821 822
     observer {*:0..1} fr.ird.observe.dto.referential.PersonReference | notNull
    
    822 823
     captain {*:0..1} fr.ird.observe.dto.referential.PersonReference | mayNotNull
    

  • persistence/src/main/java/fr/ird/observe/binder/data/seine/TripSeineEntityDtoBinder.java
    ... ... @@ -50,6 +50,7 @@ public class TripSeineEntityDtoBinder extends DataEntityDtoBinderSupport<TripSei
    50 50
             entity.setFormsUrl(dto.getFormsUrl());
    
    51 51
             entity.setReportsUrl(dto.getReportsUrl());
    
    52 52
             entity.setErsId(dto.getErsId());
    
    53
    +        entity.setHomeId(dto.getHomeId());
    
    53 54
     
    
    54 55
             entity.setOcean(toEntity(dto.getOcean()));
    
    55 56
             entity.setVessel(toEntity(dto.getVessel()));
    
    ... ... @@ -74,6 +75,7 @@ public class TripSeineEntityDtoBinder extends DataEntityDtoBinderSupport<TripSei
    74 75
             dto.setFormsUrl(entity.getFormsUrl());
    
    75 76
             dto.setReportsUrl(entity.getReportsUrl());
    
    76 77
             dto.setErsId(entity.getErsId());
    
    78
    +        dto.setHomeId(entity.getHomeId());
    
    77 79
             dto.setOcean(toReferentialReference(referentialLocale, entity.getOcean()));
    
    78 80
             dto.setVessel(toReferentialReference(referentialLocale, entity.getVessel()));
    
    79 81
             dto.setProgram(toReferentialReference(referentialLocale, entity.getProgram()));
    

  • persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_5_1.java
    1
    +package fr.ird.observe.persistence.migration;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Persistence
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2020 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 General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (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 General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import com.google.auto.service.AutoService;
    
    26
    +import org.apache.commons.lang3.tuple.Pair;
    
    27
    +import org.nuiton.topia.persistence.support.TopiaSqlQuery;
    
    28
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResource;
    
    29
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor;
    
    30
    +import org.nuiton.version.Versions;
    
    31
    +
    
    32
    +import java.sql.Connection;
    
    33
    +import java.sql.PreparedStatement;
    
    34
    +import java.sql.ResultSet;
    
    35
    +import java.sql.SQLException;
    
    36
    +import java.util.Set;
    
    37
    +
    
    38
    +/**
    
    39
    + * @author Tony Chemit - dev@tchemit.fr
    
    40
    + * @since 7.5.1
    
    41
    + */
    
    42
    +@AutoService(MigrationVersionResource.class)
    
    43
    +public class DataSourceMigrationForVersion_7_5_1 extends MigrationVersionResource {
    
    44
    +
    
    45
    +    public DataSourceMigrationForVersion_7_5_1() {
    
    46
    +        super(Versions.valueOf("7.5.1"));
    
    47
    +    }
    
    48
    +
    
    49
    +    @Override
    
    50
    +    public void generateSqlScript(MigrationVersionResourceExecutor executor) {
    
    51
    +        Set<Pair<String, String>> tripIdAndComment = executor.findMultipleResultAstSet(new TopiaSqlQuery<Pair<String, String>>() {
    
    52
    +            @SuppressWarnings("SqlDialectInspection")
    
    53
    +            @Override
    
    54
    +            public PreparedStatement prepareQuery(Connection connection) throws SQLException {
    
    55
    +                return connection.prepareStatement("SELECT topiaId, comment FROM observe_seine.trip WHERE comment LIKE '#%#%'");
    
    56
    +            }
    
    57
    +
    
    58
    +            @Override
    
    59
    +            public Pair<String, String> prepareResult(ResultSet set) throws SQLException {
    
    60
    +                return Pair.of(set.getString(1), set.getString(2));
    
    61
    +            }
    
    62
    +        });
    
    63
    +
    
    64
    +        executor.writeSql("ALTER TABLE observe_seine.trip ADD COLUMN homeId VARCHAR(255)");
    
    65
    +
    
    66
    +        for (Pair<String, String> pair : tripIdAndComment) {
    
    67
    +            String tripId = pair.getKey();
    
    68
    +            String comment = pair.getValue().trim();
    
    69
    +
    
    70
    +            int endIndex = comment.indexOf('#', 1);
    
    71
    +            String homeId = comment.substring(1, endIndex - 1);
    
    72
    +            String newComment = endIndex + 1 == comment.length() ? "NULL" : (String.format("'%s'", comment.substring(endIndex + 1).trim().replaceAll("'","''")));
    
    73
    +            executor.writeSql(String.format("UPDATE observe_seine.trip t SET comment = %s, homeId = '%s', topiaVersion = topiaVersion + 1, lastUpdateDate = CURRENT_TIMESTAMP WHERE t.topiaId = '%s';", newComment, homeId, tripId));
    
    74
    +        }
    
    75
    +    }
    
    76
    +
    
    77
    +}
    
    78
    +

  • persistence/src/main/models/Observe.model
    ... ... @@ -851,6 +851,7 @@ vessel {*:1} referentiel.Vessel
    851 851
     seine.TripSeine > CommentableEntity >> Trip | entity dbName=Trip
    
    852 852
     startDate + {*:1} Date | hibernateAttributeType.java.util.Date=date
    
    853 853
     endDate + {*:1} Date | hibernateAttributeType.java.util.Date=date
    
    854
    +homeId + {*:1} String
    
    854 855
     checkLevel + {*:1} int
    
    855 856
     formsUrl + {*:1} String
    
    856 857
     reportsUrl + {*:1} String
    

  • pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>io.ultreia.maven</groupId>
    
    28 28
         <artifactId>pom</artifactId>
    
    29
    -    <version>2020.14</version>
    
    29
    +    <version>2020.15</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <groupId>fr.ird.observe</groupId>
    
    ... ... @@ -149,7 +149,7 @@
    149 149
         <devMode>true</devMode>
    
    150 150
     
    
    151 151
         <!--persistence model version-->
    
    152
    -    <observe.model.version>7.5</observe.model.version>
    
    152
    +    <observe.model.version>7.5.1</observe.model.version>
    
    153 153
     
    
    154 154
         <!-- build timestamp configuration -->
    
    155 155
         <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
    

  • test/src/main/resources/db/7.5.1/dataForTestLongline.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.5.1/dataForTestSeine.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.5.1/empty_h2.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.5.1/empty_pg.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.5.1/referentiel.sql.gz
    No preview for this file type