Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
47db1aa2
by Tony Chemit at 2023-03-17T14:56:38+01:00
-
5316452b
by Tony Chemit at 2023-03-17T14:56:38+01:00
8 changed files:
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/export/actions/Start.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/save/actions/Start.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/data/actions/Apply.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/synchronize/referential/legacy/actions/SynchroUIActionSupport.java
- client/runner/src/main/i18n/translations/client-runner_en_GB.properties
- client/runner/src/main/i18n/translations/client-runner_es_ES.properties
- client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
- core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/observation/RouteTopiaDao.java
Changes:
| ... | ... | @@ -29,6 +29,8 @@ import fr.ird.observe.client.datasource.api.ObserveSwingDataSource; |
| 29 | 29 | import fr.ird.observe.client.datasource.api.data.CopyDataTask;
|
| 30 | 30 | import fr.ird.observe.client.datasource.api.data.DataManager;
|
| 31 | 31 | import fr.ird.observe.dto.ProgressionModel;
|
| 32 | +import io.ultreia.java4all.lang.Strings;
|
|
| 33 | +import io.ultreia.java4all.util.TimeLog;
|
|
| 32 | 34 | import org.apache.logging.log4j.LogManager;
|
| 33 | 35 | import org.apache.logging.log4j.Logger;
|
| 34 | 36 | import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
|
| ... | ... | @@ -75,7 +77,7 @@ public class Start extends ExportUIActionSupport { |
| 75 | 77 | ProgressionModel progressModel = stepModel.getProgressModel();
|
| 76 | 78 | progressModel.setMaximum(stepCount);
|
| 77 | 79 | progressModel.setValue(0);
|
| 78 | - |
|
| 80 | + long t00 = TimeLog.getTime();
|
|
| 79 | 81 | try (ObserveSwingDataSource localDataSource = openSource(stepModel.getSource())) {
|
| 80 | 82 | progressModel.increments();
|
| 81 | 83 | try (ObserveSwingDataSource centralDataSource = openSource(stepModel.getCentralSource())) {
|
| ... | ... | @@ -84,7 +86,7 @@ public class Start extends ExportUIActionSupport { |
| 84 | 86 | dataManager.consume(tasks);
|
| 85 | 87 | }
|
| 86 | 88 | }
|
| 87 | - sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date()));
|
|
| 89 | + sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date(), Strings.convertTime(TimeLog.getTime() - t00)));
|
|
| 88 | 90 | log.warn(String.format("Expected count: %d - final step count: %d", stepCount, progressModel.getValue()));
|
| 89 | 91 | return WizardState.SUCCESSED;
|
| 90 | 92 | }
|
| ... | ... | @@ -30,6 +30,8 @@ import fr.ird.observe.client.datasource.api.ObserveSwingDataSource; |
| 30 | 30 | import fr.ird.observe.datasource.request.CreateDatabaseRequest;
|
| 31 | 31 | import fr.ird.observe.services.service.DataSourceService;
|
| 32 | 32 | import fr.ird.observe.services.service.referential.UnidirectionalSynchronizeContext;
|
| 33 | +import io.ultreia.java4all.lang.Strings;
|
|
| 34 | +import io.ultreia.java4all.util.TimeLog;
|
|
| 33 | 35 | import io.ultreia.java4all.util.sql.SqlScript;
|
| 34 | 36 | import org.apache.logging.log4j.LogManager;
|
| 35 | 37 | import org.apache.logging.log4j.Logger;
|
| ... | ... | @@ -78,7 +80,7 @@ public class Start extends SaveLocalUIActionSupport { |
| 78 | 80 | }
|
| 79 | 81 | |
| 80 | 82 | openSource(source);
|
| 81 | - |
|
| 83 | + long t00 = TimeLog.getTime();
|
|
| 82 | 84 | if (stepModel.isDoBackup() && source.isLocal()) {
|
| 83 | 85 | |
| 84 | 86 | sendMessage("Sauvegarde de la base locale vers " + stepModel.getBackupFile());
|
| ... | ... | @@ -95,7 +97,7 @@ public class Start extends SaveLocalUIActionSupport { |
| 95 | 97 | saveUnidirectionalSynchronizeReferential();
|
| 96 | 98 | }
|
| 97 | 99 | |
| 98 | - sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date()));
|
|
| 100 | + sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date(), Strings.convertTime(TimeLog.getTime() - t00)));
|
|
| 99 | 101 | |
| 100 | 102 | return WizardState.SUCCESSED;
|
| 101 | 103 | }
|
| ... | ... | @@ -33,6 +33,8 @@ import fr.ird.observe.client.datasource.api.data.TaskSide; |
| 33 | 33 | import fr.ird.observe.client.datasource.api.data.UserCancelException;
|
| 34 | 34 | import fr.ird.observe.dto.ProgressionModel;
|
| 35 | 35 | import fr.ird.observe.dto.data.RootOpenableDto;
|
| 36 | +import io.ultreia.java4all.lang.Strings;
|
|
| 37 | +import io.ultreia.java4all.util.TimeLog;
|
|
| 36 | 38 | import org.apache.logging.log4j.LogManager;
|
| 37 | 39 | import org.apache.logging.log4j.Logger;
|
| 38 | 40 | import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
|
| ... | ... | @@ -104,11 +106,11 @@ public class Apply extends DataSynchroUIActionSupport { |
| 104 | 106 | ProgressionModel progressModel = stepModel.getProgressModel();
|
| 105 | 107 | progressModel.setMaximum(stepCount);
|
| 106 | 108 | DataManager dataManager = new DataManager(progressModel, leftSource, rightSource);
|
| 107 | - |
|
| 109 | + long t00 = TimeLog.getTime();
|
|
| 108 | 110 | progressModel.increments();
|
| 109 | 111 | try {
|
| 110 | 112 | dataManager.consume(finalTasksToConsume);
|
| 111 | - sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date()));
|
|
| 113 | + sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date(), Strings.convertTime(TimeLog.getTime() - t00)));
|
|
| 112 | 114 | return WizardState.SUCCESSED;
|
| 113 | 115 | } catch (Exception e) {
|
| 114 | 116 | progressModel.increments();
|
| ... | ... | @@ -32,6 +32,8 @@ import fr.ird.observe.services.service.referential.UnidirectionalSynchronizeCont |
| 32 | 32 | import fr.ird.observe.services.service.referential.UnidirectionalSynchronizeEngine;
|
| 33 | 33 | import fr.ird.observe.services.service.referential.synchro.UnidirectionalCallbackResults;
|
| 34 | 34 | import fr.ird.observe.services.service.referential.synchro.UnidirectionalResult;
|
| 35 | +import io.ultreia.java4all.lang.Strings;
|
|
| 36 | +import io.ultreia.java4all.util.TimeLog;
|
|
| 35 | 37 | import org.apache.commons.lang3.tuple.Pair;
|
| 36 | 38 | |
| 37 | 39 | import java.util.Collection;
|
| ... | ... | @@ -56,7 +58,7 @@ public abstract class SynchroUIActionSupport extends AdminTabUIActionSupport<Syn |
| 56 | 58 | |
| 57 | 59 | UnidirectionalResult referentialSynchronizeResult = engine.prepareResult(referentialSynchronizeContext, referentialSynchronizeCallbackResults);
|
| 58 | 60 | stepModel.setReferentialSynchronizeResult(referentialSynchronizeResult);
|
| 59 | - |
|
| 61 | + long t00 = TimeLog.getTime();
|
|
| 60 | 62 | if (referentialSynchronizeResult.isEmpty()) {
|
| 61 | 63 | //Update lastUpdateDate anyway (See https://gitlab.com/ultreiaio/ird-observe/-/issues/2231)
|
| 62 | 64 | sendMessage(t("observe.ui.datasource.editor.actions.synchro.referential.message.ref.is.updtodate"));
|
| ... | ... | @@ -104,6 +106,6 @@ public abstract class SynchroUIActionSupport extends AdminTabUIActionSupport<Syn |
| 104 | 106 | |
| 105 | 107 | ui.getModel().getSaveLocalModel().addStepForSave(AdminStep.SYNCHRONIZE);
|
| 106 | 108 | }
|
| 107 | - sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date()));
|
|
| 109 | + sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date(), Strings.convertTime(TimeLog.getTime() - t00)));
|
|
| 108 | 110 | }
|
| 109 | 111 | } |
| ... | ... | @@ -499,7 +499,7 @@ observe.ui.datasource.editor.actions.consolidate.message.modifications.warning=% |
| 499 | 499 | observe.ui.datasource.editor.actions.consolidate.message.noChanges=No data modified.
|
| 500 | 500 | observe.ui.datasource.editor.actions.consolidate.message.observation.activity.modification=Some data were computed for Observations activity [%s] %s
|
| 501 | 501 | observe.ui.datasource.editor.actions.consolidate.message.observation.activity.warning=Some warnings were found for Observations activity [%s] %s
|
| 502 | -observe.ui.datasource.editor.actions.consolidate.message.operation.done=Consolidate operation done in %s (duration\: %s).
|
|
| 502 | +observe.ui.datasource.editor.actions.consolidate.message.operation.done=Consolidate operation done at %s (duration\: %s).
|
|
| 503 | 503 | observe.ui.datasource.editor.actions.consolidate.message.save.changes=Save modified %1$s trip(s).
|
| 504 | 504 | observe.ui.datasource.editor.actions.consolidate.message.trip.modification=Some data were computed for trip [%s] %s
|
| 505 | 505 | observe.ui.datasource.editor.actions.consolidate.message.trip.warning=Some warnings were found for trip [%s] %s
|
| ... | ... | @@ -541,7 +541,7 @@ observe.ui.datasource.editor.actions.exportData.title=Export data |
| 541 | 541 | observe.ui.datasource.editor.actions.exportData.title.tip=Export data
|
| 542 | 542 | observe.ui.datasource.editor.actions.operation.configuration=Configuration of operations
|
| 543 | 543 | observe.ui.datasource.editor.actions.operation.message.canceled=Operation <%1$s> canceled.
|
| 544 | -observe.ui.datasource.editor.actions.operation.message.done=Operation done at %1$td/%1$tm/%1$tY à %1$tH\:%1$tM\:%1$tS
|
|
| 544 | +observe.ui.datasource.editor.actions.operation.message.done=Operation done at %1$td/%1$tm/%1$tY à %1$tH\:%1$tM\:%1$tS (duration\: %s).
|
|
| 545 | 545 | observe.ui.datasource.editor.actions.operation.message.failed=Operation has failed.
|
| 546 | 546 | observe.ui.datasource.editor.actions.operation.message.needFix=Operation need fix.
|
| 547 | 547 | observe.ui.datasource.editor.actions.operation.message.running=Operation <%1$s> is running...
|
| ... | ... | @@ -541,7 +541,7 @@ observe.ui.datasource.editor.actions.exportData.title=Exportar los datos |
| 541 | 541 | observe.ui.datasource.editor.actions.exportData.title.tip=Exportar los datos de usuario
|
| 542 | 542 | observe.ui.datasource.editor.actions.operation.configuration=Configuración de las operaciones
|
| 543 | 543 | observe.ui.datasource.editor.actions.operation.message.canceled=La operación <%1$s> fue cancelada.
|
| 544 | -observe.ui.datasource.editor.actions.operation.message.done=Operación terminada el %1$td/%1$tm/%1$tY a %1$tH\:%1$tM\:%1$tS
|
|
| 544 | +observe.ui.datasource.editor.actions.operation.message.done=Operación terminada el %1$td/%1$tm/%1$tY a %1$tH\:%1$tM\:%1$tS (duration\: %s).
|
|
| 545 | 545 | observe.ui.datasource.editor.actions.operation.message.failed=La operación falló
|
| 546 | 546 | observe.ui.datasource.editor.actions.operation.message.needFix=La operación necesita correcciones.
|
| 547 | 547 | observe.ui.datasource.editor.actions.operation.message.running=La operación < %1$s > se está ejecutando...
|
| ... | ... | @@ -541,7 +541,7 @@ observe.ui.datasource.editor.actions.exportData.title=Exporter les données |
| 541 | 541 | observe.ui.datasource.editor.actions.exportData.title.tip=Exporter les données utilisateurs vers une base centrale
|
| 542 | 542 | observe.ui.datasource.editor.actions.operation.configuration=Configuration des opérations
|
| 543 | 543 | observe.ui.datasource.editor.actions.operation.message.canceled=L'opération <%1$s> a été annulée.
|
| 544 | -observe.ui.datasource.editor.actions.operation.message.done=Opération terminée le %1$td/%1$tm/%1$tY à %1$tH\:%1$tM\:%1$tS
|
|
| 544 | +observe.ui.datasource.editor.actions.operation.message.done=Opération terminée le %1$td/%1$tm/%1$tY à %1$tH\:%1$tM\:%1$tS (temps écoulé \: %s).
|
|
| 545 | 545 | observe.ui.datasource.editor.actions.operation.message.failed=L'opération a échouée
|
| 546 | 546 | observe.ui.datasource.editor.actions.operation.message.needFix=L'opération requière des corrections.
|
| 547 | 547 | observe.ui.datasource.editor.actions.operation.message.running=L'opération < %1$s > est en cours d'exécution...
|
| ... | ... | @@ -27,10 +27,23 @@ import java.util.Objects; |
| 27 | 27 | |
| 28 | 28 | public class RouteTopiaDao extends AbstractRouteTopiaDao<Route> {
|
| 29 | 29 | |
| 30 | + private static final String UPDATE_SET_DATE_IN_TIMESTAMP = "UPDATE ps_observation.set" +
|
|
| 31 | + " SET %1$s = (? || ' ' || %1$s::TIME)::TIMESTAMP" +
|
|
| 32 | + " WHERE topiaId IN " +
|
|
| 33 | + " (" +
|
|
| 34 | + " SELECT s.topiaId" +
|
|
| 35 | + " FROM ps_observation.activity a LEFT OUTER JOIN ps_observation.set s ON s.activity = a.topiaId" +
|
|
| 36 | + " WHERE a.ROUTE = ? AND s.%1$s IS NOT NULL" +
|
|
| 37 | + " );";
|
|
| 38 | + |
|
| 30 | 39 | /**
|
| 31 | - * FIXME PErsistence this request does not works any longer
|
|
| 32 | - * To update date part of {@link Set#getHaulingEndTimeStamp()}} and {@link Set#getEndTimeStamp()}} with
|
|
| 33 | - * the day date of the route.
|
|
| 40 | + * To update date part of
|
|
| 41 | + * <ul>
|
|
| 42 | + * <li>{@link Set#getHaulingEndTimeStamp()}}</li>
|
|
| 43 | + * <li>{@link Set#getHaulingEndTimeStamp()}</li>
|
|
| 44 | + * <li>{@link Set#getEndTimeStamp()}}</li>
|
|
| 45 | + * </ul>
|
|
| 46 | + * with the day date of the route.
|
|
| 34 | 47 | *
|
| 35 | 48 | * @param routeId id of the route to use
|
| 36 | 49 | * @param date day date to use
|
| ... | ... | @@ -41,23 +54,21 @@ public class RouteTopiaDao extends AbstractRouteTopiaDao<Route> { |
| 41 | 54 | Objects.requireNonNull(routeId, "routeId can't be null");
|
| 42 | 55 | |
| 43 | 56 | topiaSqlSupport.doSqlWork(connection -> {
|
| 44 | - |
|
| 45 | - String sql = "UPDATE ps_observation.set" +
|
|
| 46 | - " SET ENDPURSINGTIMESTAMP = (? || ' ' || ENDPURSINGTIMESTAMP::TIME)::TIMESTAMP," +
|
|
| 47 | - " ENDSETTIMESTAMP = (? || ' ' || ENDSETTIMESTAMP::TIME)::TIMESTAMP" +
|
|
| 48 | - " WHERE TOPIAID IN " +
|
|
| 49 | - " (" +
|
|
| 50 | - " SELECT s.TOPIAID" +
|
|
| 51 | - " FROM ps_observation.activity a, ps_observation.set s" +
|
|
| 52 | - " WHERE a.ROUTE = ? AND a.SET = s.TOPIAID" +
|
|
| 53 | - " );";
|
|
| 54 | - |
|
| 55 | - PreparedStatement ps = connection.prepareStatement(sql);
|
|
| 56 | - ps.setDate(1, date);
|
|
| 57 | - ps.setDate(2, date);
|
|
| 58 | - ps.setString(3, routeId);
|
|
| 59 | - ps.executeUpdate();
|
|
| 60 | - |
|
| 57 | + try (PreparedStatement ps = connection.prepareStatement(String.format(UPDATE_SET_DATE_IN_TIMESTAMP, Set.PROPERTY_END_TIME_STAMP))) {
|
|
| 58 | + ps.setDate(1, date);
|
|
| 59 | + ps.setString(2, routeId);
|
|
| 60 | + ps.executeUpdate();
|
|
| 61 | + }
|
|
| 62 | + try (PreparedStatement ps = connection.prepareStatement(String.format(UPDATE_SET_DATE_IN_TIMESTAMP, Set.PROPERTY_HAULING_START_TIME_STAMP))) {
|
|
| 63 | + ps.setDate(1, date);
|
|
| 64 | + ps.setString(2, routeId);
|
|
| 65 | + ps.executeUpdate();
|
|
| 66 | + }
|
|
| 67 | + try (PreparedStatement ps = connection.prepareStatement(String.format(UPDATE_SET_DATE_IN_TIMESTAMP, Set.PROPERTY_HAULING_END_TIME_STAMP))) {
|
|
| 68 | + ps.setDate(1, date);
|
|
| 69 | + ps.setString(2, routeId);
|
|
| 70 | + ps.executeUpdate();
|
|
| 71 | + }
|
|
| 61 | 72 | });
|
| 62 | 73 | |
| 63 | 74 | }
|