Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
e06ff9e9
by Tony Chemit at 2024-03-19T11:22:17+01:00
-
11ea9d2d
by Tony Chemit at 2024-03-19T14:20:44+01:00
-
f0d95762
by Tony Chemit at 2024-03-19T14:20:44+01:00
-
ed8c4a22
by Tony Chemit at 2024-03-19T14:20:44+01:00
-
b3cab5a2
by Tony Chemit at 2024-03-19T14:20:44+01:00
-
4b1fe74f
by Tony Chemit at 2024-03-19T14:20:44+01:00
14 changed files:
- client/core/src/main/java/fr/ird/observe/client/datasource/api/data/CopyDataTask.java
- client/core/src/main/java/fr/ird/observe/client/datasource/api/data/DataManager.java
- client/core/src/main/java/fr/ird/observe/client/datasource/api/data/DataTaskSupport.java
- client/core/src/main/java/fr/ird/observe/client/datasource/api/data/DeleteDataTask.java
- client/core/src/main/java/fr/ird/observe/client/datasource/api/data/InsertMissingReferentialTask.java
- client/core/src/main/java/fr/ird/observe/client/datasource/api/data/TaskSide.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/validate/actions/Start.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/services/client/src/main/java/fr/ird/observe/services/client/ObserveServiceFactoryClient.java
- pom.xml
- toolkit/persistence/src/main/java/fr/ird/observe/spi/referential/ReferentialIdsBuilder.java
Changes:
| ... | ... | @@ -22,22 +22,13 @@ package fr.ird.observe.client.datasource.api.data; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | -import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
|
| 26 | -import fr.ird.observe.dto.ProgressionModel;
|
|
| 27 | 25 | import fr.ird.observe.dto.ToolkitIdLabel;
|
| 28 | 26 | import fr.ird.observe.navigation.tree.selection.SelectionTreeModel;
|
| 29 | 27 | import fr.ird.observe.navigation.tree.selection.SelectionTreeNodeBean;
|
| 30 | -import fr.ird.observe.services.service.data.ExportDataRequest;
|
|
| 31 | -import fr.ird.observe.services.service.data.ExportDataResult;
|
|
| 32 | -import fr.ird.observe.services.service.data.ImportDataRequest;
|
|
| 33 | -import fr.ird.observe.services.service.data.ImportDataResult;
|
|
| 34 | -import org.apache.logging.log4j.LogManager;
|
|
| 35 | -import org.apache.logging.log4j.Logger;
|
|
| 36 | 28 | |
| 37 | 29 | import java.util.function.BiFunction;
|
| 38 | 30 | import java.util.stream.Stream;
|
| 39 | 31 | |
| 40 | -import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 41 | 32 | import static io.ultreia.java4all.i18n.I18n.t;
|
| 42 | 33 | |
| 43 | 34 | /**
|
| ... | ... | @@ -48,7 +39,6 @@ import static io.ultreia.java4all.i18n.I18n.t; |
| 48 | 39 | */
|
| 49 | 40 | public class CopyDataTask extends DataTaskSupport {
|
| 50 | 41 | |
| 51 | - private static final Logger log = LogManager.getLogger(CopyDataTask.class);
|
|
| 52 | 42 | private final boolean dataExistOnOpposite;
|
| 53 | 43 | private final ToolkitIdLabel data;
|
| 54 | 44 | private final String prefix;
|
| ... | ... | @@ -65,30 +55,6 @@ public class CopyDataTask extends DataTaskSupport { |
| 65 | 55 | this.prefix = prefix;
|
| 66 | 56 | }
|
| 67 | 57 | |
| 68 | - public void consume(ProgressionModel progressModel, ObserveSwingDataSource incomingSource, ObserveSwingDataSource targetSource) {
|
|
| 69 | - String tripId = data.getTopiaId();
|
|
| 70 | - String incomingSourceLabel = incomingSource.getLabel();
|
|
| 71 | - String targetSourceLabel = targetSource.getLabel();
|
|
| 72 | - progressModel.setMessage(t("observe.ui.datasource.editor.actions.data.copy", targetSourceLabel, prefix, data));
|
|
| 73 | - ExportDataRequest exportDataRequest = new ExportDataRequest(!targetSource.isLocal(), tripId);
|
|
| 74 | - ExportDataResult exportDataResult = incomingSource.getDataManagementService().exportData(exportDataRequest);
|
|
| 75 | - logExportResult(progressModel, n("observe.ui.datasource.editor.actions.data.export.result"),
|
|
| 76 | - incomingSourceLabel,
|
|
| 77 | - exportDataResult);
|
|
| 78 | - |
|
| 79 | - ImportDataRequest importDataRequest = new ImportDataRequest(exportDataResult);
|
|
| 80 | - log.info("Use import script: " + importDataRequest.getSqlContent().getLocation());
|
|
| 81 | - ImportDataResult importDataResult = targetSource.getDataManagementService().importData(importDataRequest);
|
|
| 82 | - logImportResult(progressModel, n("observe.ui.datasource.editor.actions.data.import.result"),
|
|
| 83 | - n("observe.ui.datasource.editor.actions.data.delete.result"),
|
|
| 84 | - targetSourceLabel,
|
|
| 85 | - importDataResult);
|
|
| 86 | - |
|
| 87 | - if (targetSource.isLocal()) {
|
|
| 88 | - targetSource.setModified(true);
|
|
| 89 | - }
|
|
| 90 | - }
|
|
| 91 | - |
|
| 92 | 58 | public final ToolkitIdLabel getData() {
|
| 93 | 59 | return data;
|
| 94 | 60 | }
|
| ... | ... | @@ -111,31 +77,4 @@ public class CopyDataTask extends DataTaskSupport { |
| 111 | 77 | return dataExistOnOpposite;
|
| 112 | 78 | }
|
| 113 | 79 | |
| 114 | - void logExportResult(ProgressionModel progressModel,
|
|
| 115 | - String i18nKey,
|
|
| 116 | - String sourceLabel,
|
|
| 117 | - ExportDataResult tripResult) {
|
|
| 118 | - String message = sendLogResultMessage(progressModel, i18nKey, sourceLabel, prefix, data, tripResult.getTime());
|
|
| 119 | - log.info(message);
|
|
| 120 | - }
|
|
| 121 | - |
|
| 122 | - void logImportResult(ProgressionModel progressModel,
|
|
| 123 | - String importI18nKey,
|
|
| 124 | - String deleteI18nKey,
|
|
| 125 | - String sourceLabel,
|
|
| 126 | - ImportDataResult tripResult) {
|
|
| 127 | - if (tripResult.isDeleted()) {
|
|
| 128 | - String message = sendLogResultMessage(progressModel, deleteI18nKey, sourceLabel, prefix, data, tripResult.getDeleteTime());
|
|
| 129 | - log.info(message);
|
|
| 130 | - } else {
|
|
| 131 | - progressModel.increments();
|
|
| 132 | - }
|
|
| 133 | - if (tripResult.isImported()) {
|
|
| 134 | - String message = sendLogResultMessage(progressModel, importI18nKey, sourceLabel, prefix, data, tripResult.getImportTime());
|
|
| 135 | - log.info(message);
|
|
| 136 | - } else {
|
|
| 137 | - progressModel.increments();
|
|
| 138 | - }
|
|
| 139 | - }
|
|
| 140 | - |
|
| 141 | 80 | } |
| ... | ... | @@ -23,12 +23,38 @@ package fr.ird.observe.client.datasource.api.data; |
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | 25 | import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
| 26 | +import fr.ird.observe.client.datasource.usage.UsageForDisplayUIHandler;
|
|
| 27 | +import fr.ird.observe.dto.I18nDecoratorHelper;
|
|
| 26 | 28 | import fr.ird.observe.dto.ProgressionModel;
|
| 29 | +import fr.ird.observe.dto.ToolkitIdLabel;
|
|
| 30 | +import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 31 | +import fr.ird.observe.services.service.data.DataManagementService;
|
|
| 32 | +import fr.ird.observe.services.service.data.DeleteDataRequest;
|
|
| 33 | +import fr.ird.observe.services.service.data.DeleteDataResult;
|
|
| 34 | +import fr.ird.observe.services.service.data.ExportDataRequest;
|
|
| 35 | +import fr.ird.observe.services.service.data.ExportDataResult;
|
|
| 36 | +import fr.ird.observe.services.service.data.ImportDataRequest;
|
|
| 37 | +import fr.ird.observe.services.service.data.ImportDataResult;
|
|
| 38 | +import fr.ird.observe.services.service.data.MissingReferentialRequest;
|
|
| 39 | +import fr.ird.observe.services.service.data.MissingReferentialResult;
|
|
| 40 | +import fr.ird.observe.services.service.referential.ReferentialIds;
|
|
| 41 | +import fr.ird.observe.services.service.referential.ReferentialService;
|
|
| 27 | 42 | import io.ultreia.java4all.application.template.spi.GenerateTemplate;
|
| 28 | -import io.ultreia.java4all.lang.TwoSideContext;
|
|
| 43 | +import io.ultreia.java4all.lang.Strings;
|
|
| 44 | +import io.ultreia.java4all.util.SingletonSupplier;
|
|
| 45 | +import io.ultreia.java4all.util.TwoSideContext;
|
|
| 46 | +import org.apache.logging.log4j.LogManager;
|
|
| 47 | +import org.apache.logging.log4j.Logger;
|
|
| 29 | 48 | |
| 30 | 49 | import java.util.Collection;
|
| 50 | +import java.util.Map;
|
|
| 31 | 51 | import java.util.Objects;
|
| 52 | +import java.util.Set;
|
|
| 53 | +import java.util.function.Supplier;
|
|
| 54 | +import java.util.stream.Collectors;
|
|
| 55 | + |
|
| 56 | +import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 57 | +import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 32 | 58 | |
| 33 | 59 | /**
|
| 34 | 60 | * Hi-level object to perform business data management (says: delete some trip, copy some trip, insert missing referential, ...)
|
| ... | ... | @@ -40,10 +66,15 @@ import java.util.Objects; |
| 40 | 66 | */
|
| 41 | 67 | @GenerateTemplate(template = "showMissingReferential.ftl")
|
| 42 | 68 | public class DataManager {
|
| 69 | + private static final Logger log = LogManager.getLogger(DataManager.class);
|
|
| 43 | 70 | /**
|
| 44 | 71 | * Data sources by side.
|
| 45 | 72 | */
|
| 46 | 73 | private final TwoSideContext<TaskSide, ObserveSwingDataSource> dataSources;
|
| 74 | + /**
|
|
| 75 | + * {@link DataManagementService} supplier by side.
|
|
| 76 | + */
|
|
| 77 | + private final TwoSideContext<TaskSide, Supplier<DataManagementService>> dataManagementServices;
|
|
| 47 | 78 | /**
|
| 48 | 79 | * Progression model.
|
| 49 | 80 | */
|
| ... | ... | @@ -61,6 +92,7 @@ public class DataManager { |
| 61 | 92 | return rightSource;
|
| 62 | 93 | }
|
| 63 | 94 | };
|
| 95 | + this.dataManagementServices = dataSources.then(s -> SingletonSupplier.of(s::getDataManagementService));
|
|
| 64 | 96 | this.progressModel = Objects.requireNonNull(progressModel);
|
| 65 | 97 | }
|
| 66 | 98 | |
| ... | ... | @@ -90,18 +122,113 @@ public class DataManager { |
| 90 | 122 | return dataSources;
|
| 91 | 123 | }
|
| 92 | 124 | |
| 93 | - public void consume(CopyDataTask task) {
|
|
| 94 | - TaskSide taskSide = task.getTaskSide();
|
|
| 95 | - task.consume(progressModel, dataSources.onSameSide(taskSide), dataSources.onOppositeSide(taskSide));
|
|
| 125 | + void consume(CopyDataTask task) {
|
|
| 126 | + @SuppressWarnings("resource") ObserveSwingDataSource incomingSource = dataSources.onSameSide(task.getTaskSide());
|
|
| 127 | + @SuppressWarnings("resource") ObserveSwingDataSource targetSource = dataSources.onOppositeSide(task.getTaskSide());
|
|
| 128 | + DataManagementService incomingSourceDataManagementService = dataManagementServices.onSameSide(task.getTaskSide()).get();
|
|
| 129 | + DataManagementService targetSourceDataManagementService = dataManagementServices.onOppositeSide(task.getTaskSide()).get();
|
|
| 130 | + String tripId = task.getData().getTopiaId();
|
|
| 131 | + String incomingSourceLabel = incomingSource.getLabel();
|
|
| 132 | + String targetSourceLabel = targetSource.getLabel();
|
|
| 133 | + progressModel.setMessage(t("observe.ui.datasource.editor.actions.data.copy", targetSourceLabel, task.getPrefix(), task.getData()));
|
|
| 134 | + ExportDataRequest exportDataRequest = new ExportDataRequest(!targetSource.isLocal(), tripId);
|
|
| 135 | + ExportDataResult exportDataResult = incomingSourceDataManagementService.exportData(exportDataRequest);
|
|
| 136 | + |
|
| 137 | + String message = sendLogResultMessage(n("observe.ui.datasource.editor.actions.data.export.result"),
|
|
| 138 | + incomingSourceLabel, task.getPrefix(), task.getData(), exportDataResult.getTime());
|
|
| 139 | + log.info(message);
|
|
| 140 | + ImportDataRequest importDataRequest = new ImportDataRequest(exportDataResult);
|
|
| 141 | + log.info("Use import script: " + importDataRequest.getSqlContent().getLocation());
|
|
| 142 | + ImportDataResult importDataResult = targetSourceDataManagementService.importData(importDataRequest);
|
|
| 143 | + |
|
| 144 | + if (importDataResult.isDeleted()) {
|
|
| 145 | + message = sendLogResultMessage(n("observe.ui.datasource.editor.actions.data.delete.result"), targetSourceLabel, task.getPrefix(), task.getData(), importDataResult.getDeleteTime());
|
|
| 146 | + log.info(message);
|
|
| 147 | + } else {
|
|
| 148 | + progressModel.increments();
|
|
| 149 | + }
|
|
| 150 | + if (importDataResult.isImported()) {
|
|
| 151 | + message = sendLogResultMessage(n("observe.ui.datasource.editor.actions.data.import.result"), targetSourceLabel, task.getPrefix(), task.getData(), importDataResult.getImportTime());
|
|
| 152 | + log.info(message);
|
|
| 153 | + } else {
|
|
| 154 | + progressModel.increments();
|
|
| 155 | + }
|
|
| 156 | + if (targetSource.isLocal()) {
|
|
| 157 | + targetSource.setModified(true);
|
|
| 158 | + }
|
|
| 159 | + }
|
|
| 160 | + |
|
| 161 | + void consume(InsertMissingReferentialTask task) {
|
|
| 162 | + @SuppressWarnings("resource") ObserveSwingDataSource incomingSource = dataSources.onSameSide(task.getTaskSide());
|
|
| 163 | + @SuppressWarnings("resource") ObserveSwingDataSource targetSource = dataSources.onOppositeSide(task.getTaskSide());
|
|
| 164 | + progressModel.increments();
|
|
| 165 | + |
|
| 166 | + String targetSourceLabel = targetSource.getLabel();
|
|
| 167 | + |
|
| 168 | + ReferentialService targetReferentialService = targetSource.getReferentialService();
|
|
| 169 | + ReferentialIds targetSourceReferential = targetReferentialService.getReferentialIds();
|
|
| 170 | + MissingReferentialRequest missingReferentialRequest = MissingReferentialRequest.of(targetSourceReferential.getIds(), task.getIdsToCopy().toArray(new String[0]));
|
|
| 171 | + MissingReferentialResult missingReferentialResult = incomingSource.getRootOpenableService().computeMissingReferential(task.getDataType(), missingReferentialRequest);
|
|
| 172 | + progressModel.increments();
|
|
| 173 | + |
|
| 174 | + if (missingReferentialResult == null) {
|
|
| 175 | + progressModel.increments();
|
|
| 176 | + return;
|
|
| 177 | + }
|
|
| 178 | + |
|
| 179 | + // there is some referential to add to target source
|
|
| 180 | + |
|
| 181 | + Map<Class<? extends ReferentialDto>, Set<ToolkitIdLabel>> usages = incomingSource.getReferentialMap(missingReferentialResult.getMissingIds());
|
|
| 182 | + |
|
| 183 | + boolean response = UsageForDisplayUIHandler.showMissingReferential(this.getMessage(), usages, targetSourceLabel);
|
|
| 184 | + |
|
| 185 | + if (!response) {
|
|
| 186 | + progressModel.increments();
|
|
| 187 | + throw new UserCancelException();
|
|
| 188 | + }
|
|
| 189 | + |
|
| 190 | + StringBuilder parameters = new StringBuilder();
|
|
| 191 | + |
|
| 192 | + for (Class<? extends ReferentialDto> key : usages.keySet()) {
|
|
| 193 | + Set<ToolkitIdLabel> references = usages.get(key);
|
|
| 194 | + String type = t(I18nDecoratorHelper.getType(key));
|
|
| 195 | + String labels = references.stream().map(Object::toString).collect(Collectors.joining("\n\t * "));
|
|
| 196 | + parameters.append(t("observe.ui.datasource.editor.actions.data.import.add.missing.referential.for.type", targetSourceLabel, references.size(), type, labels));
|
|
| 197 | + parameters.append("\n");
|
|
| 198 | + }
|
|
| 199 | + |
|
| 200 | + progressModel.setMessage(t("observe.ui.datasource.editor.actions.data.import.add.missing.referential", targetSourceLabel, parameters.toString()));
|
|
| 201 | + |
|
| 202 | + targetReferentialService.insertMissingReferential(missingReferentialResult.getSqlCode());
|
|
| 96 | 203 | }
|
| 97 | 204 | |
| 98 | - public void consume(InsertMissingReferentialTask task) {
|
|
| 99 | - TaskSide taskSide = task.getTaskSide();
|
|
| 100 | - task.consume(progressModel, this::getMessage, dataSources.onSameSide(taskSide), dataSources.onOppositeSide(taskSide));
|
|
| 205 | + void consume(DeleteDataTask task) {
|
|
| 206 | + @SuppressWarnings("resource") ObserveSwingDataSource targetSource = dataSources.onSameSide(task.getTaskSide());
|
|
| 207 | + DataManagementService targetSourceDataManagementService = dataManagementServices.onSameSide(task.getTaskSide()).get();
|
|
| 208 | + String targetSourceLabel = targetSource.getLabel();
|
|
| 209 | + String dataId = task.getData().getTopiaId();
|
|
| 210 | + |
|
| 211 | + progressModel.setMessage(t("observe.ui.datasource.editor.actions.data.delete", targetSourceLabel, task.getPrefix(), task.getData()));
|
|
| 212 | + DeleteDataRequest deleteDataRequest = new DeleteDataRequest(dataId);
|
|
| 213 | + DeleteDataResult deleteDataResult = targetSourceDataManagementService.deleteData(deleteDataRequest);
|
|
| 214 | + |
|
| 215 | + String message = sendLogResultMessage(n("observe.ui.datasource.editor.actions.data.delete.result"),
|
|
| 216 | + targetSourceLabel, task.getPrefix(), task.getData(), deleteDataResult.getTime());
|
|
| 217 | + log.info(message);
|
|
| 218 | + |
|
| 219 | + if (targetSource.isLocal()) {
|
|
| 220 | + targetSource.setModified(true);
|
|
| 221 | + }
|
|
| 101 | 222 | }
|
| 102 | 223 | |
| 103 | - public void consume(DeleteDataTask task) {
|
|
| 104 | - TaskSide taskSide = task.getTaskSide();
|
|
| 105 | - task.consume(progressModel, dataSources.onSameSide(taskSide));
|
|
| 224 | + String sendLogResultMessage(String i18nKey,
|
|
| 225 | + String sourceLabel,
|
|
| 226 | + String prefix,
|
|
| 227 | + ToolkitIdLabel data,
|
|
| 228 | + long time) {
|
|
| 229 | + String timeStr = Strings.convertTime(time);
|
|
| 230 | + String message = Strings.leftPad(timeStr, 20) + " - " + t(i18nKey, sourceLabel, prefix, data);
|
|
| 231 | + progressModel.setMessage(message);
|
|
| 232 | + return message;
|
|
| 106 | 233 | }
|
| 107 | 234 | } |
| ... | ... | @@ -22,15 +22,9 @@ package fr.ird.observe.client.datasource.api.data; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | -import fr.ird.observe.dto.ProgressionModel;
|
|
| 26 | -import fr.ird.observe.dto.ToolkitIdLabel;
|
|
| 27 | -import io.ultreia.java4all.lang.Strings;
|
|
| 28 | - |
|
| 29 | 25 | import javax.swing.Icon;
|
| 30 | 26 | import java.util.Objects;
|
| 31 | 27 | |
| 32 | -import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 33 | - |
|
| 34 | 28 | /**
|
| 35 | 29 | * Created on 03/08/16.
|
| 36 | 30 | *
|
| ... | ... | @@ -62,16 +56,5 @@ public abstract class DataTaskSupport { |
| 62 | 56 | }
|
| 63 | 57 | |
| 64 | 58 | public abstract int stepCount();
|
| 65 | - String sendLogResultMessage(ProgressionModel progressModel,
|
|
| 66 | - String i18nKey,
|
|
| 67 | - String sourceLabel,
|
|
| 68 | - String prefix,
|
|
| 69 | - ToolkitIdLabel data,
|
|
| 70 | - long time) {
|
|
| 71 | - String timeStr = Strings.convertTime(time);
|
|
| 72 | - String message = Strings.leftPad(timeStr, 20) + " - " + t(i18nKey, sourceLabel, prefix, data);
|
|
| 73 | - progressModel.setMessage(message);
|
|
| 74 | - return message;
|
|
| 75 | - }
|
|
| 76 | 59 | |
| 77 | 60 | } |
| ... | ... | @@ -22,21 +22,14 @@ package fr.ird.observe.client.datasource.api.data; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | -import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
|
| 26 | -import fr.ird.observe.dto.ProgressionModel;
|
|
| 27 | 25 | import fr.ird.observe.dto.ToolkitIdLabel;
|
| 28 | 26 | import fr.ird.observe.navigation.tree.selection.SelectionTreeModel;
|
| 29 | 27 | import fr.ird.observe.navigation.tree.selection.SelectionTreeNodeBean;
|
| 30 | -import fr.ird.observe.services.service.data.DeleteDataRequest;
|
|
| 31 | -import fr.ird.observe.services.service.data.DeleteDataResult;
|
|
| 32 | -import org.apache.logging.log4j.LogManager;
|
|
| 33 | -import org.apache.logging.log4j.Logger;
|
|
| 34 | 28 | |
| 35 | 29 | import java.util.Objects;
|
| 36 | 30 | import java.util.function.BiFunction;
|
| 37 | 31 | import java.util.stream.Stream;
|
| 38 | 32 | |
| 39 | -import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 40 | 33 | import static io.ultreia.java4all.i18n.I18n.t;
|
| 41 | 34 | |
| 42 | 35 | /**
|
| ... | ... | @@ -47,7 +40,6 @@ import static io.ultreia.java4all.i18n.I18n.t; |
| 47 | 40 | */
|
| 48 | 41 | public class DeleteDataTask extends DataTaskSupport {
|
| 49 | 42 | |
| 50 | - private static final Logger log = LogManager.getLogger(DeleteDataTask.class);
|
|
| 51 | 43 | private final String prefix;
|
| 52 | 44 | private final ToolkitIdLabel data;
|
| 53 | 45 | |
| ... | ... | @@ -62,21 +54,6 @@ public class DeleteDataTask extends DataTaskSupport { |
| 62 | 54 | this.data = Objects.requireNonNull(data);
|
| 63 | 55 | }
|
| 64 | 56 | |
| 65 | - public void consume(ProgressionModel progressModel, ObserveSwingDataSource targetSource) {
|
|
| 66 | - String targetSourceLabel = targetSource.getLabel();
|
|
| 67 | - String dataId = data.getTopiaId();
|
|
| 68 | - |
|
| 69 | - progressModel.setMessage(t("observe.ui.datasource.editor.actions.data.delete", targetSourceLabel, prefix, data));
|
|
| 70 | - DeleteDataRequest deleteDataRequest = new DeleteDataRequest(dataId);
|
|
| 71 | - DeleteDataResult deleteDataResult = targetSource.getDataManagementService().deleteData(deleteDataRequest);
|
|
| 72 | - logDeleteResult(progressModel, n("observe.ui.datasource.editor.actions.data.delete.result"),
|
|
| 73 | - targetSourceLabel,
|
|
| 74 | - deleteDataResult);
|
|
| 75 | - if (targetSource.isLocal()) {
|
|
| 76 | - targetSource.setModified(true);
|
|
| 77 | - }
|
|
| 78 | - }
|
|
| 79 | - |
|
| 80 | 57 | @Override
|
| 81 | 58 | public int stepCount() {
|
| 82 | 59 | return 2;
|
| ... | ... | @@ -87,12 +64,11 @@ public class DeleteDataTask extends DataTaskSupport { |
| 87 | 64 | return t(super.getLabel(), prefix, data);
|
| 88 | 65 | }
|
| 89 | 66 | |
| 90 | - void logDeleteResult(ProgressionModel progressModel,
|
|
| 91 | - String deleteI18nKey,
|
|
| 92 | - String sourceLabel,
|
|
| 93 | - DeleteDataResult tripResult) {
|
|
| 94 | - String message = sendLogResultMessage(progressModel, deleteI18nKey, sourceLabel, prefix, data, tripResult.getTime());
|
|
| 95 | - log.info(message);
|
|
| 67 | + public String getPrefix() {
|
|
| 68 | + return prefix;
|
|
| 96 | 69 | }
|
| 97 | 70 | |
| 71 | + public ToolkitIdLabel getData() {
|
|
| 72 | + return data;
|
|
| 73 | + }
|
|
| 98 | 74 | } |
| ... | ... | @@ -22,27 +22,11 @@ package fr.ird.observe.client.datasource.api.data; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | -import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
|
| 26 | -import fr.ird.observe.client.datasource.usage.UsageForDisplayUIHandler;
|
|
| 27 | -import fr.ird.observe.dto.I18nDecoratorHelper;
|
|
| 28 | -import fr.ird.observe.dto.ProgressionModel;
|
|
| 29 | -import fr.ird.observe.dto.ToolkitIdLabel;
|
|
| 30 | 25 | import fr.ird.observe.dto.data.RootOpenableDto;
|
| 31 | -import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 32 | -import fr.ird.observe.services.service.data.MissingReferentialRequest;
|
|
| 33 | -import fr.ird.observe.services.service.data.MissingReferentialResult;
|
|
| 34 | -import fr.ird.observe.services.service.referential.ReferentialIds;
|
|
| 35 | -import fr.ird.observe.services.service.referential.ReferentialService;
|
|
| 36 | 26 | import io.ultreia.java4all.i18n.I18n;
|
| 37 | 27 | |
| 38 | 28 | import java.util.Collection;
|
| 39 | -import java.util.Map;
|
|
| 40 | 29 | import java.util.Objects;
|
| 41 | -import java.util.Set;
|
|
| 42 | -import java.util.function.Supplier;
|
|
| 43 | -import java.util.stream.Collectors;
|
|
| 44 | - |
|
| 45 | -import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 46 | 30 | |
| 47 | 31 | /**
|
| 48 | 32 | * Created on 12/11/2021.
|
| ... | ... | @@ -75,46 +59,12 @@ public class InsertMissingReferentialTask extends DataTaskSupport { |
| 75 | 59 | return 3;
|
| 76 | 60 | }
|
| 77 | 61 | |
| 78 | - public void consume(ProgressionModel progressModel, Supplier<String> messageSupplier, ObserveSwingDataSource incomingSource, ObserveSwingDataSource targetSource) {
|
|
| 79 | - progressModel.increments();
|
|
| 80 | - |
|
| 81 | - String targetSourceLabel = targetSource.getLabel();
|
|
| 82 | - |
|
| 83 | - ReferentialService targetReferentialService = targetSource.getReferentialService();
|
|
| 84 | - ReferentialIds targetSourceReferential = targetReferentialService.getReferentialIds();
|
|
| 85 | - MissingReferentialRequest missingReferentialRequest = MissingReferentialRequest.of(targetSourceReferential.getIds(), idsToCopy.toArray(new String[0]));
|
|
| 86 | - MissingReferentialResult missingReferentialResult = incomingSource.getRootOpenableService().computeMissingReferential(dataType, missingReferentialRequest);
|
|
| 87 | - progressModel.increments();
|
|
| 88 | - |
|
| 89 | - if (missingReferentialResult == null) {
|
|
| 90 | - progressModel.increments();
|
|
| 91 | - return;
|
|
| 92 | - }
|
|
| 93 | - |
|
| 94 | - // there is some referential to add to target source
|
|
| 95 | - |
|
| 96 | - Map<Class<? extends ReferentialDto>, Set<ToolkitIdLabel>> usages = incomingSource.getReferentialMap(missingReferentialResult.getMissingIds());
|
|
| 97 | - |
|
| 98 | - boolean response = UsageForDisplayUIHandler.showMissingReferential(messageSupplier.get(), usages, targetSourceLabel);
|
|
| 99 | - |
|
| 100 | - if (!response) {
|
|
| 101 | - progressModel.increments();
|
|
| 102 | - throw new UserCancelException();
|
|
| 103 | - }
|
|
| 104 | - |
|
| 105 | - StringBuilder parameters = new StringBuilder();
|
|
| 106 | - |
|
| 107 | - for (Class<? extends ReferentialDto> key : usages.keySet()) {
|
|
| 108 | - Set<ToolkitIdLabel> references = usages.get(key);
|
|
| 109 | - String type = t(I18nDecoratorHelper.getType(key));
|
|
| 110 | - String labels = references.stream().map(Object::toString).collect(Collectors.joining("\n\t * "));
|
|
| 111 | - parameters.append(t("observe.ui.datasource.editor.actions.data.import.add.missing.referential.for.type", targetSourceLabel, references.size(), type, labels));
|
|
| 112 | - parameters.append("\n");
|
|
| 113 | - }
|
|
| 114 | - |
|
| 115 | - progressModel.setMessage(t("observe.ui.datasource.editor.actions.data.import.add.missing.referential", targetSourceLabel, parameters.toString()));
|
|
| 62 | + public Class<? extends RootOpenableDto> getDataType() {
|
|
| 63 | + return dataType;
|
|
| 64 | + }
|
|
| 116 | 65 | |
| 117 | - targetReferentialService.insertMissingReferential(missingReferentialResult.getSqlCode());
|
|
| 66 | + public Collection<String> getIdsToCopy() {
|
|
| 67 | + return idsToCopy;
|
|
| 118 | 68 | }
|
| 119 | 69 | |
| 120 | 70 | } |
| ... | ... | @@ -24,7 +24,7 @@ package fr.ird.observe.client.datasource.api.data; |
| 24 | 24 | |
| 25 | 25 | import fr.ird.observe.client.util.UIHelper;
|
| 26 | 26 | import io.ultreia.java4all.i18n.I18n;
|
| 27 | -import io.ultreia.java4all.lang.TwoSide;
|
|
| 27 | +import io.ultreia.java4all.util.TwoSide;
|
|
| 28 | 28 | |
| 29 | 29 | import javax.swing.Icon;
|
| 30 | 30 |
| ... | ... | @@ -32,6 +32,11 @@ import fr.ird.observe.client.datasource.api.data.DataTaskSupport; |
| 32 | 32 | import fr.ird.observe.client.datasource.api.data.InsertMissingReferentialTask;
|
| 33 | 33 | import fr.ird.observe.client.datasource.api.data.TaskSide;
|
| 34 | 34 | import fr.ird.observe.client.datasource.api.data.UserCancelException;
|
| 35 | +import fr.ird.observe.datasource.security.BabModelVersionException;
|
|
| 36 | +import fr.ird.observe.datasource.security.DataSourceCreateWithNoReferentialImportException;
|
|
| 37 | +import fr.ird.observe.datasource.security.DatabaseConnexionNotAuthorizedException;
|
|
| 38 | +import fr.ird.observe.datasource.security.DatabaseNotFoundException;
|
|
| 39 | +import fr.ird.observe.datasource.security.IncompatibleDataSourceCreateConfigurationException;
|
|
| 35 | 40 | import fr.ird.observe.dto.ProgressionModel;
|
| 36 | 41 | import fr.ird.observe.dto.data.RootOpenableDto;
|
| 37 | 42 | import io.ultreia.java4all.lang.Strings;
|
| ... | ... | @@ -69,14 +74,12 @@ public class Apply extends DataSynchroUIActionSupport { |
| 69 | 74 | addAdminWorker(getUi().getStart().getToolTipText(), this::doApply);
|
| 70 | 75 | }
|
| 71 | 76 | |
| 72 | - private WizardState doApply() {
|
|
| 77 | + private WizardState doApply() throws BabModelVersionException, DataSourceCreateWithNoReferentialImportException, DatabaseNotFoundException, IncompatibleDataSourceCreateConfigurationException, DatabaseConnexionNotAuthorizedException {
|
|
| 73 | 78 | |
| 74 | 79 | DataSynchroModel stepModel = ui.getStepModel();
|
| 75 | 80 | DataSelectionTreePaneModel leftModel = stepModel.getModel(true);
|
| 76 | 81 | String moduleName = leftModel.getSelectionDataModel().getConfig().getModuleName();
|
| 77 | 82 | Class<? extends RootOpenableDto> dataType = "ps".equals(moduleName) ? fr.ird.observe.dto.data.ps.common.TripDto.class : fr.ird.observe.dto.data.ll.common.TripDto.class;
|
| 78 | - ObserveSwingDataSource leftSource = leftModel.getSource();
|
|
| 79 | - ObserveSwingDataSource rightSource = stepModel.getModel(false).getSource();
|
|
| 80 | 83 | DefaultListModel<DataTaskSupport> tasks = stepModel.getTasks();
|
| 81 | 84 | |
| 82 | 85 | Set<String> idsToCopyToLeft = new LinkedHashSet<>();
|
| ... | ... | @@ -107,21 +110,26 @@ public class Apply extends DataSynchroUIActionSupport { |
| 107 | 110 | log.info("Total step computed: " + stepCount);
|
| 108 | 111 | ProgressionModel progressModel = stepModel.getProgressModel();
|
| 109 | 112 | progressModel.setMaximum(stepCount);
|
| 110 | - DataManager dataManager = new DataManager(progressModel, leftSource, rightSource);
|
|
| 111 | - long t00 = TimeLog.getTime();
|
|
| 112 | - progressModel.increments();
|
|
| 113 | - try {
|
|
| 114 | - dataManager.consume(finalTasksToConsume);
|
|
| 115 | - sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date(), Strings.convertTime(TimeLog.getTime() - t00)));
|
|
| 116 | - return WizardState.SUCCESSED;
|
|
| 117 | - } catch (Exception e) {
|
|
| 118 | - progressModel.increments();
|
|
| 119 | - if (e instanceof UserCancelException) {
|
|
| 120 | - return WizardState.CANCELED;
|
|
| 113 | + |
|
| 114 | + try (ObserveSwingDataSource leftSource = openSource(leftModel.getSource())) {
|
|
| 115 | + try (ObserveSwingDataSource rightSource = openSource(stepModel.getModel(false).getSource())) {
|
|
| 116 | + long t00 = TimeLog.getTime();
|
|
| 117 | + progressModel.increments();
|
|
| 118 | + try {
|
|
| 119 | + DataManager dataManager = new DataManager(progressModel, leftSource, rightSource);
|
|
| 120 | + dataManager.consume(finalTasksToConsume);
|
|
| 121 | + sendMessage(t("observe.ui.datasource.editor.actions.operation.message.done", new Date(), Strings.convertTime(TimeLog.getTime() - t00)));
|
|
| 122 | + return WizardState.SUCCESSED;
|
|
| 123 | + } catch (Exception e) {
|
|
| 124 | + progressModel.increments();
|
|
| 125 | + if (e instanceof UserCancelException) {
|
|
| 126 | + return WizardState.CANCELED;
|
|
| 127 | + }
|
|
| 128 | + throw e;
|
|
| 129 | + } finally {
|
|
| 130 | + log.warn(String.format("Expected count: %d - final step count: %d", stepCount, progressModel.getValue()));
|
|
| 131 | + }
|
|
| 121 | 132 | }
|
| 122 | - throw e;
|
|
| 123 | - } finally {
|
|
| 124 | - log.warn(String.format("Expected count: %d - final step count: %d", stepCount, progressModel.getValue()));
|
|
| 125 | 133 | }
|
| 126 | 134 | }
|
| 127 | 135 |
| ... | ... | @@ -148,76 +148,74 @@ public class Start extends ValidateUIActionSupport { |
| 148 | 148 | |
| 149 | 149 | SelectionTreeModel dataModel = model.getSelectDataModel().getSelectionDataModel();
|
| 150 | 150 | |
| 151 | - ObserveSwingDataSource dataSourceToValidate = model.getConfigModel().getLeftSourceModel().getSource();
|
|
| 151 | + try (ObserveSwingDataSource dataSourceToValidate = model.getConfigModel().getLeftSourceModel().getSource()) {
|
|
| 152 | + int stepsCount = computeStepCount(dataSourceToValidate, dataModel);
|
|
| 153 | + log.info("Step count: {}", stepsCount);
|
|
| 154 | + ProgressionModel progressModel = stepModel.getProgressModel();
|
|
| 155 | + progressModel.setMaximum(stepsCount);
|
|
| 156 | + progressModel.setValue(0);
|
|
| 157 | + |
|
| 158 | + if (!dataSourceToValidate.isOpen()) {
|
|
| 159 | + dataSourceToValidate.open();
|
|
| 160 | + progressModel.increments();
|
|
| 161 | + }
|
|
| 152 | 162 | |
| 153 | - int stepsCount = computeStepCount(dataSourceToValidate, dataModel);
|
|
| 154 | - log.info("Step count: {}", stepsCount);
|
|
| 155 | - ProgressionModel progressModel = stepModel.getProgressModel();
|
|
| 156 | - progressModel.setMaximum(stepsCount);
|
|
| 157 | - progressModel.setValue(0);
|
|
| 163 | + ValidateService validateService = dataSourceToValidate.getValidateService();
|
|
| 158 | 164 | |
| 159 | - if (!dataSourceToValidate.isOpen()) {
|
|
| 160 | - dataSourceToValidate.open();
|
|
| 161 | - progressModel.increments();
|
|
| 162 | - }
|
|
| 165 | + Set<NuitonValidatorScope> scopes = stepModel.getScopes();
|
|
| 166 | + String contextName = stepModel.getContextName();
|
|
| 167 | + ValidationResult result;
|
|
| 163 | 168 | |
| 164 | - ValidateService validateService = dataSourceToValidate.getValidateService();
|
|
| 169 | + ValidationRequestConfiguration configuration = stepModel.toValidationRequestConfiguration();
|
|
| 170 | + if (dataModel.getConfig().isLoadReferential()) {
|
|
| 165 | 171 | |
| 166 | - Set<NuitonValidatorScope> scopes = stepModel.getScopes();
|
|
| 167 | - String contextName = stepModel.getContextName();
|
|
| 172 | + ReferentialValidationRequest request = new ReferentialValidationRequest();
|
|
| 168 | 173 | |
| 169 | - ValidationResult result;
|
|
| 174 | + request.setReferentialTypes(dataModel.getSelectedReferential());
|
|
| 175 | + request.setScopes(scopes);
|
|
| 176 | + request.setValidationContext(contextName);
|
|
| 170 | 177 | |
| 171 | - ValidationRequestConfiguration configuration = stepModel.toValidationRequestConfiguration();
|
|
| 172 | - if (dataModel.getConfig().isLoadReferential()) {
|
|
| 178 | + progressModel.increments();
|
|
| 179 | + result = validateService.validateReferential(configuration, request);
|
|
| 180 | + progressModel.increments();
|
|
| 173 | 181 | |
| 174 | - ReferentialValidationRequest request = new ReferentialValidationRequest();
|
|
| 182 | + } else if (dataModel.getConfig().isLoadData()) {
|
|
| 175 | 183 | |
| 176 | - request.setReferentialTypes(dataModel.getSelectedReferential());
|
|
| 177 | - request.setScopes(scopes);
|
|
| 178 | - request.setValidationContext(contextName);
|
|
| 179 | - |
|
| 180 | - progressModel.increments();
|
|
| 181 | - result = validateService.validateReferential(configuration, request);
|
|
| 182 | - progressModel.increments();
|
|
| 184 | + try (ValidationResultBuilder resultBuilder = ValidationResultBuilder.create()) {
|
|
| 185 | + List<ToolkitIdLabel> selectedData = new LinkedList<>(dataModel.getSelectedData());
|
|
| 186 | + Class<? extends RootOpenableDto> dataType = dataModel.getRequest().getModuleName().equals("ps") ? fr.ird.observe.dto.data.ps.common.TripDto.class : fr.ird.observe.dto.data.ll.common.TripDto.class;
|
|
| 187 | + Decorator decorator = getDecoratorService().getToolkitIdLabelDecoratorByType(dataType);
|
|
| 188 | + selectedData.forEach(d -> d.registerDecorator(decorator));
|
|
| 189 | + decorator.sort(selectedData, 0);
|
|
| 190 | + int max = selectedData.size();
|
|
| 191 | + int index = 1;
|
|
| 192 | + for (ToolkitIdLabel datum : selectedData) {
|
|
| 183 | 193 | |
| 184 | - } else if (dataModel.getConfig().isLoadData()) {
|
|
| 194 | + String id = datum.getId();
|
|
| 185 | 195 | |
| 186 | - try (ValidationResultBuilder resultBuilder = ValidationResultBuilder.create()) {
|
|
| 187 | - List<ToolkitIdLabel> selectedData = new LinkedList<>(dataModel.getSelectedData());
|
|
| 188 | - Class<? extends RootOpenableDto> dataType = dataModel.getRequest().getModuleName().equals("ps") ? fr.ird.observe.dto.data.ps.common.TripDto.class : fr.ird.observe.dto.data.ll.common.TripDto.class;
|
|
| 189 | - Decorator decorator = getDecoratorService().getToolkitIdLabelDecoratorByType(dataType);
|
|
| 190 | - selectedData.forEach(d -> d.registerDecorator(decorator));
|
|
| 191 | - decorator.sort(selectedData, 0);
|
|
| 192 | - int max = selectedData.size();
|
|
| 193 | - int index = 1;
|
|
| 194 | - for (ToolkitIdLabel datum : selectedData) {
|
|
| 196 | + DataValidationRequest request = new DataValidationRequest();
|
|
| 197 | + request.setDataIds(Collections.singleton(id));
|
|
| 198 | + request.setScopes(scopes);
|
|
| 199 | + request.setValidationContext(contextName);
|
|
| 195 | 200 | |
| 196 | - String id = datum.getId();
|
|
| 201 | + sendMessage(String.format("[ %4d - %4d ] ", index, max) + t("observe.ui.datasource.editor.actions.validate.message.validate.trip", datum));
|
|
| 197 | 202 | |
| 198 | - DataValidationRequest request = new DataValidationRequest();
|
|
| 199 | - request.setDataIds(Collections.singleton(id));
|
|
| 200 | - request.setScopes(scopes);
|
|
| 201 | - request.setValidationContext(contextName);
|
|
| 202 | - |
|
| 203 | - sendMessage(String.format("[ %4d - %4d ] ", index, max) + t("observe.ui.datasource.editor.actions.validate.message.validate.trip", datum));
|
|
| 204 | - |
|
| 205 | - progressModel.increments();
|
|
| 206 | - result = validateService.validateData(configuration, request);
|
|
| 207 | - progressModel.increments();
|
|
| 208 | - resultBuilder.addResult(result);
|
|
| 209 | - index++;
|
|
| 203 | + progressModel.increments();
|
|
| 204 | + result = validateService.validateData(configuration, request);
|
|
| 205 | + progressModel.increments();
|
|
| 206 | + resultBuilder.addResult(result);
|
|
| 207 | + index++;
|
|
| 208 | + }
|
|
| 209 | + result = resultBuilder.build();
|
|
| 210 | 210 | }
|
| 211 | - result = resultBuilder.build();
|
|
| 212 | - }
|
|
| 213 | 211 | |
| 214 | - } else {
|
|
| 215 | - throw new IllegalStateException();
|
|
| 212 | + } else {
|
|
| 213 | + throw new IllegalStateException();
|
|
| 214 | + }
|
|
| 215 | + progressModel.increments();
|
|
| 216 | + stepModel.setValidationResult(result);
|
|
| 217 | + log.info("Step count (at the end): {} vs computed {}", progressModel.getValue(), stepsCount);
|
|
| 216 | 218 | }
|
| 217 | - dataSourceToValidate.close();
|
|
| 218 | - progressModel.increments();
|
|
| 219 | - stepModel.setValidationResult(result);
|
|
| 220 | - log.info("Step count (at the end): {} vs computed {}", progressModel.getValue(), stepsCount);
|
|
| 221 | 219 | }
|
| 222 | 220 | |
| 223 | 221 | private void generateReportFile(ValidateModel validationModel) throws IOException {
|
| ... | ... | @@ -548,7 +548,7 @@ observe.ui.datasource.editor.actions.exportData.title=Export data |
| 548 | 548 | observe.ui.datasource.editor.actions.exportData.title.tip=Export data
|
| 549 | 549 | observe.ui.datasource.editor.actions.operation.configuration=Configuration of operations
|
| 550 | 550 | observe.ui.datasource.editor.actions.operation.message.canceled=Operation <%1$s> canceled.
|
| 551 | -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).
|
|
| 551 | +observe.ui.datasource.editor.actions.operation.message.done=Operation done at %1$td/%1$tm/%1$tY à %1$tH\:%1$tM\:%1$tS (duration\: %2$s).
|
|
| 552 | 552 | observe.ui.datasource.editor.actions.operation.message.failed=Operation has failed.
|
| 553 | 553 | observe.ui.datasource.editor.actions.operation.message.needFix=Operation need fix.
|
| 554 | 554 | observe.ui.datasource.editor.actions.operation.message.running=Operation <%1$s> is running...
|
| ... | ... | @@ -548,7 +548,7 @@ observe.ui.datasource.editor.actions.exportData.title=Exportar los datos |
| 548 | 548 | observe.ui.datasource.editor.actions.exportData.title.tip=Exportar los datos de usuario
|
| 549 | 549 | observe.ui.datasource.editor.actions.operation.configuration=Configuración de las operaciones
|
| 550 | 550 | observe.ui.datasource.editor.actions.operation.message.canceled=La operación <%1$s> fue cancelada.
|
| 551 | -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).
|
|
| 551 | +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\: %2$s).
|
|
| 552 | 552 | observe.ui.datasource.editor.actions.operation.message.failed=La operación falló
|
| 553 | 553 | observe.ui.datasource.editor.actions.operation.message.needFix=La operación necesita correcciones.
|
| 554 | 554 | observe.ui.datasource.editor.actions.operation.message.running=La operación < %1$s > se está ejecutando...
|
| ... | ... | @@ -548,7 +548,7 @@ observe.ui.datasource.editor.actions.exportData.title=Exporter les données |
| 548 | 548 | observe.ui.datasource.editor.actions.exportData.title.tip=Exporter les données utilisateurs vers une base centrale
|
| 549 | 549 | observe.ui.datasource.editor.actions.operation.configuration=Configuration des opérations
|
| 550 | 550 | observe.ui.datasource.editor.actions.operation.message.canceled=L'opération <%1$s> a été annulée.
|
| 551 | -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).
|
|
| 551 | +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é \: %2$s).
|
|
| 552 | 552 | observe.ui.datasource.editor.actions.operation.message.failed=L'opération a échouée
|
| 553 | 553 | observe.ui.datasource.editor.actions.operation.message.needFix=L'opération requière des corrections.
|
| 554 | 554 | observe.ui.datasource.editor.actions.operation.message.running=L'opération < %1$s > est en cours d'exécution...
|
| ... | ... | @@ -37,6 +37,7 @@ import org.apache.hc.client5.http.cookie.BasicCookieStore; |
| 37 | 37 | import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
| 38 | 38 | import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
| 39 | 39 | import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager;
|
| 40 | +import org.apache.hc.core5.http.io.SocketConfig;
|
|
| 40 | 41 | import org.apache.logging.log4j.LogManager;
|
| 41 | 42 | import org.apache.logging.log4j.Logger;
|
| 42 | 43 | |
| ... | ... | @@ -62,6 +63,7 @@ public class ObserveServiceFactoryClient implements ObserveServiceFactory { |
| 62 | 63 | if (responseBuilder == null) {
|
| 63 | 64 | int timeout = serviceInitializer.getInitializerConfig().getHttpTimeout();
|
| 64 | 65 | ConnectionConfig connConfig = ConnectionConfig.custom()
|
| 66 | + .setTimeToLive(200, TimeUnit.MILLISECONDS)
|
|
| 65 | 67 | .setSocketTimeout(timeout, TimeUnit.MILLISECONDS)
|
| 66 | 68 | .build();
|
| 67 | 69 | BasicHttpClientConnectionManager cm = new BasicHttpClientConnectionManager();
|
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | <parent>
|
| 24 | 24 | <groupId>io.ultreia.maven</groupId>
|
| 25 | 25 | <artifactId>pom</artifactId>
|
| 26 | - <version>2024.12</version>
|
|
| 26 | + <version>2024.13</version>
|
|
| 27 | 27 | </parent>
|
| 28 | 28 | <groupId>fr.ird.observe</groupId>
|
| 29 | 29 | <artifactId>ird-observe</artifactId>
|
| ... | ... | @@ -99,7 +99,7 @@ public class ReferentialIdsBuilder { |
| 99 | 99 | |
| 100 | 100 | long t0 = TimeLog.getTime();
|
| 101 | 101 | List<String> count = persistenceContext.getSqlSupport().findMultipleResult(realSql, r -> r.getString(1));
|
| 102 | - TIME_LOG.log(t0, "Get referential ids", realSql);
|
|
| 102 | + TIME_LOG.log(t0, "Get referential ids", String.format(TopiaEntitySqlReplicatePlanTask.applyIds(task.getSelectSql(), selectClause, "in (" + this.ids.size() + ")"), columnName));
|
|
| 103 | 103 | if (!count.isEmpty()) {
|
| 104 | 104 | result.computeIfAbsent(dtoType, e -> new TreeSet<>()).addAll(count);
|
| 105 | 105 | }
|