mailman.cloud.codelutin.com
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Observe-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2013 -----
  • December
  • November
  • October
  • September
observe-commits@list.forge.codelutin.com

March 2021

  • 1 participants
  • 83 discussions
[Git][ultreiaio/ird-observe][release/8.0.7] [jgitflow-maven-plugin]updating poms for branch'release/8.0.7' with non-snapshot versions[skip ci]
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed to branch release/8.0.7 at ultreiaio / ird-observe Commits: d1a0b760 by Tony Chemit at 2021-03-12T14:49:46+01:00 [jgitflow-maven-plugin]updating poms for branch'release/8.0.7' with non-snapshot versions[skip ci] - - - - - 30 changed files: - client/configuration/pom.xml - client/core/pom.xml - client/datasource/actions/pom.xml - client/datasource/api/pom.xml - client/datasource/editor/api-test/pom.xml - client/datasource/editor/api/pom.xml - client/datasource/editor/common/pom.xml - client/datasource/editor/ll/pom.xml - client/datasource/editor/pom.xml - client/datasource/editor/ps/pom.xml - client/datasource/editor/spi/pom.xml - client/datasource/pom.xml - client/i18n/pom.xml - client/pom.xml - client/runner/pom.xml - models/dto/definition/pom.xml - models/dto/java/pom.xml - models/dto/pom.xml - models/persistence/definition/pom.xml - models/persistence/java/pom.xml - models/persistence/migration/pom.xml - models/persistence/pom.xml - models/pom.xml - observe/pom.xml - pom.xml - server/configuration/pom.xml - server/core/pom.xml - server/i18n/pom.xml - server/pom.xml - server/runner/pom.xml The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/d1a0b7604871df42f8d6212d6… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/d1a0b7604871df42f8d6212d6… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][master] 24 commits: [jgitflow-maven-plugin]updating poms for 8.0.7-SNAPSHOT development[skip ci]
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed to branch master at ultreiaio / ird-observe Commits: c4273ddf by Tony Chemit at 2021-02-19T16:19:16+01:00 [jgitflow-maven-plugin]updating poms for 8.0.7-SNAPSHOT development[skip ci] - - - - - 1ca8c3d0 by Tony Chemit at 2021-02-19T16:33:56+01:00 [jgitflow-maven-plugin]updating develop poms to master versions to avoid merge conflicts[skip ci] - - - - - 9afdfc39 by Tony Chemit at 2021-02-19T16:33:57+01:00 [jgitflow-maven-plugin]merging 'master' into 'develop' - - - - - dccf7a71 by Tony Chemit at 2021-02-19T16:33:57+01:00 [jgitflow-maven-plugin]Updating develop poms back to pre merge state[skip ci] - - - - - cacb0ae3 by Tony Chemit at 2021-02-20T09:59:42+01:00 fix back release profile - - - - - 595f5a2a by Tony Chemit at 2021-02-20T09:59:42+01:00 let define previous model version in pom for update-tck - - - - - 98258f38 by Tony Chemit at 2021-03-09T10:28:05+01:00 improve ci jobs - - - - - 01cb617d by Tony Chemit at 2021-03-09T10:28:05+01:00 Mauvaise génération d'une sauvegarde si toutes les données sont sélectionnées - - - - - 6d7366ad by Tony Chemit at 2021-03-09T10:28:05+01:00 Rendre les déplacements impossible si les parents incriminés sont obsolètes. - Closes #1794 - - - - - 320af6c0 by Tony Chemit at 2021-03-09T10:28:05+01:00 Réusinage de la configuration d'une source de données et des templates associées - Closes #1797 - - - - - df05cdfd by Tony Chemit at 2021-03-09T10:28:05+01:00 Revue de l'opération longue de validation - Closes #1798 - - - - - af76b2dc by Tony Chemit at 2021-03-11T10:51:24+01:00 Réusinage de la configuration d'une source de données et des templates associées - Closes #1797 - - - - - d219d92e by Tony Chemit at 2021-03-11T10:51:24+01:00 Fix bad reports selection - - - - - 58b30886 by Tony Chemit at 2021-03-12T13:16:40+01:00 Réusinage de la configuration d'une source de données et des templates associées - Closes #1797 - - - - - b564c86a by Tony Chemit at 2021-03-12T13:16:40+01:00 Bloquer l'import d'une marée si elle contient des identifiants déjà utilisés dans la base cible - Closes #1799 - - - - - 384b1d11 by Tony Chemit at 2021-03-12T13:16:40+01:00 Update jaxx - - - - - a5cef205 by Tony Chemit at 2021-03-12T13:16:40+01:00 Fix LL Paring admin action - - - - - 9d65cd9d by Tony Chemit at 2021-03-12T13:16:40+01:00 Simplify admin actions menu: no more any generated menu ui, just declare them while installing the body content - - - - - b28aaabc by Tony Chemit at 2021-03-12T14:03:14+01:00 Amélioration des éditeurs inline - Closes #1800 - - - - - 990796ec by Tony Chemit at 2021-03-12T14:05:26+01:00 Fix bad toolkit release - - - - - e663a35b by Tony Chemit at 2021-03-12T14:47:42+01:00 Improve LL pairing result tree (remove any node without data, and sort also activity nodes by their timestamp) - - - - - 78828aa2 by Tony Chemit at 2021-03-12T14:49:06+01:00 [jgitflow-maven-plugin]updating poms for 8.0.7 branch with snapshot versions[skip ci] - - - - - d1a0b760 by Tony Chemit at 2021-03-12T14:49:46+01:00 [jgitflow-maven-plugin]updating poms for branch'release/8.0.7' with non-snapshot versions[skip ci] - - - - - 7dcb4b27 by Tony Chemit at 2021-03-12T15:04:37+01:00 [jgitflow-maven-plugin]merging 'release/8.0.7' into 'master' - - - - - 30 changed files: - .gitlab-ci.yml - client/configuration/pom.xml - client/configuration/src/main/config/Client.ini - client/configuration/src/main/i18n/getters/config.getter - client/configuration/src/main/i18n/getters/java-enumeration.getter - client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java - server/core/src/main/java/fr/ird/observe/server/security/AdminApiKeyNotFoundException.java → client/configuration/src/main/java/fr/ird/observe/client/configuration/ObserveServiceInitializerConfigClient.java - − client/configuration/src/main/java/fr/ird/observe/client/constants/CreationMode.java - − client/configuration/src/main/java/fr/ird/observe/client/constants/DbMode.java - client/core/pom.xml - client/core/src/main/i18n/getters/java.getter - client/core/src/main/i18n/getters/jaxx.getter - − client/core/src/main/i18n/templates/dataSourceInformation_en_GB.ftl - − client/core/src/main/i18n/templates/dataSourceInformation_es_ES.ftl - − client/core/src/main/i18n/templates/dataSourceInformation_fr_FR.ftl - client/core/src/main/java/fr/ird/observe/client/ClientUIContext.java - client/core/src/main/java/fr/ird/observe/client/ObserveSwingApplicationContext.java - client/core/src/main/java/fr/ird/observe/client/datasource/api/ObserveDataSourcesManager.java - client/core/src/main/java/fr/ird/observe/client/datasource/api/ObserveSwingDataSource.java - client/core/src/main/java/fr/ird/observe/client/datasource/h2/backup/BackupsManager.java - client/core/src/main/java/fr/ird/observe/client/main/actions/ReloadApplicationAction.java - client/core/src/main/java/fr/ird/observe/client/main/body/ClientConfigUI.java - client/core/src/main/java/fr/ird/observe/client/util/ObserveKeyStrokesSupport.java - client/core/src/main/java/fr/ird/observe/client/util/UIHelper.java - client/core/src/main/java/fr/ird/observe/client/util/treetable/JaxxComboBoxCellEditor.java - − client/core/src/main/resources/icons/action-db-local.png - − client/core/src/main/resources/icons/action-db-remote.png - − client/core/src/main/resources/icons/action-db-server.png - client/core/src/main/resources/observe-ui.properties - client/datasource/actions/pom.xml The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/81fcef8e255688391c9f8c48… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/81fcef8e255688391c9f8c48… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 6 commits: [jgitflow-maven-plugin]updating poms for 8.0.7 branch with snapshot versions[skip ci]
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 78828aa2 by Tony Chemit at 2021-03-12T14:49:06+01:00 [jgitflow-maven-plugin]updating poms for 8.0.7 branch with snapshot versions[skip ci] - - - - - d1a0b760 by Tony Chemit at 2021-03-12T14:49:46+01:00 [jgitflow-maven-plugin]updating poms for branch'release/8.0.7' with non-snapshot versions[skip ci] - - - - - 7dcb4b27 by Tony Chemit at 2021-03-12T15:04:37+01:00 [jgitflow-maven-plugin]merging 'release/8.0.7' into 'master' - - - - - 0bc91849 by Tony Chemit at 2021-03-12T15:04:40+01:00 [jgitflow-maven-plugin]updating develop poms to master versions to avoid merge conflicts[skip ci] - - - - - 883cde74 by Tony Chemit at 2021-03-12T15:04:40+01:00 [jgitflow-maven-plugin]merging 'master' into 'develop' - - - - - 77e18ca8 by Tony Chemit at 2021-03-12T15:04:41+01:00 [jgitflow-maven-plugin]Updating develop poms back to pre merge state[skip ci] - - - - - 0 changed files: Changes: View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/27300389a5e5b93af00d292f… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/27300389a5e5b93af00d292f… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe] Pushed new branch release/8.0.7
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed new branch release/8.0.7 at ultreiaio / ird-observe -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/tree/release/8.0.7 You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] [jgitflow-maven-plugin]updating poms for 8.0.8-SNAPSHOT development[skip ci]
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 27300389 by Tony Chemit at 2021-03-12T14:49:08+01:00 [jgitflow-maven-plugin]updating poms for 8.0.8-SNAPSHOT development[skip ci] - - - - - 30 changed files: - client/configuration/pom.xml - client/core/pom.xml - client/datasource/actions/pom.xml - client/datasource/api/pom.xml - client/datasource/editor/api-test/pom.xml - client/datasource/editor/api/pom.xml - client/datasource/editor/common/pom.xml - client/datasource/editor/ll/pom.xml - client/datasource/editor/pom.xml - client/datasource/editor/ps/pom.xml - client/datasource/editor/spi/pom.xml - client/datasource/pom.xml - client/i18n/pom.xml - client/pom.xml - client/runner/pom.xml - models/dto/definition/pom.xml - models/dto/java/pom.xml - models/dto/pom.xml - models/persistence/definition/pom.xml - models/persistence/java/pom.xml - models/persistence/migration/pom.xml - models/persistence/pom.xml - models/pom.xml - observe/pom.xml - pom.xml - server/configuration/pom.xml - server/core/pom.xml - server/i18n/pom.xml - server/pom.xml - server/runner/pom.xml The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/27300389a5e5b93af00d292f1… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/27300389a5e5b93af00d292f1… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] Improve LL pairing result tree (remove any node without data, and sort also...
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: e663a35b by Tony Chemit at 2021-03-12T14:47:42+01:00 Improve LL pairing result tree (remove any node without data, and sort also activity nodes by their timestamp) - - - - - 4 changed files: - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/ActivityLlPairingTreeTable.java - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/node/ActivityLlPairingTripNode.java - models/dto/java/src/main/java/fr/ird/observe/dto/data/ll/pairing/ActivityPairingResult.java - models/dto/java/src/main/java/fr/ird/observe/dto/data/ll/pairing/TripPairingResult.java Changes: ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/ActivityLlPairingTreeTable.java ===================================== @@ -215,6 +215,7 @@ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClien if (table.getColumn(2).equals(columnExt)) { columnExt.setPreferredWidth(50); columnExt.setMinWidth(50); + columnExt.setMaxWidth(100); return; } super.configureColumnWidths(table, columnExt); ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/node/ActivityLlPairingTripNode.java ===================================== @@ -38,7 +38,9 @@ public class ActivityLlPairingTripNode extends ActivityPairingNodeSupport { public ActivityLlPairingTripNode(TripPairingResult userObject) { super(Objects.requireNonNull(userObject), true); for (ActivityPairingResult activityPairingResult : userObject.getItems()) { - add(new ActivityLlPairingActivityNode(activityPairingResult)); + if (!activityPairingResult.getItems().isEmpty() || activityPairingResult.getSelectedRelatedObservedActivity() != null) { + add(new ActivityLlPairingActivityNode(activityPairingResult)); + } } } ===================================== models/dto/java/src/main/java/fr/ird/observe/dto/data/ll/pairing/ActivityPairingResult.java ===================================== @@ -36,6 +36,7 @@ import java.util.Objects; */ public class ActivityPairingResult implements ObserveDto { + public static final Comparator<ActivityPairingResult> RESULT_COMPARATOR = Comparator.comparing(t->t.getActivityLogbook().getTimeStamp()); public static final Comparator<ActivityPairingResultItem> COMPARATOR = Comparator.comparingDouble(ActivityPairingResultItem::getComputedDistance).thenComparingDouble(ActivityPairingResultItem::getComputedTime); private final ActivityReference activityLogbook; ===================================== models/dto/java/src/main/java/fr/ird/observe/dto/data/ll/pairing/TripPairingResult.java ===================================== @@ -38,7 +38,7 @@ public class TripPairingResult implements ObserveDto { public TripPairingResult(TripReference trip, ImmutableList<ActivityPairingResult> items) { this.trip = trip; - this.items = items; + this.items = items.stream().sorted(ActivityPairingResult.RESULT_COMPARATOR).collect(ImmutableList.toImmutableList()); } public TripReference getTrip() { View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/e663a35ba08284efa266aad37… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/e663a35ba08284efa266aad37… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 2 commits: Amélioration des éditeurs inline - Closes #1800
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: b28aaabc by Tony Chemit at 2021-03-12T14:03:14+01:00 Amélioration des éditeurs inline - Closes #1800 - - - - - 990796ec by Tony Chemit at 2021-03-12T14:05:26+01:00 Fix bad toolkit release - - - - - 11 changed files: - client/core/pom.xml - client/core/src/main/java/fr/ird/observe/client/util/UIHelper.java - client/core/src/main/java/fr/ird/observe/client/util/treetable/JaxxComboBoxCellEditor.java - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/ActivityLlPairingTreeTable.java - client/datasource/editor/ll/pom.xml - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripGearUseFeaturesUIHandler.java - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetCatchUIHandler.java - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIHandler.java - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIInitializer.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripGearUseFeaturesUIHandler.java - pom.xml Changes: ===================================== client/core/pom.xml ===================================== @@ -271,10 +271,6 @@ <groupId>org.swinglabs.swingx</groupId> <artifactId>swingx-painters</artifactId> </dependency> - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-autocomplete</artifactId> - </dependency> <dependency> <groupId>org.swinglabs</groupId> <artifactId>jxlayer</artifactId> ===================================== client/core/src/main/java/fr/ird/observe/client/util/UIHelper.java ===================================== @@ -22,6 +22,7 @@ package fr.ird.observe.client.util; import fr.ird.observe.client.ClientUIContextApplicationComponent; +import fr.ird.observe.client.util.treetable.JaxxComboBoxCellEditor; import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper; import fr.ird.observe.dto.reference.DataDtoReference; import fr.ird.observe.dto.reference.ReferentialDtoReference; @@ -29,19 +30,15 @@ import io.ultreia.java4all.jaxx.widgets.choice.BooleanTableCellRenderer; import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor; -import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; import org.nuiton.decorator.Decorator; import org.nuiton.decorator.JXPathDecorator; +import org.nuiton.decorator.MultiJXPathDecorator; import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.context.JAXXInitialContext; import org.nuiton.jaxx.runtime.swing.SwingUtil; -import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import org.nuiton.jaxx.runtime.swing.renderer.DecoratorTableCellRenderer; -import org.nuiton.jaxx.widgets.BeanUIUtil; import org.nuiton.jaxx.widgets.error.ErrorDialogUI; -import javax.swing.JComboBox; import javax.swing.JTable; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; @@ -51,7 +48,6 @@ import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -70,6 +66,16 @@ public class UIHelper extends SwingUtil { static private final Logger log = LogManager.getLogger(UIHelper.class); + public static class LogPropertyChanged implements PropertyChangeListener { + @Override + public void propertyChange(PropertyChangeEvent evt) { + String name = evt.getPropertyName(); + Object oldValue = evt.getOldValue(); + Object newValue = evt.getNewValue(); + log.debug(evt.getSource() + " - Property [" + name + "] has changed from " + oldValue + " to " + newValue); + } + } + public static void addApplicationIcon(Window window) { window.setIconImage(createImageIcon("logo.png").getImage()); } @@ -152,35 +158,10 @@ public class UIHelper extends SwingUtil { return new JAXXInitialContext().add(model).add(ui); } - public static <B> ComboBoxCellEditor newDataColumnEditor(List<B> data, Decorator<B> decorator) { - JComboBox<B> comboBox = new JComboBox<>(); - return newDataColumnEditor(comboBox, data, decorator); - } - - public static <B> ComboBoxCellEditor newDataColumnEditor(JComboBox<B> comboBox, List<B> data, Decorator<B> decorator) { - comboBox.setRenderer(new DecoratorListCellRenderer<>(decorator)); - prepareComboBoxData(comboBox, data); - ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); - BeanUIUtil.decorate(comboBox, converter); - return new ComboBoxCellEditor(comboBox); - } - - public static <B> void prepareComboBoxData(JComboBox<B> comboBox, List<B> data) { - List<B> dataToList = new ArrayList<>(data); - // add a null value at first position - if (!dataToList.isEmpty() && dataToList.get(0) != null) { - dataToList.add(0, null); - } - fillComboBox(comboBox, dataToList, null); - } - - public static class LogPropertyChanged implements PropertyChangeListener { - @Override - public void propertyChange(PropertyChangeEvent evt) { - String name = evt.getPropertyName(); - Object oldValue = evt.getOldValue(); - Object newValue = evt.getNewValue(); - log.debug(evt.getSource() + " - Property [" + name + "] has changed from " + oldValue + " to " + newValue); - } + @SuppressWarnings({"unchecked", "rawtypes"}) + public static <B> JaxxComboBoxCellEditor newDataColumnEditor(List<B> data, MultiJXPathDecorator<B> decorator) { + JaxxComboBoxCellEditor cellEditor = JaxxComboBoxCellEditor.newEditor(decorator.getType(), decorator); + cellEditor.getComponent().setData((List) data); + return cellEditor; } } ===================================== client/core/src/main/java/fr/ird/observe/client/util/treetable/JaxxComboBoxCellEditor.java ===================================== @@ -46,9 +46,10 @@ public class JaxxComboBoxCellEditor extends DefaultCellEditor { String entityLabel = ObserveI18nDecoratorHelper.getType(dataType); editor.setPopupTitleText(t("observe.data.Data.type", entityLabel)); editor.setBeanType(dataType); - editor.setMinimumSize(new Dimension(0, 24)); + editor.setMinimumSize(new Dimension(0, 22)); editor.getConfig().setFilterable(false); editor.getConfig().setTabToSelect(false); + editor.getConfig().setShowReset(true); editor.init(decorator, Collections.emptyList()); return new JaxxComboBoxCellEditor(editor); } ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/ActivityLlPairingTreeTable.java ===================================== @@ -263,7 +263,7 @@ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClien editorBuilder.add(this.booleanEditor = table.getDefaultEditor(Boolean.class)); editorBuilder.add(this.pairingEditor = JaxxComboBoxCellEditor.newEditor(ActivityPairingResultItem.class, decorator)); - pairingEditor.getComponent().setShowReset(true); +// pairingEditor.getComponent().setShowReset(true); this.editors = editorBuilder.build(); } ===================================== client/datasource/editor/ll/pom.xml ===================================== @@ -202,10 +202,6 @@ <groupId>org.swinglabs.swingx</groupId> <artifactId>swingx-core</artifactId> </dependency> - <dependency> - <groupId>org.swinglabs.swingx</groupId> - <artifactId>swingx-autocomplete</artifactId> - </dependency> <dependency> <groupId>org.geotools</groupId> ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripGearUseFeaturesUIHandler.java ===================================== @@ -77,6 +77,7 @@ public class TripGearUseFeaturesUIHandler extends GeneratedTripGearUseFeaturesUI { // init measurements table JTable table = ui.getMeasurementsTable(); + table.setRowHeight(22); UIHelper.setI18nTableHeaderRenderer(table, n("observe.data.common.GearUseFeatures.gearCharacteristic.short"), n("observe.data.common.GearUseFeatures.gearCharacteristic"), ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetCatchUIHandler.java ===================================== @@ -118,7 +118,7 @@ public class SetCatchUIHandler extends GeneratedSetCatchUIHandler { { // init size measures table JTable table = ui.getSizeMeasuresTable(); - + table.setRowHeight(22); UIHelper.setI18nTableHeaderRenderer(table, n("observe.data.ll.observation.SizeMeasure.sizeMeasureType.short"), n("observe.data.ll.observation.SizeMeasure.sizeMeasureType"), @@ -146,6 +146,7 @@ public class SetCatchUIHandler extends GeneratedSetCatchUIHandler { { // init weight measures table JTable table = ui.getWeightMeasuresTable(); + table.setRowHeight(22); UIHelper.setI18nTableHeaderRenderer(table, n("observe.data.ll.observation.WeightMeasure.weightMeasureType.short"), n("observe.data.ll.observation.WeightMeasure.weightMeasureType"), ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIHandler.java ===================================== @@ -38,6 +38,7 @@ import fr.ird.observe.dto.data.ll.observation.SectionWithTemplateDto; import fr.ird.observe.dto.data.ll.observation.SetDetailCompositionDto; import fr.ird.observe.dto.form.Form; import io.ultreia.java4all.i18n.I18n; +import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,7 +50,6 @@ import org.jdesktop.swingx.renderer.StringValue; import org.nuiton.jaxx.runtime.swing.JVetoableTabbedPane; import org.nuiton.jaxx.validator.swing.SwingValidator; -import javax.swing.JComboBox; import javax.swing.JOptionPane; import java.awt.Color; import java.beans.PropertyChangeListener; @@ -274,8 +274,8 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition if (getModel().getStates().isCanGenerate()) { // update section templates list List<SectionTemplateDto> sectionTemplates = getModel().getStates().getSectionTemplatesTableModel().getNotEmptyData(); - @SuppressWarnings("unchecked") JComboBox<SectionTemplateDto> comboBox = (JComboBox<SectionTemplateDto>) getUi().getSectionsTable().getClientProperty(SECTION_TEMPLATES_EDITOR); - UIHelper.prepareComboBoxData(comboBox, sectionTemplates); + @SuppressWarnings("unchecked") JaxxComboBox<SectionTemplateDto> comboBox = (JaxxComboBox<SectionTemplateDto>) getUi().getSectionsTable().getClientProperty(SECTION_TEMPLATES_EDITOR); + comboBox.setData(sectionTemplates); //2014-FIXME See why templates are not well reselect in cell editor //2014-FIXME See cell editor does not loose focus and empty selection when losing focus } ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIInitializer.java ===================================== @@ -45,16 +45,15 @@ import fr.ird.observe.client.datasource.editor.ll.data.observation.composition.t import fr.ird.observe.client.util.UIHelper; import fr.ird.observe.client.util.init.DefaultUIInitializerResult; import fr.ird.observe.client.util.init.UIInitHelper; +import fr.ird.observe.client.util.treetable.JaxxComboBoxCellEditor; import fr.ird.observe.dto.data.ll.observation.BranchlineDto; import fr.ird.observe.dto.data.ll.observation.SectionTemplateDto; import fr.ird.observe.dto.decoration.DecoratorService; import io.ultreia.java4all.jaxx.widgets.choice.BeanCheckBox; -import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor; -import org.nuiton.decorator.Decorator; +import org.nuiton.decorator.MultiJXPathDecorator; import org.nuiton.jaxx.widgets.number.NumberCellEditor; import javax.swing.AbstractAction; -import javax.swing.JComboBox; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.table.TableCellRenderer; @@ -121,6 +120,7 @@ public class SetDetailCompositionUIInitializer extends ContentSimpleUIInitialize protected void initSections(SectionTableModel tableModel) { JTable table = ui.getSectionsTable(); + table.setRowHeight(22); UIHelper.setI18nTableHeaderRenderer(table, n("observe.data.ll.observation.Section.settingIdentifier"), n("observe.data.ll.observation.Section.settingIdentifier"), @@ -137,10 +137,9 @@ public class SetDetailCompositionUIInitializer extends ContentSimpleUIInitialize UIHelper.setTableColumnEditor(table, 1, NumberCellEditor.newIntegerColumnEditor()); DecoratorService decoratorService = ui.getHandler().getDecoratorService(); - Decorator<SectionTemplateDto> sectionTemplateDecorator = decoratorService.getDecoratorByType(SectionTemplateDto.class); - JComboBox<SectionTemplateDto> comboBox = new JComboBox<>(); - table.putClientProperty(SetDetailCompositionUIHandler.SECTION_TEMPLATES_EDITOR, comboBox); - ComboBoxCellEditor editor = UIHelper.newDataColumnEditor(comboBox, Collections.emptyList(), sectionTemplateDecorator); + MultiJXPathDecorator<SectionTemplateDto> sectionTemplateDecorator = (MultiJXPathDecorator<SectionTemplateDto>) decoratorService.getDecoratorByType(SectionTemplateDto.class); + JaxxComboBoxCellEditor editor = UIHelper.newDataColumnEditor(Collections.emptyList(), sectionTemplateDecorator); + table.putClientProperty(SetDetailCompositionUIHandler.SECTION_TEMPLATES_EDITOR, editor.getComponent()); UIHelper.setTableColumnEditor(table, 2, editor); tableModel.installTableKeyListener(table); ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripGearUseFeaturesUIHandler.java ===================================== @@ -77,6 +77,7 @@ public class TripGearUseFeaturesUIHandler extends GeneratedTripGearUseFeaturesUI { // init measurements table JTable table = ui.getMeasurementsTable(); + table.setRowHeight(22); UIHelper.setI18nTableHeaderRenderer(table, n("observe.data.common.GearUseFeatures.gearCharacteristic.short"), n("observe.data.common.GearUseFeatures.gearCharacteristic"), ===================================== pom.xml ===================================== @@ -151,7 +151,7 @@ <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format> <buildDate>${maven.build.timestamp}</buildDate> - <toolkit.version>5.0.8</toolkit.version> + <toolkit.version>5.0.9</toolkit.version> <lib.version.ognl>3.1.28</lib.version.ognl> <!--can't use 1.4.197 (date has changed + blob also)--> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/9d65cd9dc22d878d9c6d3cfe… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/9d65cd9dc22d878d9c6d3cfe… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 5 commits: Réusinage de la configuration d'une source de données et des templates associées - Closes #1797
by Tony CHEMIT 12 Mar '21

12 Mar '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 58b30886 by Tony Chemit at 2021-03-12T13:16:40+01:00 Réusinage de la configuration d&#39;une source de données et des templates associées - Closes #1797 - - - - - b564c86a by Tony Chemit at 2021-03-12T13:16:40+01:00 Bloquer l&#39;import d&#39;une marée si elle contient des identifiants déjà utilisés dans la base cible - Closes #1799 - - - - - 384b1d11 by Tony Chemit at 2021-03-12T13:16:40+01:00 Update jaxx - - - - - a5cef205 by Tony Chemit at 2021-03-12T13:16:40+01:00 Fix LL Paring admin action - - - - - 9d65cd9d by Tony Chemit at 2021-03-12T13:16:40+01:00 Simplify admin actions menu: no more any generated menu ui, just declare them while installing the body content - - - - - 27 changed files: - client/core/src/main/java/fr/ird/observe/client/util/treetable/JaxxComboBoxCellEditor.java - client/datasource/actions/src/main/i18n/getters/java.getter - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminUIBodyContent.java - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchAdminActionSupport.java → client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/actions/LaunchAdminAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/AdminUIMenu.jaxx - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/AdminUIMenu.jcss - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/AdminUIMenuActionSupport.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchActivityLlPairingAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchConsolidateAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchDataSynchronizeAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchExportDataAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchReferentialSynchronizeAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchReportAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchSynchronizeAction.java - − client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchValidateAction.java - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/ActivityLlPairingTreeTable.java - client/datasource/api/src/main/i18n/templates/InitStorageModel_en_GB.ftl - client/datasource/api/src/main/i18n/templates/InitStorageModel_es_ES.ftl - client/datasource/api/src/main/i18n/templates/InitStorageModel_fr_FR.ftl - client/datasource/api/src/main/java/fr/ird/observe/client/datasource/h2/backup/InitStorageModel.java → client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/h2/backup/InitStorageModel.java - client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/h2/server/H2ServerUI.jaxx - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorHelper.java - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/DataSourceEditorMenu.jcss - models/dto/java/pom.xml - models/dto/java/src/main/java/fr/ird/observe/dto/data/ll/pairing/ActivityPairingResultItem.java - pom.xml - services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocalSupport.java Changes: ===================================== client/core/src/main/java/fr/ird/observe/client/util/treetable/JaxxComboBoxCellEditor.java ===================================== @@ -22,17 +22,16 @@ package fr.ird.observe.client.util.treetable; * #L% */ -import fr.ird.observe.client.util.UIHelper; +import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper; import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox; import org.nuiton.decorator.MultiJXPathDecorator; import javax.swing.DefaultCellEditor; import javax.swing.JComboBox; import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.MouseEvent; import java.util.Collections; -import java.util.EventObject; + +import static io.ultreia.java4all.i18n.I18n.t; /** * Created by tchemit on 20/11/2018. @@ -41,12 +40,24 @@ import java.util.EventObject; */ public class JaxxComboBoxCellEditor extends DefaultCellEditor { + public static <B> JaxxComboBoxCellEditor newEditor(Class<B> dataType, MultiJXPathDecorator<B> decorator) { + JaxxComboBox<B> editor = new JaxxComboBox<>(); + editor.setI18nPrefix("observe.common."); + String entityLabel = ObserveI18nDecoratorHelper.getType(dataType); + editor.setPopupTitleText(t("observe.data.Data.type", entityLabel)); + editor.setBeanType(dataType); + editor.setMinimumSize(new Dimension(0, 24)); + editor.getConfig().setFilterable(false); + editor.getConfig().setTabToSelect(false); + editor.init(decorator, Collections.emptyList()); + return new JaxxComboBoxCellEditor(editor); + } + @SuppressWarnings("rawtypes") public JaxxComboBoxCellEditor(JaxxComboBox editor) { super(editor.getCombobox()); this.editorComponent = editor; JComboBox comboBox = editor.getCombobox(); - comboBox.setFocusable(false); editorComponent.setOpaque(false); comboBox.removeActionListener(this.delegate); @@ -55,6 +66,7 @@ public class JaxxComboBoxCellEditor extends DefaultCellEditor { @Override public void setValue(Object value) { editor.setSelectedItem(value); + super.setValue(value); } @Override @@ -62,39 +74,22 @@ public class JaxxComboBoxCellEditor extends DefaultCellEditor { return editor.getModel().getSelectedItem(); } - @Override - public boolean shouldSelectCell(EventObject anEvent) { - if (anEvent instanceof MouseEvent) { - MouseEvent e = (MouseEvent) anEvent; - return e.getID() != MouseEvent.MOUSE_DRAGGED; - } - return true; - } - + @SuppressWarnings("unchecked") @Override public boolean stopCellEditing() { if (comboBox.isEditable()) { - // Commit edited value. - comboBox.actionPerformed(new ActionEvent(JaxxComboBoxCellEditor.this, 0, "")); + Object cellEditorValue = getCellEditorValue(); + if (cellEditorValue != null && !editor.getConfig().getBeanType().isAssignableFrom(cellEditorValue.getClass())) { + setValue(null); + } } return super.stopCellEditing(); } - - @Override - public void actionPerformed(ActionEvent e) { - JaxxComboBoxCellEditor.this.stopCellEditing(); - } }; comboBox.addActionListener(this.delegate); } - public static <B> JaxxComboBoxCellEditor newEditor(Class<B> dataType, MultiJXPathDecorator<B> decorator) { - JaxxComboBox<B> editor = UIHelper.newJaxxComboBox(dataType, decorator, Collections.emptyList()); - editor.setMinimumSize(new Dimension(0, 24)); - return new JaxxComboBoxCellEditor(editor); - } - @Override public JaxxComboBox<?> getComponent() { return (JaxxComboBox<?>) super.getComponent(); ===================================== client/datasource/actions/src/main/i18n/getters/java.getter ===================================== @@ -186,6 +186,7 @@ observe.ui.datasource.storage.config.referentiel.storage observe.ui.datasource.storage.config.right.storage observe.ui.datasource.storage.config.source.storage observe.ui.datasource.storage.step.label +observe.ui.menu.actions observe.ui.message.no.report.selected observe.ui.message.select.report observe.ui.title.choose.db.dump.directory ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminUIBodyContent.java ===================================== @@ -24,7 +24,7 @@ package fr.ird.observe.client.datasource.actions; import com.google.auto.service.AutoService; import fr.ird.observe.client.WithClientUIContext; -import fr.ird.observe.client.datasource.actions.menu.AdminUIMenu; +import fr.ird.observe.client.datasource.actions.actions.LaunchAdminAction; import fr.ird.observe.client.datasource.api.ObserveSwingDataSource; import fr.ird.observe.client.datasource.editor.api.DataSourceEditor; import fr.ird.observe.client.datasource.editor.api.DataSourceEditorBodyContent; @@ -35,6 +35,7 @@ import fr.ird.observe.client.main.body.NoBodyContentComponent; import fr.ird.observe.client.util.UIHelper; import fr.ird.observe.dto.ObserveUtil; import fr.ird.observe.dto.db.configuration.ObserveDataSourceConfiguration; +import io.ultreia.java4all.i18n.I18n; import io.ultreia.java4all.util.SingletonSupplier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -42,7 +43,9 @@ import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.jaxx.runtime.context.JAXXContextEntryDef; import org.nuiton.jaxx.runtime.context.JAXXInitialContext; +import javax.swing.JMenu; import javax.swing.JMenuBar; +import javax.swing.JMenuItem; import javax.swing.SwingUtilities; import java.util.Objects; import java.util.function.Supplier; @@ -72,11 +75,29 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi @Override public void install(ObserveMainUI mainUI) { super.install(mainUI); - AdminUIMenu menu = new AdminUIMenu(UIHelper.initialContext(mainUI, mainUI.getModel())); + JMenu menu = new JMenu(I18n.t("observe.ui.menu.actions")); + menu.setMnemonic('A'); + addMenuAction(mainUI, menu, AdminStep.SYNCHRONIZE); + addMenuAction(mainUI, menu, AdminStep.REFERENTIAL_SYNCHRONIZE); + menu.addSeparator(); + addMenuAction(mainUI, menu, AdminStep.EXPORT_DATA); + addMenuAction(mainUI, menu, AdminStep.DATA_SYNCHRONIZE); + menu.addSeparator(); + addMenuAction(mainUI, menu, AdminStep.CONSOLIDATE); + addMenuAction(mainUI, menu, AdminStep.ACTIVITY_LL_PAIRING); + addMenuAction(mainUI, menu, AdminStep.VALIDATE); + addMenuAction(mainUI, menu, AdminStep.REPORT); JMenuBar menuBar = mainUI.getMenu(); menuBar.add(menu, 2); } + protected void addMenuAction(ObserveMainUI mainUI, JMenu menu, AdminStep step) { + LaunchAdminAction action = new LaunchAdminAction(step); + JMenuItem menuItem = new JMenuItem(); + LaunchAdminAction.init(mainUI, menuItem, action); + menu.add(menuItem); + } + @Override public void show(ObserveMainUI mainUI) { super.show(mainUI); @@ -102,12 +123,7 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi AdminUI ui = get(); AdminUIModel model = ui.getModel(); - -// ConfigModel.doCloseSource(model.getConfigModel().getRightSourceModel().getSource()); -// ConfigModel.doCloseSource(model.getConfigModel().getLeftSourceModel().getSource()); - model.destroy(); - ui.destroy(); ui.dispose(); @@ -135,7 +151,6 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi AdminStep adminStep = mainUI.getContextValue(AdminStep.class); AdminUIModel model = new AdminUIModel(Objects.requireNonNull(adminStep)); JAXXInitialContext uiContext = UIHelper.initialContext(mainUI, model); - //FIXME:BodyContent Review jaxx to remove this... // apply action uiContext.add(APPLY_DEF, () -> { @@ -150,30 +165,23 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi } private void doClose(boolean wasCanceled) { - log.info(this + ", was canceled ? " + wasCanceled); - + log.info(String.format("%s, was canceled ? %s", this, wasCanceled)); AdminUI ui = get(); AdminUIModel model = ui.getModel(); - ObserveSwingDataSource.doCloseSource(model.getConfigModel().getRightSourceModel().getSource()); ObserveSwingDataSource.doCloseSource(model.getConfigModel().getLeftSourceModel().getSource()); - ObserveMainUI mainUI = getClientUIContext().getMainUI(); - ObserveDataSourceConfiguration sourceConfiguration = model.getConfigModel().getPreviousSourceConfiguration(); if (sourceConfiguration == null) { // no previous data source mainUI.changeBodyContent(NoBodyContentComponent.class); return; } - // reopen data source ObserveSwingDataSource source = getClientUIContext().getDataSourcesManager().newDataSource(sourceConfiguration); // attach it to ui DataSourceEditorBodyContent dataSourceEditorBodyContent = mainUI.getMainUIBodyContentManager().getBodyTyped(DataSourceEditor.class, DataSourceEditorBodyContent.class); // load it dataSourceEditorBodyContent.loadStorage(mainUI, source); - } - } ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchAdminActionSupport.java → client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/actions/LaunchAdminAction.java ===================================== @@ -1,4 +1,4 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; +package fr.ird.observe.client.datasource.actions.actions; /* * #%L @@ -24,8 +24,8 @@ package fr.ird.observe.client.datasource.actions.menu.actions; import fr.ird.observe.client.datasource.actions.AdminStep; import fr.ird.observe.client.datasource.actions.AdminUI; -import fr.ird.observe.client.datasource.actions.menu.AdminUIMenu; import fr.ird.observe.client.main.ObserveMainUI; +import fr.ird.observe.client.main.actions.MainUIActionSupport; import fr.ird.observe.dto.I18nEnumHelper; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -41,13 +41,13 @@ import static io.ultreia.java4all.i18n.I18n.t; * @author Tony Chemit - dev(a)tchemit.fr * @since 3.13 */ -public abstract class LaunchAdminActionSupport extends AdminUIMenuActionSupport { +public class LaunchAdminAction extends MainUIActionSupport { - private static final Logger log = LogManager.getLogger(LaunchAdminActionSupport.class); + private static final Logger log = LogManager.getLogger(LaunchAdminAction.class); private final AdminStep action; - LaunchAdminActionSupport(AdminStep action) { + public LaunchAdminAction(AdminStep action) { super(t(Objects.requireNonNull(action).getOperationLabel()), t(action.getOperationDescription()), action.getIconName(), action.getMnemonic()); this.action = action; } @@ -63,15 +63,13 @@ public abstract class LaunchAdminActionSupport extends AdminUIMenuActionSupport // } @Override - protected void doActionPerformed(ActionEvent e, AdminUIMenu ui) { + protected void doActionPerformed(ActionEvent e, ObserveMainUI ui) { log.info(String.format("Will start admin action: %s", I18nEnumHelper.getLabel(action))); - ObserveMainUI mainUI = getClientUIContext().getMainUI(); - mainUI.setContextValue(action); + ui.setContextValue(action); try { - mainUI.changeBodyContent(AdminUI.class); + ui.changeBodyContent(AdminUI.class); } finally { - mainUI.removeContextValue(AdminStep.class); + ui.removeContextValue(AdminStep.class); } } - } ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/AdminUIMenu.jaxx deleted ===================================== @@ -1,38 +0,0 @@ -<!-- - #%L - ObServe Client :: DataSource :: Actions - %% - Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - You should have received a copy of the GNU General Public - License along with this program. If not, see - <http://www.gnu.org/licenses/gpl-3.0.html>. - #L% - --> -<JMenu id='menuActions'> - - <import> - fr.ird.observe.client.main.MainUIModel - </import> - - <MainUIModel id="uiModel" initializer="getContextValue(MainUIModel.class)"/> - - <JMenuItem id='launchSynchronizeAction'/> - <JMenuItem id='launchReferentialSynchronizeAction'/> - <JSeparator/> - <JMenuItem id='launchExportDataAction'/> - <JMenuItem id='launchDataSynchronizeAction'/> - <JSeparator/> - <JMenuItem id='launchConsolidateAction'/> - <JMenuItem id='launchActivityLonglinePairingAction'/> - <JMenuItem id='launchValidateAction'/> - <JMenuItem id='launchReportAction'/> -</JMenu> ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/AdminUIMenu.jcss deleted ===================================== @@ -1,26 +0,0 @@ -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -#menuActions { - text: "observe.ui.menu.actions"; - mnemonic: A; - enabled: {uiModel.isActionsEnabled()}; -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/AdminUIMenuActionSupport.java deleted ===================================== @@ -1,52 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.WithClientUIContext; -import fr.ird.observe.client.datasource.actions.menu.AdminUIMenu; -import org.nuiton.jaxx.runtime.swing.action.JComponentActionSupport; - -import javax.swing.KeyStroke; - -/** - * @author Tony Chemit - dev(a)tchemit.fr - * @since ? - */ -public abstract class AdminUIMenuActionSupport extends JComponentActionSupport<AdminUIMenu> implements WithClientUIContext { - - protected AdminUIMenuActionSupport(String label, String shortDescription, String actionIcon, KeyStroke acceleratorKey) { - super(label, shortDescription, actionIcon, acceleratorKey); - } - - protected AdminUIMenuActionSupport(String actionCommandKey, String label, String shortDescription, String actionIcon, KeyStroke acceleratorKey) { - super(actionCommandKey, label, shortDescription, actionIcon, acceleratorKey); - } - - protected AdminUIMenuActionSupport(String label, String shortDescription, String actionIcon, char acceleratorKey) { - super(label, shortDescription, actionIcon, acceleratorKey); - } - - protected AdminUIMenuActionSupport(String actionCommandKey, String label, String shortDescription, String actionIcon, char acceleratorKey) { - super(actionCommandKey, label, shortDescription, actionIcon, acceleratorKey); - } -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchActivityLlPairingAction.java deleted ===================================== @@ -1,38 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created by tchemit on 20/11/2018. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class LaunchActivityLlPairingAction extends LaunchAdminActionSupport { - - public LaunchActivityLlPairingAction() { - super(AdminStep.ACTIVITY_LL_PAIRING); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchConsolidateAction.java deleted ===================================== @@ -1,39 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created on 05/12/16. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 6.0 - */ -public class LaunchConsolidateAction extends LaunchAdminActionSupport { - - public LaunchConsolidateAction() { - super(AdminStep.CONSOLIDATE); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchDataSynchronizeAction.java deleted ===================================== @@ -1,39 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created on 05/12/16. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 6.0 - */ -public class LaunchDataSynchronizeAction extends LaunchAdminActionSupport { - - public LaunchDataSynchronizeAction() { - super(AdminStep.DATA_SYNCHRONIZE); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchExportDataAction.java deleted ===================================== @@ -1,39 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created on 05/12/16. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 6.0 - */ -public class LaunchExportDataAction extends LaunchAdminActionSupport { - - public LaunchExportDataAction() { - super(AdminStep.EXPORT_DATA); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchReferentialSynchronizeAction.java deleted ===================================== @@ -1,39 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created on 05/12/16. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 6.0 - */ -public class LaunchReferentialSynchronizeAction extends LaunchAdminActionSupport { - - public LaunchReferentialSynchronizeAction() { - super(AdminStep.REFERENTIAL_SYNCHRONIZE); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchReportAction.java deleted ===================================== @@ -1,39 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created on 05/12/16. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 6.0 - */ -public class LaunchReportAction extends LaunchAdminActionSupport { - - public LaunchReportAction() { - super(AdminStep.REPORT); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchSynchronizeAction.java deleted ===================================== @@ -1,39 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created on 05/12/16. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 6.0 - */ -public class LaunchSynchronizeAction extends LaunchAdminActionSupport { - - public LaunchSynchronizeAction() { - super(AdminStep.SYNCHRONIZE); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/menu/actions/LaunchValidateAction.java deleted ===================================== @@ -1,39 +0,0 @@ -package fr.ird.observe.client.datasource.actions.menu.actions; - -/*- - * #%L - * ObServe Client :: DataSource :: Actions - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.client.datasource.actions.AdminStep; - -/** - * Created on 05/12/16. - * - * @author Tony Chemit - dev(a)tchemit.fr - * @since 6.0 - */ -public class LaunchValidateAction extends LaunchAdminActionSupport { - - public LaunchValidateAction() { - super(AdminStep.VALIDATE); - } - -} ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/pairing/ll/tree/ActivityLlPairingTreeTable.java ===================================== @@ -34,7 +34,6 @@ import fr.ird.observe.client.datasource.actions.pairing.ll.tree.node.ActivityLlP import fr.ird.observe.client.datasource.actions.pairing.tree.node.ActivityPairingNodeSupport; import fr.ird.observe.client.datasource.actions.pairing.tree.node.ActivityPairingProgramNode; import fr.ird.observe.client.util.DtoIconHelper; -import fr.ird.observe.client.util.UIHelper; import fr.ird.observe.client.util.treetable.JaxxComboBoxCellEditor; import fr.ird.observe.dto.data.ll.common.TripDto; import fr.ird.observe.dto.data.ll.common.TripReference; @@ -76,92 +75,6 @@ import java.util.function.Supplier; */ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClientConfig, WithClientUIContext { - public ActivityLlPairingTreeTable(ActivityLlPairingTreeTableModel treeModel) { - super(treeModel); - setTreeCellRenderer(new ActivityLlPairingTreeTableTreeCellRenderer(getClientUIContext().getDecoratorService())); - setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - setCellSelectionEnabled(true); - setRootVisible(false); - setRowHeight(26); - getTableHeader().setReorderingAllowed(false); - } - - @Override - public ActivityLlPairingTreeTableModel getTreeTableModel() { - return (ActivityLlPairingTreeTableModel) super.getTreeTableModel(); - } - - public void openTable(ActivityLlPairingRootNode rootNode) { - - getTreeTableModel().setRoot(rootNode); - - expandAll(); - - // auto expand nodes when selected - addTreeSelectionListener(e -> { - int selectedRow = getSelectedRow(); - if (selectedRow != -1) { - if (!isExpanded(selectedRow)) { - SwingUtilities.invokeLater(() -> expandRow(selectedRow)); - } - } - }); - } - - public void initTable(ActivityLlPairingModel model, Supplier<Integer> width) { - - setColumnFactory(new ColumnFactory() { - - @Override - public void configureColumnWidths(JXTable table, TableColumnExt columnExt) { - if (table.getColumn(0).equals(columnExt)) { - columnExt.setPreferredWidth(width.get()); - columnExt.setMinWidth(columnExt.getPreferredWidth()); - return; - } - if (table.getColumn(1).equals(columnExt)) { - columnExt.setPreferredWidth(width.get()); - columnExt.setMinWidth(columnExt.getPreferredWidth()); - return; - } - if (table.getColumn(2).equals(columnExt)) { - columnExt.setPreferredWidth(50); - columnExt.setMinWidth(50); - return; - } - super.configureColumnWidths(table, columnExt); - columnExt.setMinWidth(columnExt.getPreferredWidth()); - } - }); - getTreeTableModel().addTreeModelListener(new TreeModelListener() { - @Override - public void treeNodesChanged(TreeModelEvent e) { - - model.recomputeSelectedValues(); - } - - @Override - public void treeNodesInserted(TreeModelEvent e) { - - } - - @Override - public void treeNodesRemoved(TreeModelEvent e) { - - } - - @Override - public void treeStructureChanged(TreeModelEvent e) { - - } - - }); - DecoratorService decoratorService = getClientUIContext().getDecoratorService(); - setDefaultRenderer(Object.class, new ActivityLlPairingTreeTableCellRenderer(this, getClientConfig(), decoratorService)); - setDefaultEditor(Object.class, new ActivityLlPairingTreeTableCellEditor(this, getClientConfig(), decoratorService)); - - } - static class ActivityLlPairingTreeTableCellRenderer implements TableCellRenderer { // Render booleans (inclusive) @@ -251,6 +164,91 @@ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClien } } + public ActivityLlPairingTreeTable(ActivityLlPairingTreeTableModel treeModel) { + super(treeModel); + setTreeCellRenderer(new ActivityLlPairingTreeTableTreeCellRenderer(getClientUIContext().getDecoratorService())); + setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + setCellSelectionEnabled(true); + setRootVisible(false); + setRowHeight(26); + getTableHeader().setReorderingAllowed(false); + } + + @Override + public ActivityLlPairingTreeTableModel getTreeTableModel() { + return (ActivityLlPairingTreeTableModel) super.getTreeTableModel(); + } + + public void openTable(ActivityLlPairingRootNode rootNode) { + + getTreeTableModel().setRoot(rootNode); + + expandAll(); + + // auto expand nodes when selected + addTreeSelectionListener(e -> { + int selectedRow = getSelectedRow(); + if (selectedRow != -1) { + if (!isExpanded(selectedRow)) { + SwingUtilities.invokeLater(() -> expandRow(selectedRow)); + } + } + }); + } + + public void initTable(ActivityLlPairingModel model, Supplier<Integer> width) { + + setColumnFactory(new ColumnFactory() { + + @Override + public void configureColumnWidths(JXTable table, TableColumnExt columnExt) { + if (table.getColumn(0).equals(columnExt)) { + columnExt.setPreferredWidth(width.get()); + columnExt.setMinWidth(columnExt.getPreferredWidth()); + return; + } + if (table.getColumn(1).equals(columnExt)) { + columnExt.setPreferredWidth(width.get()); + columnExt.setMinWidth(columnExt.getPreferredWidth()); + return; + } + if (table.getColumn(2).equals(columnExt)) { + columnExt.setPreferredWidth(50); + columnExt.setMinWidth(50); + return; + } + super.configureColumnWidths(table, columnExt); + columnExt.setMinWidth(columnExt.getPreferredWidth()); + } + }); + getTreeTableModel().addTreeModelListener(new TreeModelListener() { + @Override + public void treeNodesChanged(TreeModelEvent e) { + + model.recomputeSelectedValues(); + } + + @Override + public void treeNodesInserted(TreeModelEvent e) { + + } + + @Override + public void treeNodesRemoved(TreeModelEvent e) { + + } + + @Override + public void treeStructureChanged(TreeModelEvent e) { + + } + + }); + DecoratorService decoratorService = getClientUIContext().getDecoratorService(); + setDefaultRenderer(Object.class, new ActivityLlPairingTreeTableCellRenderer(this, getClientConfig(), decoratorService)); + setDefaultEditor(Object.class, new ActivityLlPairingTreeTableCellEditor(this, getClientConfig(), decoratorService)); + } + class ActivityLlPairingTreeTableCellEditor implements TableCellEditor { private final TableCellEditor booleanEditor; @@ -276,14 +274,15 @@ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClien Objects.requireNonNull(node); if (column == 1) { if (node instanceof ActivityLlPairingActivityNode) { - JaxxComboBox<?> component = pairingEditor.getComponent(); + @SuppressWarnings("unchecked") JaxxComboBox<ActivityPairingResultItem> component = (JaxxComboBox<ActivityPairingResultItem>) pairingEditor.getComponent(); ActivityLlPairingActivityNode activityLlPairingActivityNode = (ActivityLlPairingActivityNode) node; ImmutableList<ActivityPairingResultItem> availableActivities = getTreeTableModel().getAvailableActivities(activityLlPairingActivityNode); ActivityPairingResultItem selectedValue = activityLlPairingActivityNode.getSelectedValue(); if (!availableActivities.contains(selectedValue)) { selectedValue = null; } - UIHelper.fillComboBox(component.getCombobox(), availableActivities, selectedValue); + component.setData(availableActivities); + component.setSelectedItem(selectedValue); editor = pairingEditor; } } else if (column == 2) { ===================================== client/datasource/api/src/main/i18n/templates/InitStorageModel_en_GB.ftl ===================================== @@ -1,4 +1,4 @@ -<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.h2.backup.InitStorageModel" --> +<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel" --> <#-- #%L ObServe Client :: Core ===================================== client/datasource/api/src/main/i18n/templates/InitStorageModel_es_ES.ftl ===================================== @@ -1,4 +1,4 @@ -<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.h2.backup.InitStorageModel" --> +<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel" --> <#-- #%L ObServe Client :: Core ===================================== client/datasource/api/src/main/i18n/templates/InitStorageModel_fr_FR.ftl ===================================== @@ -1,4 +1,4 @@ -<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.h2.backup.InitStorageModel" --> +<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel" --> <#-- #%L ObServe Client :: Core ===================================== client/datasource/api/src/main/java/fr/ird/observe/client/datasource/h2/backup/InitStorageModel.java → client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/h2/backup/InitStorageModel.java ===================================== @@ -1,4 +1,4 @@ -package fr.ird.observe.client.datasource.h2.backup; +package fr.ird.observe.client.datasource.api.h2.backup; /*- * #%L @@ -22,6 +22,7 @@ package fr.ird.observe.client.datasource.h2.backup; * #L% */ +import fr.ird.observe.client.datasource.h2.backup.BackupStorage; import io.ultreia.java4all.application.template.spi.GenerateTemplate; import java.io.File; ===================================== client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/h2/server/H2ServerUI.jaxx ===================================== @@ -58,10 +58,8 @@ <JPanel constraints='BorderLayout.CENTER' layout='{new GridLayout(0,1)}'> <JButton id="stopServerMode"/> - <JSeparator/> <JButton id="startH2WebServer"/> <JButton id="stopH2WebServer"/> - </JPanel> </JPanel> ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorHelper.java ===================================== @@ -28,8 +28,8 @@ import fr.ird.observe.client.datasource.api.ObserveDataSourcesManager; import fr.ird.observe.client.datasource.api.ObserveSwingDataSource; import fr.ird.observe.client.datasource.h2.backup.BackupStorage; import fr.ird.observe.client.datasource.h2.backup.BackupsManager; -import fr.ird.observe.client.datasource.h2.backup.InitStorageModel; -import fr.ird.observe.client.datasource.h2.backup.InitStorageModelTemplate; +import fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel; +import fr.ird.observe.client.datasource.api.h2.backup.InitStorageModelTemplate; import fr.ird.observe.client.main.ObserveMainUI; import fr.ird.observe.client.util.ObserveSwingTechnicalException; import fr.ird.observe.dto.db.configuration.DataSourceConnectMode; ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/DataSourceEditorMenu.jcss ===================================== @@ -36,6 +36,10 @@ JToolBar { enabled: {uiModel.isStorageReloadEnabled()}; } +#showStorageInfo { + enabled: {uiModel.isStorageCloseEnabled()}; +} + #closeStorage { enabled: {uiModel.isStorageCloseEnabled()}; } ===================================== models/dto/java/pom.xml ===================================== @@ -81,6 +81,11 @@ <artifactId>http-api</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>io.ultreia.java4all.jaxx</groupId> + <artifactId>jaxx-runtime-spi</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>io.ultreia.java4all.i18n</groupId> <artifactId>i18n-runtime</artifactId> ===================================== models/dto/java/src/main/java/fr/ird/observe/dto/data/ll/pairing/ActivityPairingResultItem.java ===================================== @@ -26,6 +26,8 @@ import fr.ird.observe.dto.SimpleDto; import fr.ird.observe.dto.data.ActivityAware; import fr.ird.observe.dto.data.ll.observation.ActivityReference; import io.ultreia.java4all.lang.Numbers; +import org.nuiton.decorator.Decorator; +import org.nuiton.jaxx.runtime.bean.BeanDecoratorAware; import java.util.Date; import java.util.Objects; @@ -38,11 +40,12 @@ import static io.ultreia.java4all.i18n.I18n.t; * * @author Tony Chemit - dev(a)tchemit.fr */ -public class ActivityPairingResultItem implements SimpleDto { +public class ActivityPairingResultItem implements SimpleDto, BeanDecoratorAware { private final ActivityReference observationActivity; private final long computedTime; private final float computedDistance; + protected transient Decorator<?> decorator; private String computedTimeStr; public static ActivityPairingResultItem create(ActivityAware activityLogbook, ActivityReference activityObsReference) { @@ -59,6 +62,16 @@ public class ActivityPairingResultItem implements SimpleDto { this.computedDistance = Numbers.roundTwoDigits((float) computedDistance); } + @Override + public Decorator<?> decorator() { + return decorator; + } + + @Override + public void registerDecorator(Decorator<?> decorator) { + this.decorator = Objects.requireNonNull(decorator); + } + public ActivityReference getObservationActivity() { return observationActivity; } @@ -102,4 +115,14 @@ public class ActivityPairingResultItem implements SimpleDto { public int hashCode() { return Objects.hash(observationActivity); } + + @Override + public String toString() { + if (decorator == null) { + return super.toString(); + } + return decorate(); + } + + } ===================================== pom.xml ===================================== @@ -161,7 +161,7 @@ <!-- <lib.version.java4all.topia>1.43</lib.version.java4all.topia>--> <!-- <lib.version.java4all.eugene>3.0-alpha-38</lib.version.java4all.eugene>--> - <lib.version.java4all.jaxx>3.0.0-RC-3-SNAPSHOT</lib.version.java4all.jaxx> + <lib.version.java4all.jaxx>3.0.0-RC-3</lib.version.java4all.jaxx> <!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>--> <!--<lib.version.java4all.application-template>1.0.2-SNAPSHOT</lib.version.java4all.application-template>--> <!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>--> ===================================== services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocalSupport.java ===================================== @@ -42,8 +42,10 @@ import org.apache.logging.log4j.Logger; import org.nuiton.topia.persistence.script.SqlScriptConsumer; import org.nuiton.topia.persistence.script.TopiaBlobsContainer; import org.nuiton.topia.persistence.script.TopiaSqlScript; +import org.nuiton.util.TimeLog; import org.nuiton.version.Version; +import java.util.Collections; import java.util.Set; import java.util.TreeSet; @@ -74,7 +76,7 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple String tripId = exportRequest.getTripId(); - log.info("Start export of trip: " + tripId); + log.info(String.format("Start export of trip: %s", tripId)); Version dbVersion = serviceContext.getServiceInitializer().optionalConnection().orElseThrow().getDataSourceInformation().getVersion(); AddSqlScriptProducerRequest request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres(dbVersion) : AddSqlScriptProducerRequest.forH2(dbVersion)) @@ -89,17 +91,14 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext(); - Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds()); - Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds()); - String tripId = request.getTripId(); long t0 = System.nanoTime(); - boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds); + boolean deleted = deleteTrip(persistenceContext, tripId, Collections.emptySet()); if (deleted) { long time = System.nanoTime() - t0; - log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(time)); + log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(time))); return new DeleteTripResult(request, time); } return null; @@ -110,24 +109,33 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext(); - Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds()); - Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds()); - String tripId = request.getTripId(); - long t0 = System.nanoTime(); + long t1 = TimeLog.getTime(); + TopiaSqlScript sqlContent = request.getSqlContent(); + // detect ids in import script + Set<String> ids = new TreeSet<>(); + for (String sqlStatement : sqlContent.getLocation()) { + if (sqlStatement.toLowerCase().trim().startsWith("insert into")) { + String id = sqlStatement.substring(sqlStatement.indexOf("VALUES") + 6); + id = id.substring(id.indexOf("'") + 1); + id = id.substring(0, id.indexOf("'")); + ids.add(id); + } + } + log.info(String.format("Found in trip: %s, %d ids to import in %s.", tripId, ids.size(), Strings.convertTime(t1, System.nanoTime()))); + t1 = System.nanoTime(); - boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds); - long t1 = System.nanoTime(); + boolean deleted = deleteTrip(persistenceContext, tripId, ids); long deleteTime = 0; if (deleted) { - deleteTime = System.nanoTime() - t0; - log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(deleteTime)); + deleteTime = System.nanoTime() - t1; + log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(deleteTime))); } + t1 = System.nanoTime(); - log.info("Start import of trip: " + request.getTripId()); + log.info(String.format("Start import of trip: %s", request.getTripId())); - TopiaSqlScript sqlContent = request.getSqlContent(); Set<TopiaBlobsContainer> blobsContainers = sqlContent.getBlobsContainers(); SqlScriptConsumer.Builder consumerBuilder = SqlScriptConsumer.builder(sqlContent.getLocation()).batchSize(1000); @@ -135,38 +143,42 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple consumerBuilder.blobs(blobsContainers); } persistenceContext.getSqlSupport().doSqlWork(consumerBuilder.build()); - - persistenceContext.commit(); + persistenceContext.flush(); long t2 = System.nanoTime(); - log.info("Import of trip: " + tripId + " done in " + Strings.convertTime(t1, t2)); + log.info(String.format("Import of trip: %s done in %s", tripId, Strings.convertTime(t1, t2))); return new ImportTripResult(request, true, t2 - t1, deleted, deleteTime); } - private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> tripSeineIds, Set<String> tripLonglineIds) { + private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> ids) { long t0 = System.nanoTime(); - boolean deleted = tripSeineIds.contains(tripId) || tripLonglineIds.contains(tripId); + boolean deleted = persistenceContext.exists(tripId); if (deleted) { - log.info("Start delete of trip: " + tripId); + log.info(String.format("Start delete of trip: %s", tripId)); DeleteSqlScriptProducerRequest sqlRequest = DeleteSqlScriptProducerRequest.of(tripId); TopiaSqlScript sqlScript = sqlScriptProducerService.produceDeleteSqlScript(sqlRequest); - //FIXME Make sure this always work!!! For the moment stay as before -// if (tripLonglineIds.contains(tripId) && serviceContext.getTopiaApplicationContext().getConfiguration().isH2Configuration()) { -// serviceContext.getTopiaApplicationContext().executeSqlStatementsWithH2AndRemoveIntegrity(persistenceContext, sqlScript); -// } else { -// persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript)); -// } persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript)); - log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(t0, System.nanoTime())); - persistenceContext.commit(); + log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(t0, System.nanoTime()))); + persistenceContext.flush(); + } + Set<String> existingIds = new TreeSet<>(); + if (!ids.isEmpty()) { + for (String id : ids) { + if (persistenceContext.exists(id)) { + log.error(String.format("Can't import trip %s, - found existing id in target database (%s)", tripId, id)); + existingIds.add(id); + } + } + } + if (!existingIds.isEmpty()) { + throw new IllegalStateException(String.format("Next %d id(s) are blocking the import of trip %s:\n%s", existingIds.size(), tripId, String.join("\n", existingIds))); } return deleted; } - } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/03a7237c020b47885877ea3f… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/03a7237c020b47885877ea3f… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 5 commits: Réusinage de la configuration d'une source de données et des templates associées - Closes #1797
by Tony CHEMIT 11 Mar '21

11 Mar '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: af76b2dc by Tony Chemit at 2021-03-11T10:51:24+01:00 Réusinage de la configuration d&#39;une source de données et des templates associées - Closes #1797 - - - - - d219d92e by Tony Chemit at 2021-03-11T10:51:24+01:00 Fix bad reports selection - - - - - c10c0313 by Tony Chemit at 2021-03-11T10:57:10+01:00 Réusinage de la configuration d&#39;une source de données et des templates associées - Closes #1797 - - - - - f1be0811 by Tony Chemit at 2021-03-11T12:15:05+01:00 Bloquer l&#39;import d&#39;une marée si elle contient des identifiants déjà utilisés dans la base cible - Closes #1799 - - - - - 03a7237c by Tony Chemit at 2021-03-11T15:19:13+01:00 Update jaxx - - - - - 27 changed files: - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java - client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_en_GB.ftl - client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_es_ES.ftl - client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_fr_FR.ftl - client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/ConfigSupport.jcss - client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/form/ConfigurationModel.java - client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/form/ServerConfigurationModel.java - client/datasource/api/src/test/java/fr/ird/observe/client/datasource/api/ObserveSwingDataSourceTest.java - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/DataSourceEditorMenu.jcss - pom.xml - − server/core/.mvn/i18n/parse-java - server/core/pom.xml - − server/core/src/main/i18n/getters/java.getter - server/core/src/main/java/fr/ird/observe/server/request/ObserveWebRequestContext.java - − server/core/src/main/java/fr/ird/observe/server/security/AdminApiKeyNotFoundException.java - − server/core/src/main/java/fr/ird/observe/server/security/AuthenticationTokenNotFoundException.java - − server/core/src/main/java/fr/ird/observe/server/security/BadObserveWebUserPasswordException.java - − server/core/src/main/java/fr/ird/observe/server/security/InvalidAdminKeyApiException.java - server/core/src/main/java/fr/ird/observe/server/security/ObserveWebSecurityApplicationContext.java - − server/core/src/main/java/fr/ird/observe/server/security/UnknownObserveWebUserException.java - − server/core/src/main/java/fr/ird/observe/server/security/UnknownObserveWebUserForDatabaseException.java - − server/core/src/main/java/fr/ird/observe/server/security/UserLoginNotFoundException.java - − server/core/src/main/java/fr/ird/observe/server/security/UserPasswordNotFoundException.java - server/i18n/src/main/i18n/translations/observe_en_GB.properties - server/i18n/src/main/i18n/translations/observe_es_ES.properties - server/i18n/src/main/i18n/translations/observe_fr_FR.properties - services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocalSupport.java Changes: ===================================== client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java ===================================== @@ -44,6 +44,7 @@ import java.nio.file.Files; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.TreeMap; import java.util.stream.Collectors; @@ -333,7 +334,7 @@ public class ReportModel extends AdminActionModel { if (reportFile == null) { return; } - reports = getAllReports().stream().filter(r -> modelType.toString() == r.getModelType()).collect(Collectors.toList()); + reports = getAllReports().stream().filter(r -> Objects.equals(modelType.toString(), r.getModelType())).collect(Collectors.toList()); firePropertyChange(REPORTS_PROPERTY_NAME, reports); log.info(String.format("Detects %d report(s).", reports.size() - 1)); } ===================================== client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_en_GB.ftl ===================================== @@ -20,11 +20,13 @@ --> <html> <body> -<#import "ObserveDataSourceConfiguration_en_GB.ftl" as configurationMacros> -<h3>${.data_model.label}</h3> -<@configurationMacros.dataSourceConfiguration .data_model.configuration /> -<#if .data_model.dataSourceInformation??> - <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation /> +<#if .data_model?? && .data_model.label??> + <#import "ObserveDataSourceConfiguration_en_GB.ftl" as configurationMacros> + <h3>${.data_model.label}</h3> + <@configurationMacros.dataSourceConfiguration .data_model.configuration /> + <#if .data_model.dataSourceInformation??> + <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation /> + </#if> <#else> No data source loaded </#if> ===================================== client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_es_ES.ftl ===================================== @@ -20,11 +20,13 @@ --> <html> <body> -<#import "ObserveDataSourceConfiguration_es_ES.ftl" as configurationMacros> -<h3>${.data_model.label}</h3> -<@configurationMacros.dataSourceConfiguration .data_model.configuration /> -<#if .data_model.dataSourceInformation??> - <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation /> +<#if .data_model?? && .data_model.label??> + <#import "ObserveDataSourceConfiguration_es_ES.ftl" as configurationMacros> + <h3>${.data_model.label}</h3> + <@configurationMacros.dataSourceConfiguration .data_model.configuration /> + <#if .data_model.dataSourceInformation??> + <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation /> + </#if> <#else> Ninguna fuente de datos cargada </#if> ===================================== client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_fr_FR.ftl ===================================== @@ -20,11 +20,13 @@ --> <html> <body> -<#import "ObserveDataSourceConfiguration_fr_FR.ftl" as configurationMacros> -<h3>${.data_model.label}</h3> -<@configurationMacros.dataSourceConfiguration .data_model.configuration /> -<#if .data_model.dataSourceInformation??> - <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation /> +<#if .data_model?? && .data_model.label??> + <#import "ObserveDataSourceConfiguration_fr_FR.ftl" as configurationMacros> + <h3>${.data_model.label}</h3> + <@configurationMacros.dataSourceConfiguration .data_model.configuration /> + <#if .data_model.dataSourceInformation??> + <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation /> + </#if> <#else> Aucune source de données chargée </#if> ===================================== client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/ConfigSupport.jcss ===================================== @@ -21,7 +21,7 @@ */ #testConnexion { - enabled:{!model.isConnexionSuccess()}; + enabled:{model.isSyntaxValid() && !model.isConnexionSuccess()}; } #saveConfiguration { ===================================== client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/form/ConfigurationModel.java ===================================== @@ -40,6 +40,8 @@ import org.nuiton.version.Versions; import javax.swing.Icon; import java.awt.Color; +import java.io.PrintWriter; +import java.io.StringWriter; import java.lang.reflect.UndeclaredThrowableException; import java.util.Objects; import java.util.function.Function; @@ -70,7 +72,6 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit public static final String CONNEXION_STATUS_ICON_PROPERTY_NAME = "connexionStatusIcon"; public static final String CONNEXION_STATUS_COLOR_PROPERTY_NAME = "connexionStatusColor"; public static final String CAN_CREATE_DATABASE_PROPERTY_NAME = "canCreateDatabase"; - public static final String BUSY_PROPERTY_NAME = "busy"; public static final String SYNTAX_VALID_PROPERTY_NAME = "syntaxValid"; /** @@ -109,11 +110,6 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit * Is configuration syntax is valid? */ private boolean syntaxValid; - - /** - * Is model busy? - */ - private boolean busy; /** * FIXME Add this in DataSourceConnectMode * Cache of colors indexed by connexion status. @@ -124,6 +120,8 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit this.configuration = Objects.requireNonNull(configuration); } + protected abstract boolean testSyntax(); + public void fromConfig(ObserveDataSourceConfiguration config) { String oldLabel = getLabel(); getConfiguration().setLabel(config == null ? null : config.getLabel()); @@ -135,45 +133,28 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit return configuration.getDataSourceType(); } - /** - * Use this as soon as the configuration has been modified. - */ - protected void clearStatus() { - setDataSourceInformation(null); - setConnexionError(null); - setConnexionStatus(ConnexionStatus.UNTESTED); - setSyntaxValid(false); - } - /** * @param dataSourceFunction to get new data source * @return {@code true} if connexion was tested and is valid. */ public final boolean testConnexion(Function<ObserveDataSourceConfiguration, ObserveSwingDataSource> dataSourceFunction) { clearStatus(); - setBusy(true); - boolean syntaxValid = testSyntax(); - setSyntaxValid(syntaxValid); - if (isConnexionFailed()) { + if (!isSyntaxValid() || isConnexionFailed()) { return false; } + ObserveSwingDataSource dataSource = dataSourceFunction.apply(getConfiguration()); try { - ObserveSwingDataSource dataSource = dataSourceFunction.apply(getConfiguration()); - try { - ObserveDataSourceInformation dataSourceInformation = test(dataSource); - testDataSourceInformation(dataSourceInformation); - if (!isConnexionFailed()) { - setConnexionStatus(ConnexionStatus.SUCCESS); - } - } catch (Throwable e) { - onConnexionError(e); - } finally { - if (dataSource.isOpen()) { - dataSource.close(); - } + ObserveDataSourceInformation dataSourceInformation = test(dataSource); + testDataSourceInformation(dataSourceInformation); + if (!isConnexionFailed()) { + setConnexionStatus(ConnexionStatus.SUCCESS); } + } catch (Throwable e) { + onConnexionError(e); } finally { - setBusy(false); + if (dataSource.isOpen()) { + dataSource.close(); + } } return isConnexionSuccess(); } @@ -183,8 +164,9 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit } public void setSyntaxValid(boolean syntaxValid) { + boolean oldValue = isSyntaxValid(); this.syntaxValid = syntaxValid; - firePropertyChange(SYNTAX_VALID_PROPERTY_NAME, syntaxValid); + firePropertyChange(SYNTAX_VALID_PROPERTY_NAME, oldValue, syntaxValid); } public boolean isConnexionSuccess() { @@ -199,20 +181,6 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit return getConnexionStatus() == ConnexionStatus.UNTESTED; } - protected abstract boolean testSyntax(); - - protected void onConnexionError(Throwable e) { - if (e instanceof UndeclaredThrowableException) { - e = ((UndeclaredThrowableException) e).getUndeclaredThrowable(); - } - setConnexionError(e); - setConnexionStatus(ConnexionStatus.FAILED); - } - - public ObserveDataSourceConfiguration getConfiguration() { - return configuration; - } - public String getLabel() { return getConfiguration().getLabel(); } @@ -239,7 +207,16 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit public String getConnexionStatusText() { if (connexionStatusText == null) { - this.connexionStatusText = ConfigurationModelTemplate.generate(this); + try { + this.connexionStatusText = ConfigurationModelTemplate.generate(this); + } catch (Exception e) { + StringWriter out = new StringWriter(4048); + try (PrintWriter writer = new PrintWriter(out)) { + e.printStackTrace(writer); + out.flush(); + } + connexionStatusText = out.toString(); + } } return connexionStatusText; } @@ -292,7 +269,7 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit Throwable oldValue = getConnexionError(); this.connexionError = connexionError; firePropertyChange(CONNEXION_ERROR_PROPERTY_NAME, oldValue, connexionError); - setConnexionStatusError(connexionError == null ? null : connexionError.getMessage()); + setConnexionStatusError(connexionError == null ? null : connexionError.getMessage()==null?connexionError.toString():connexionError.getMessage()); } public ObserveDataSourceInformation getDataSourceInformation() { @@ -318,14 +295,26 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit firePropertyChange(CAN_MIGRATE_PROPERTY_NAME, oldValue, canMigrate); } - public boolean isBusy() { - return busy; + /** + * Use this as soon as the configuration has been modified. + */ + protected void clearStatus() { + setDataSourceInformation(null); + setConnexionError(null); + setConnexionStatus(ConnexionStatus.UNTESTED); + setSyntaxValid(testSyntax()); } - public void setBusy(boolean busy) { - boolean oldValue = isBusy(); - this.busy = busy; - firePropertyChange(BUSY_PROPERTY_NAME, oldValue, busy); + protected void onConnexionError(Throwable e) { + if (e instanceof UndeclaredThrowableException) { + e = ((UndeclaredThrowableException) e).getUndeclaredThrowable(); + } + setConnexionError(e); + setConnexionStatus(ConnexionStatus.FAILED); + } + + public ObserveDataSourceConfiguration getConfiguration() { + return configuration; } protected final ObserveDataSourceInformation test(ObserveSwingDataSource dataSource) throws DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException { ===================================== client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/form/ServerConfigurationModel.java ===================================== @@ -43,7 +43,7 @@ import java.net.URL; public class ServerConfigurationModel extends ConfigurationModel { public static final String LOGIN_PROPERTY_NAME = "login"; public static final String SERVER_URL_PROPERTY_NAME = "serverUrl"; - public static final String OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME = "optionalServerDatabaseName"; + public static final String OPTIONAL_DATABASE_NAME_PROPERTY_NAME = "optionalDatabaseName"; private static final Logger log = LogManager.getLogger(ServerConfigurationModel.class); public ServerConfigurationModel() { @@ -63,7 +63,7 @@ public class ServerConfigurationModel extends ConfigurationModel { firePropertyChange(SERVER_URL_PROPERTY_NAME, oldServerUrl, getServerUrl()); firePropertyChange(LOGIN_PROPERTY_NAME, oldLogin, getLogin()); firePropertyChange(PASSWORD_PROPERTY_NAME, oldPassword, getPassword()); - firePropertyChange(OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName()); + firePropertyChange(OPTIONAL_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName()); } public void fromPreset(ServerDataSourceConfiguration configuration) { @@ -79,7 +79,7 @@ public class ServerConfigurationModel extends ConfigurationModel { firePropertyChange(SERVER_URL_PROPERTY_NAME, oldServerUrl, getServerUrl()); firePropertyChange(LOGIN_PROPERTY_NAME, oldLogin, getLogin()); firePropertyChange(PASSWORD_PROPERTY_NAME, oldPassword, getPassword()); - firePropertyChange(OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName()); + firePropertyChange(OPTIONAL_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName()); clearStatus(); } @@ -100,9 +100,8 @@ public class ServerConfigurationModel extends ConfigurationModel { @Override protected boolean testSyntax() { - String serverUrl = getConfiguration().getServerUrl(); - if (getServerUrl() == null || getLogin() != null || getPassword() == null) { + if (getServerUrl() == null || getLogin() == null || getPassword() == null) { return false; } try { @@ -110,6 +109,7 @@ public class ServerConfigurationModel extends ConfigurationModel { } catch (MalformedURLException e) { setConnexionStatusError(I18n.t("observe.ui.datasource.storage.error.badUrl", serverUrl)); setConnexionStatus(ConnexionStatus.FAILED); + return false; } return true; } @@ -154,7 +154,7 @@ public class ServerConfigurationModel extends ConfigurationModel { public void setOptionalDatabaseName(String optionalDatabaseName) { String oldValue = getOptionalDatabaseName(); getConfiguration().setOptionalDatabaseName(optionalDatabaseName); - firePropertyChange(OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME, oldValue, optionalDatabaseName); + firePropertyChange(OPTIONAL_DATABASE_NAME_PROPERTY_NAME, oldValue, optionalDatabaseName); clearStatus(); } ===================================== client/datasource/api/src/test/java/fr/ird/observe/client/datasource/api/ObserveSwingDataSourceTest.java ===================================== @@ -145,7 +145,9 @@ public class ObserveSwingDataSourceTest { } private void assertGenerate(ObserveSwingDataSource dataSource) { - String expected = ObserveSwingDataSourceTemplate.generate(dataSource); + String expected = ObserveSwingDataSourceTemplate.generate(null); + Assert.assertNotNull(expected); + expected = ObserveSwingDataSourceTemplate.generate(dataSource); String actual = dataSource.getSummaryText(); Assert.assertNotNull(expected); Assert.assertNotNull(actual); ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/DataSourceEditorMenu.jcss ===================================== @@ -36,6 +36,10 @@ JToolBar { enabled: {uiModel.isStorageReloadEnabled()}; } +#showStorageInfo { + enabled: {uiModel.isStorageCloseEnabled()}; +} + #closeStorage { enabled: {uiModel.isStorageCloseEnabled()}; } ===================================== pom.xml ===================================== @@ -151,7 +151,7 @@ <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format> <buildDate>${maven.build.timestamp}</buildDate> - <toolkit.version>5.0.7</toolkit.version> + <toolkit.version>5.0.8</toolkit.version> <lib.version.ognl>3.1.28</lib.version.ognl> <!--can't use 1.4.197 (date has changed + blob also)--> @@ -161,7 +161,7 @@ <!-- <lib.version.java4all.topia>1.43</lib.version.java4all.topia>--> <!-- <lib.version.java4all.eugene>3.0-alpha-38</lib.version.java4all.eugene>--> - <!-- <lib.version.java4all.jaxx>3.0.0-RC-2</lib.version.java4all.jaxx>--> + <lib.version.java4all.jaxx>3.0.0-RC-3</lib.version.java4all.jaxx> <!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>--> <!--<lib.version.java4all.application-template>1.0.2-SNAPSHOT</lib.version.java4all.application-template>--> <!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>--> ===================================== server/core/.mvn/i18n/parse-java deleted ===================================== ===================================== server/core/pom.xml ===================================== @@ -88,10 +88,6 @@ <groupId>io.ultreia.java4all.topia</groupId> <artifactId>persistence</artifactId> </dependency> - <dependency> - <groupId>io.ultreia.java4all.i18n</groupId> - <artifactId>i18n-runtime</artifactId> - </dependency> <dependency> <groupId>io.ultreia.java4all</groupId> <artifactId>class-mapping</artifactId> @@ -117,10 +113,10 @@ <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </dependency> - <dependency> - <groupId>com.google.auto.service</groupId> - <artifactId>auto-service-annotations</artifactId> - </dependency> +<!-- <dependency>--> +<!-- <groupId>com.google.auto.service</groupId>--> +<!-- <artifactId>auto-service-annotations</artifactId>--> +<!-- </dependency>--> <dependency> <groupId>org.nuiton</groupId> ===================================== server/core/src/main/i18n/getters/java.getter deleted ===================================== @@ -1,8 +0,0 @@ -observe.ui.datasource.storage.error.rest.adminApiKey.invalid -observe.ui.datasource.storage.error.rest.adminApiKey.required -observe.ui.datasource.storage.error.rest.authenticationToken.required -observe.ui.datasource.storage.error.rest.database.unknownForUser -observe.ui.datasource.storage.error.rest.password.bad -observe.ui.datasource.storage.error.rest.password.required -observe.ui.datasource.storage.error.rest.user.required -observe.ui.datasource.storage.error.rest.user.unknown ===================================== server/core/src/main/java/fr/ird/observe/server/request/ObserveWebRequestContext.java ===================================== @@ -26,9 +26,9 @@ import fr.ird.observe.dto.db.configuration.ObserveDataSourceConfiguration; import fr.ird.observe.dto.db.configuration.ObserveDataSourceConfigurationAndConnection; import fr.ird.observe.server.ObserveWebApplicationContext; import fr.ird.observe.server.configuration.ObserveServiceInitializerServerConfig; -import fr.ird.observe.server.security.AdminApiKeyNotFoundException; -import fr.ird.observe.server.security.AuthenticationTokenNotFoundException; -import fr.ird.observe.server.security.InvalidAdminKeyApiException; +import fr.ird.observe.services.service.security.AdminApiKeyNotFoundException; +import fr.ird.observe.services.service.security.AuthenticationTokenNotFoundException; +import fr.ird.observe.services.service.security.InvalidAdminKeyApiException; import fr.ird.observe.services.ObserveServiceInitializer; import fr.ird.observe.services.service.ObserveService; import org.debux.webmotion.server.call.HttpContext; ===================================== server/core/src/main/java/fr/ird/observe/server/security/AdminApiKeyNotFoundException.java deleted ===================================== @@ -1,42 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 07/09/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class AdminApiKeyNotFoundException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public AdminApiKeyNotFoundException(Locale locale) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.adminApiKey.required")); - } -} ===================================== server/core/src/main/java/fr/ird/observe/server/security/AuthenticationTokenNotFoundException.java deleted ===================================== @@ -1,42 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 07/09/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class AuthenticationTokenNotFoundException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public AuthenticationTokenNotFoundException(Locale locale) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.authenticationToken.required")); - } -} ===================================== server/core/src/main/java/fr/ird/observe/server/security/BadObserveWebUserPasswordException.java deleted ===================================== @@ -1,43 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 30/08/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class BadObserveWebUserPasswordException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public BadObserveWebUserPasswordException(Locale locale, String userLogin) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.password.bad", userLogin)); - } - -} ===================================== server/core/src/main/java/fr/ird/observe/server/security/InvalidAdminKeyApiException.java deleted ===================================== @@ -1,43 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 02/09/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class InvalidAdminKeyApiException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public InvalidAdminKeyApiException(Locale locale) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.adminApiKey.invalid")); - } - -} ===================================== server/core/src/main/java/fr/ird/observe/server/security/ObserveWebSecurityApplicationContext.java ===================================== @@ -35,7 +35,12 @@ import fr.ird.observe.server.configuration.user.ObserveWebUser; import fr.ird.observe.server.configuration.user.ObserveWebUserPermission; import fr.ird.observe.server.configuration.user.ObserveWebUsers; import fr.ird.observe.server.request.ObserveWebRequestContext; +import fr.ird.observe.services.service.security.BadObserveWebUserPasswordException; import fr.ird.observe.services.service.security.InvalidAuthenticationTokenException; +import fr.ird.observe.services.service.security.UnknownObserveWebUserException; +import fr.ird.observe.services.service.security.UnknownObserveWebUserForDatabaseException; +import fr.ird.observe.services.service.security.UserLoginNotFoundException; +import fr.ird.observe.services.service.security.UserPasswordNotFoundException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.nuiton.version.Version; ===================================== server/core/src/main/java/fr/ird/observe/server/security/UnknownObserveWebUserException.java deleted ===================================== @@ -1,43 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 30/08/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class UnknownObserveWebUserException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public UnknownObserveWebUserException(Locale locale, String userLogin) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.user.unknown", userLogin)); - } - -} ===================================== server/core/src/main/java/fr/ird/observe/server/security/UnknownObserveWebUserForDatabaseException.java deleted ===================================== @@ -1,42 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 30/08/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class UnknownObserveWebUserForDatabaseException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public UnknownObserveWebUserForDatabaseException(Locale locale, String databaseName, String role) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.database.unknownForUser", databaseName, role)); - } -} ===================================== server/core/src/main/java/fr/ird/observe/server/security/UserLoginNotFoundException.java deleted ===================================== @@ -1,42 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 07/09/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class UserLoginNotFoundException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public UserLoginNotFoundException(Locale locale) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.user.required")); - } -} ===================================== server/core/src/main/java/fr/ird/observe/server/security/UserPasswordNotFoundException.java deleted ===================================== @@ -1,42 +0,0 @@ -package fr.ird.observe.server.security; - -/* - * #%L - * ObServe Server :: Core - * %% - * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import fr.ird.observe.services.service.security.SecurityExceptionSupport; -import io.ultreia.java4all.i18n.I18n; - -import java.util.Locale; - -/** - * Created on 07/09/15. - * - * @author Tony Chemit - dev(a)tchemit.fr - */ -public class UserPasswordNotFoundException extends SecurityExceptionSupport { - - private static final long serialVersionUID = 1L; - - public UserPasswordNotFoundException(Locale locale) { - super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.password.required")); - } -} ===================================== server/i18n/src/main/i18n/translations/observe_en_GB.properties ===================================== @@ -1,14 +1,6 @@ ObserveWebApplicationConfig.description=ObServe Web configuration observe.config.client.temporaryFiles.timeout.description=Temporary files delete (in hours) observe.model.version=Model version -observe.ui.datasource.storage.error.rest.adminApiKey.invalid=Admin key not valid -observe.ui.datasource.storage.error.rest.adminApiKey.required=Admin key not found -observe.ui.datasource.storage.error.rest.authenticationToken.required=Authentication token not found -observe.ui.datasource.storage.error.rest.database.unknownForUser=Database "%s" is not defined for user "%s" -observe.ui.datasource.storage.error.rest.password.bad=Password is not valid -observe.ui.datasource.storage.error.rest.password.required=Password is mandatory -observe.ui.datasource.storage.error.rest.user.required=User login is mandatory -observe.ui.datasource.storage.error.rest.user.unknown=User "%s" is not defined on server observeweb.adminApiKey.description=API Key to use the admin mode (You should change it). observeweb.baseDirectory.description=Base directory observeweb.build.date.description=Build date ===================================== server/i18n/src/main/i18n/translations/observe_es_ES.properties ===================================== @@ -1,14 +1,6 @@ ObserveWebApplicationConfig.description=Configuración de Observe web observe.config.client.temporaryFiles.timeout.description=Temporary files delete (in hours) \#TODO observe.model.version=Versión del modelo -observe.ui.datasource.storage.error.rest.adminApiKey.invalid=Admin key not valid \#TODO -observe.ui.datasource.storage.error.rest.adminApiKey.required=Admin key not found \#TODO -observe.ui.datasource.storage.error.rest.authenticationToken.required=Authentication token not found \#TODO -observe.ui.datasource.storage.error.rest.database.unknownForUser=La base de datos "%s" no está configurada para el usuario "%s" -observe.ui.datasource.storage.error.rest.password.bad=Le contraseña es invalida -observe.ui.datasource.storage.error.rest.password.required=Le contraseña es obligatoria -observe.ui.datasource.storage.error.rest.user.required=El usuario es obligatorio -observe.ui.datasource.storage.error.rest.user.unknown=El usuario "%s" no es conocido del servidor observeweb.adminApiKey.description=Llave API Admin (Cambiar). observeweb.baseDirectory.description=Directorio de la aplicación observeweb.build.date.description=Fecha de construcción ===================================== server/i18n/src/main/i18n/translations/observe_fr_FR.properties ===================================== @@ -1,14 +1,6 @@ ObserveWebApplicationConfig.description=Observe web Configuration observe.config.client.temporaryFiles.timeout.description=Nettoyage des fichiers temporaires (en heures) observe.model.version=Version du modèle -observe.ui.datasource.storage.error.rest.adminApiKey.invalid=Pas de clef admin trouvée -observe.ui.datasource.storage.error.rest.adminApiKey.required=Clef admin non valide -observe.ui.datasource.storage.error.rest.authenticationToken.required=Pas de jeton d'authentification trouvé -observe.ui.datasource.storage.error.rest.database.unknownForUser=La base de données "%s" n'est pas définie pour l'utilisateur "%s" -observe.ui.datasource.storage.error.rest.password.bad=Le mot de passe est invalide -observe.ui.datasource.storage.error.rest.password.required=Le mot de passe est obligatoire -observe.ui.datasource.storage.error.rest.user.required=L'utilisateur est obligatoire -observe.ui.datasource.storage.error.rest.user.unknown=L'utilisateur "%s" est inconnu sur le serveur observeweb.adminApiKey.description=Clé API Admin (À changer) observeweb.baseDirectory.description=Répertoire de l'application observeweb.build.date.description=Date de construction ===================================== services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocalSupport.java ===================================== @@ -42,8 +42,10 @@ import org.apache.logging.log4j.Logger; import org.nuiton.topia.persistence.script.SqlScriptConsumer; import org.nuiton.topia.persistence.script.TopiaBlobsContainer; import org.nuiton.topia.persistence.script.TopiaSqlScript; +import org.nuiton.util.TimeLog; import org.nuiton.version.Version; +import java.util.Collections; import java.util.Set; import java.util.TreeSet; @@ -74,7 +76,7 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple String tripId = exportRequest.getTripId(); - log.info("Start export of trip: " + tripId); + log.info(String.format("Start export of trip: %s", tripId)); Version dbVersion = serviceContext.getServiceInitializer().optionalConnection().orElseThrow().getDataSourceInformation().getVersion(); AddSqlScriptProducerRequest request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres(dbVersion) : AddSqlScriptProducerRequest.forH2(dbVersion)) @@ -89,17 +91,14 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext(); - Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds()); - Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds()); - String tripId = request.getTripId(); long t0 = System.nanoTime(); - boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds); + boolean deleted = deleteTrip(persistenceContext, tripId, Collections.emptySet()); if (deleted) { long time = System.nanoTime() - t0; - log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(time)); + log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(time))); return new DeleteTripResult(request, time); } return null; @@ -110,24 +109,33 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext(); - Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds()); - Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds()); - String tripId = request.getTripId(); - long t0 = System.nanoTime(); + long t1 = TimeLog.getTime(); + TopiaSqlScript sqlContent = request.getSqlContent(); + // detect ids in import script + Set<String> ids = new TreeSet<>(); + for (String sqlStatement : sqlContent.getLocation()) { + if (sqlStatement.toLowerCase().trim().startsWith("insert into")) { + String id = sqlStatement.substring(sqlStatement.indexOf("VALUES") + 6); + id = id.substring(id.indexOf("'") + 1); + id = id.substring(0, id.indexOf("'")); + ids.add(id); + } + } + log.info(String.format("Found in trip: %s, %d ids to import in %s.", tripId, ids.size(), Strings.convertTime(t1, System.nanoTime()))); + t1 = System.nanoTime(); - boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds); - long t1 = System.nanoTime(); + boolean deleted = deleteTrip(persistenceContext, tripId, ids); long deleteTime = 0; if (deleted) { - deleteTime = System.nanoTime() - t0; - log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(deleteTime)); + deleteTime = System.nanoTime() - t1; + log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(deleteTime))); } + t1 = System.nanoTime(); - log.info("Start import of trip: " + request.getTripId()); + log.info(String.format("Start import of trip: %s", request.getTripId())); - TopiaSqlScript sqlContent = request.getSqlContent(); Set<TopiaBlobsContainer> blobsContainers = sqlContent.getBlobsContainers(); SqlScriptConsumer.Builder consumerBuilder = SqlScriptConsumer.builder(sqlContent.getLocation()).batchSize(1000); @@ -135,38 +143,42 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple consumerBuilder.blobs(blobsContainers); } persistenceContext.getSqlSupport().doSqlWork(consumerBuilder.build()); - - persistenceContext.commit(); + persistenceContext.flush(); long t2 = System.nanoTime(); - log.info("Import of trip: " + tripId + " done in " + Strings.convertTime(t1, t2)); + log.info(String.format("Import of trip: %s done in %s", tripId, Strings.convertTime(t1, t2))); return new ImportTripResult(request, true, t2 - t1, deleted, deleteTime); } - private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> tripSeineIds, Set<String> tripLonglineIds) { + private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> ids) { long t0 = System.nanoTime(); - boolean deleted = tripSeineIds.contains(tripId) || tripLonglineIds.contains(tripId); + boolean deleted = persistenceContext.exists(tripId); if (deleted) { - log.info("Start delete of trip: " + tripId); + log.info(String.format("Start delete of trip: %s", tripId)); DeleteSqlScriptProducerRequest sqlRequest = DeleteSqlScriptProducerRequest.of(tripId); TopiaSqlScript sqlScript = sqlScriptProducerService.produceDeleteSqlScript(sqlRequest); - //FIXME Make sure this always work!!! For the moment stay as before -// if (tripLonglineIds.contains(tripId) && serviceContext.getTopiaApplicationContext().getConfiguration().isH2Configuration()) { -// serviceContext.getTopiaApplicationContext().executeSqlStatementsWithH2AndRemoveIntegrity(persistenceContext, sqlScript); -// } else { -// persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript)); -// } persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript)); - log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(t0, System.nanoTime())); - persistenceContext.commit(); + log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(t0, System.nanoTime()))); + persistenceContext.flush(); + } + Set<String> existingIds = new TreeSet<>(); + if (!ids.isEmpty()) { + for (String id : ids) { + if (persistenceContext.exists(id)) { + log.error(String.format("Can't import trip %s, - found existing id in target database (%s)", tripId, id)); + existingIds.add(id); + } + } + } + if (!existingIds.isEmpty()) { + throw new IllegalStateException(String.format("Next %d id(s) are blocking the import of trip %s:\n%s", existingIds.size(), tripId, String.join("\n", existingIds))); } return deleted; } - } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/df05cdfde7d30588c510d76b… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/df05cdfde7d30588c510d76b… You're receiving this email because of your account on gitlab.com.
1 0
0 0
[Git][ultreiaio/ird-observe][develop] 5 commits: improve ci jobs
by Tony CHEMIT 09 Mar '21

09 Mar '21
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 98258f38 by Tony Chemit at 2021-03-09T10:28:05+01:00 improve ci jobs - - - - - 01cb617d by Tony Chemit at 2021-03-09T10:28:05+01:00 Mauvaise génération d&#39;une sauvegarde si toutes les données sont sélectionnées - - - - - 6d7366ad by Tony Chemit at 2021-03-09T10:28:05+01:00 Rendre les déplacements impossible si les parents incriminés sont obsolètes. - Closes #1794 - - - - - 320af6c0 by Tony Chemit at 2021-03-09T10:28:05+01:00 Réusinage de la configuration d&#39;une source de données et des templates associées - Closes #1797 - - - - - df05cdfd by Tony Chemit at 2021-03-09T10:28:05+01:00 Revue de l&#39;opération longue de validation - Closes #1798 - - - - - 30 changed files: - .gitlab-ci.yml - client/configuration/pom.xml - client/configuration/src/main/config/Client.ini - client/configuration/src/main/i18n/getters/config.getter - client/configuration/src/main/i18n/getters/java-enumeration.getter - client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java - + client/configuration/src/main/java/fr/ird/observe/client/configuration/ObserveServiceInitializerConfigClient.java - − client/configuration/src/main/java/fr/ird/observe/client/constants/CreationMode.java - client/core/pom.xml - client/core/src/main/i18n/getters/java.getter - client/core/src/main/i18n/getters/jaxx.getter - − client/core/src/main/i18n/templates/dataSourceInformation_en_GB.ftl - − client/core/src/main/i18n/templates/dataSourceInformation_es_ES.ftl - − client/core/src/main/i18n/templates/dataSourceInformation_fr_FR.ftl - client/core/src/main/java/fr/ird/observe/client/ClientUIContext.java - client/core/src/main/java/fr/ird/observe/client/ObserveSwingApplicationContext.java - client/core/src/main/java/fr/ird/observe/client/datasource/api/ObserveDataSourcesManager.java - client/core/src/main/java/fr/ird/observe/client/datasource/api/ObserveSwingDataSource.java - client/core/src/main/java/fr/ird/observe/client/datasource/h2/backup/BackupsManager.java - client/core/src/main/java/fr/ird/observe/client/main/actions/ReloadApplicationAction.java - client/core/src/main/java/fr/ird/observe/client/main/body/ClientConfigUI.java - client/core/src/main/java/fr/ird/observe/client/util/ObserveKeyStrokesSupport.java - − client/core/src/main/resources/icons/action-db-local.png - − client/core/src/main/resources/icons/action-db-remote.png - − client/core/src/main/resources/icons/action-db-server.png - client/core/src/main/resources/observe-ui.properties - client/datasource/actions/pom.xml - client/datasource/actions/src/main/i18n/getters/java.getter - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminStep.java - client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/AdminUIBodyContent.java The diff was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/7d45b11ffdbd7f4a764248ac… -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/7d45b11ffdbd7f4a764248ac… You're receiving this email because of your account on gitlab.com.
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.