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

Commits:

8 changed files:

Changes:

  • application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/StorageUIModel.java
    ... ... @@ -1701,7 +1701,7 @@ public class StorageUIModel extends WizardModel<StorageStep> {
    1701 1701
     
    
    1702 1702
                             if (!error) {
    
    1703 1703
     
    
    1704
    -                            Version modelServerVersion = pingService.ping();
    
    1704
    +                            Version modelServerVersion = pingService.getModelVersion();
    
    1705 1705
     
    
    1706 1706
                                 Version clientModelVersion = getModelVersion();
    
    1707 1707
                                 if (!Objects.equals(clientModelVersion, modelServerVersion)) {
    

  • application-swing/src/main/java/fr/ird/observe/application/swing/ui/storage/presets/RemotePresetsUIHandler.java
    ... ... @@ -205,7 +205,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> {
    205 205
     
    
    206 206
                 PingService pingService = dataSource.newPingService();
    
    207 207
     
    
    208
    -            Version modelServerVersion = pingService.ping();
    
    208
    +            Version modelServerVersion = pingService.getModelVersion();
    
    209 209
     
    
    210 210
                 if (!modelVersion.equals(modelServerVersion)) {
    
    211 211
     
    

  • application-web/src/main/filtered-resources/mapping
    ... ... @@ -76,8 +76,8 @@ GET /api/v1/DataSourceService/migrateData
    76 76
     GET /api/v1/DataSourceService/open                                                                                                 v1.DataSourceServiceController.open
    
    77 77
     GET /api/v1/LastUpdateDateService/updateDataLastUpdateDates                                                                        v1.LastUpdateDateServiceController.updateDataLastUpdateDates
    
    78 78
     GET /api/v1/LastUpdateDateService/updateReferentialLastUpdateDates                                                                 v1.LastUpdateDateServiceController.updateReferentialLastUpdateDates
    
    79
    +GET /api/v1/PingService/getModelVersion                                                                                            v1.PingServiceController.getModelVersion
    
    79 80
     GET /api/v1/PingService/getServerVersion                                                                                           v1.PingServiceController.getServerVersion
    
    80
    -GET /api/v1/PingService/ping                                                                                                       v1.PingServiceController.ping
    
    81 81
     GET /api/v1/actions/synchro/referential/diff/ReferentialSynchronizeDiffService/getEnabledReferentialReferenceSet                   v1.actions.synchro.referential.diff.ReferentialSynchronizeDiffServiceController.getEnabledReferentialReferenceSet
    
    82 82
     GET /api/v1/actions/synchro/referential/diff/ReferentialSynchronizeDiffService/getSourceReferentialStates                          v1.actions.synchro.referential.diff.ReferentialSynchronizeDiffServiceController.getSourceReferentialStates
    
    83 83
     GET /api/v1/actions/synchro/referential/legacy/UnidirectionalReferentialSynchronizeLocalService/filterIdsUsedInLocalSource         v1.actions.synchro.referential.legacy.UnidirectionalReferentialSynchronizeLocalServiceController.filterIdsUsedInLocalSource
    

  • application-web/src/main/java/fr/ird/observe/application/web/controller/v1/PingServiceController.java
    ... ... @@ -35,7 +35,7 @@ import org.nuiton.version.Versions;
    35 35
     public class PingServiceController extends ObserveWebMotionController implements PingService {
    
    36 36
     
    
    37 37
         @Override
    
    38
    -    public Version ping() {
    
    38
    +    public Version getModelVersion() {
    
    39 39
             return getApplicationConfiguration().getModelVersion();
    
    40 40
         }
    
    41 41
     
    

  • services-rest/src/test/java/fr/ird/observe/services/rest/RestTestMethodResource.java
    ... ... @@ -81,7 +81,7 @@ public class RestTestMethodResource extends TestMethodResourceSupport<RestTestCl
    81 81
             PingService service = testClassResource.newService(dataSourceConfiguration, PingService.class);
    
    82 82
     
    
    83 83
             try {
    
    84
    -            Version serverVersion = service.ping();
    
    84
    +            Version serverVersion = service.getModelVersion();
    
    85 85
                 Version modelVersion = ObserveTestConfiguration.getModelVersion();
    
    86 86
                 if (!serverVersion.equals(modelVersion)) {
    
    87 87
                     serverExist = false;
    

  • services-rest/src/test/java/fr/ird/observe/services/rest/service/PingServiceRestTest.java
    ... ... @@ -45,7 +45,7 @@ public class PingServiceRestTest extends AbstractServiceRestTest {
    45 45
             dataSourceConfiguration.setServerUrl(new URL("http://fake_" + System.nanoTime()));
    
    46 46
             PingService service = REST_TEST_CLASS_RESOURCE.newService(dataSourceConfiguration, PingService.class);
    
    47 47
     
    
    48
    -        service.ping();
    
    48
    +        service.getModelVersion();
    
    49 49
     
    
    50 50
         }
    
    51 51
     
    
    ... ... @@ -57,7 +57,7 @@ public class PingServiceRestTest extends AbstractServiceRestTest {
    57 57
             dataSourceConfiguration.setLogin("fake_" + System.nanoTime());
    
    58 58
             PingService service = REST_TEST_CLASS_RESOURCE.newService(dataSourceConfiguration, PingService.class);
    
    59 59
     
    
    60
    -        service.ping();
    
    60
    +        service.getModelVersion();
    
    61 61
     
    
    62 62
         }
    
    63 63
     
    

  • services-topia/src/main/java/fr/ird/observe/services/topia/service/LastUpdateDateServiceTopia.java
    ... ... @@ -22,23 +22,22 @@ package fr.ird.observe.services.topia.service;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import com.google.common.base.Optional;
    
    26
    -import fr.ird.observe.persistence.ObserveEntityEnum;
    
    27 25
     import fr.ird.observe.entities.LastUpdateDate;
    
    28 26
     import fr.ird.observe.entities.ObserveDataEntity;
    
    29 27
     import fr.ird.observe.entities.ObserveEntity;
    
    30 28
     import fr.ird.observe.entities.referentiel.ObserveReferentialEntity;
    
    29
    +import fr.ird.observe.persistence.ObserveEntityEnum;
    
    31 30
     import fr.ird.observe.services.service.LastUpdateDateService;
    
    32 31
     import fr.ird.observe.services.topia.ObserveServiceTopia;
    
    33
    -import org.apache.commons.logging.Log;
    
    34
    -import org.apache.commons.logging.LogFactory;
    
    35
    -import org.nuiton.topia.persistence.support.TopiaSqlQuery;
    
    36
    -
    
    37 32
     import java.sql.Connection;
    
    38 33
     import java.sql.PreparedStatement;
    
    39 34
     import java.sql.ResultSet;
    
    40 35
     import java.sql.SQLException;
    
    41 36
     import java.sql.Timestamp;
    
    37
    +import java.util.Optional;
    
    38
    +import org.apache.commons.logging.Log;
    
    39
    +import org.apache.commons.logging.LogFactory;
    
    40
    +import org.nuiton.topia.persistence.support.TopiaSqlQuery;
    
    42 41
     
    
    43 42
     /**
    
    44 43
      * Created on 07/09/16.
    
    ... ... @@ -69,10 +68,10 @@ public class LastUpdateDateServiceTopia extends ObserveServiceTopia implements L
    69 68
     
    
    70 69
         private <E extends ObserveEntity> void updateLastUpdateDate(Class<E> entityType) {
    
    71 70
     
    
    72
    -        Optional<LastUpdateDate> optionalLastUpdateDate = getTopiaPersistenceContext().getLastUpdateDateDao()
    
    71
    +        Optional<LastUpdateDate> optionalLastUpdateDate = Optional.ofNullable(getTopiaPersistenceContext().getLastUpdateDateDao()
    
    73 72
                                                                                           .forTypeEquals(entityType.getName())
    
    74 73
                                                                                           .setOrderByArguments(LastUpdateDate.PROPERTY_LAST_UPDATE_DATE + " DESC")
    
    75
    -                                                                                      .tryFindFirst();
    
    74
    +                                                                                      .tryFindFirst().orNull());
    
    76 75
     
    
    77 76
             if (!optionalLastUpdateDate.isPresent()) {
    
    78 77
                 return;
    
    ... ... @@ -90,7 +89,7 @@ public class LastUpdateDateServiceTopia extends ObserveServiceTopia implements L
    90 89
                 @Override
    
    91 90
                 public PreparedStatement prepareQuery(Connection connection) throws SQLException {
    
    92 91
     
    
    93
    -                return connection.prepareStatement("SELECT max(lastUpdateDate)::TIMESTAMP FROM " + schemaName + "." + tableName);
    
    92
    +                return connection.prepareStatement(String.format("SELECT max(lastUpdateDate)::TIMESTAMP FROM %s.%s", schemaName, tableName));
    
    94 93
                 }
    
    95 94
     
    
    96 95
                 @Override
    
    ... ... @@ -102,7 +101,7 @@ public class LastUpdateDateServiceTopia extends ObserveServiceTopia implements L
    102 101
             if (maxLastUpdateDate != null && lastUpdateDate.getLastUpdateDate().before(maxLastUpdateDate)) {
    
    103 102
     
    
    104 103
                 if (log.isInfoEnabled()) {
    
    105
    -                log.info("Update LastUpdateDate for " + entityType.getName() + " with value: " + maxLastUpdateDate);
    
    104
    +                log.info(String.format("Update LastUpdateDate for %s with value: %s", entityType.getName(), maxLastUpdateDate));
    
    106 105
                 }
    
    107 106
                 lastUpdateDate.setLastUpdateDate(maxLastUpdateDate);
    
    108 107
             }
    

  • services/src/main/java/fr/ird/observe/services/service/PingService.java
    ... ... @@ -34,7 +34,7 @@ import org.nuiton.version.Version;
    34 34
     public interface PingService extends ObserveService {
    
    35 35
     
    
    36 36
         @NoDataAccess
    
    37
    -    Version ping();
    
    37
    +    Version getModelVersion();
    
    38 38
     
    
    39 39
         @NoDataAccess
    
    40 40
         Version getServerVersion();