Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
58b30886
by Tony Chemit at 2021-03-12T13:16:40+01:00
-
b564c86a
by Tony Chemit at 2021-03-12T13:16:40+01:00
-
384b1d11
by Tony Chemit at 2021-03-12T13:16:40+01:00
-
a5cef205
by Tony Chemit at 2021-03-12T13:16:40+01:00
-
9d65cd9d
by Tony Chemit at 2021-03-12T13:16:40+01:00
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:
| ... | ... | @@ -22,17 +22,16 @@ package fr.ird.observe.client.util.treetable; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
-import fr.ird.observe.client.util.UIHelper;
|
|
| 25 |
+import fr.ird.observe.dto.decoration.ObserveI18nDecoratorHelper;
|
|
| 26 | 26 |
import io.ultreia.java4all.jaxx.widgets.combobox.JaxxComboBox;
|
| 27 | 27 |
import org.nuiton.decorator.MultiJXPathDecorator;
|
| 28 | 28 |
|
| 29 | 29 |
import javax.swing.DefaultCellEditor;
|
| 30 | 30 |
import javax.swing.JComboBox;
|
| 31 | 31 |
import java.awt.Dimension;
|
| 32 |
-import java.awt.event.ActionEvent;
|
|
| 33 |
-import java.awt.event.MouseEvent;
|
|
| 34 | 32 |
import java.util.Collections;
|
| 35 |
-import java.util.EventObject;
|
|
| 33 |
+ |
|
| 34 |
+import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 36 | 35 |
|
| 37 | 36 |
/**
|
| 38 | 37 |
* Created by tchemit on 20/11/2018.
|
| ... | ... | @@ -41,12 +40,24 @@ import java.util.EventObject; |
| 41 | 40 |
*/
|
| 42 | 41 |
public class JaxxComboBoxCellEditor extends DefaultCellEditor {
|
| 43 | 42 |
|
| 43 |
+ public static <B> JaxxComboBoxCellEditor newEditor(Class<B> dataType, MultiJXPathDecorator<B> decorator) {
|
|
| 44 |
+ JaxxComboBox<B> editor = new JaxxComboBox<>();
|
|
| 45 |
+ editor.setI18nPrefix("observe.common.");
|
|
| 46 |
+ String entityLabel = ObserveI18nDecoratorHelper.getType(dataType);
|
|
| 47 |
+ editor.setPopupTitleText(t("observe.data.Data.type", entityLabel));
|
|
| 48 |
+ editor.setBeanType(dataType);
|
|
| 49 |
+ editor.setMinimumSize(new Dimension(0, 24));
|
|
| 50 |
+ editor.getConfig().setFilterable(false);
|
|
| 51 |
+ editor.getConfig().setTabToSelect(false);
|
|
| 52 |
+ editor.init(decorator, Collections.emptyList());
|
|
| 53 |
+ return new JaxxComboBoxCellEditor(editor);
|
|
| 54 |
+ }
|
|
| 55 |
+ |
|
| 44 | 56 |
@SuppressWarnings("rawtypes")
|
| 45 | 57 |
public JaxxComboBoxCellEditor(JaxxComboBox editor) {
|
| 46 | 58 |
super(editor.getCombobox());
|
| 47 | 59 |
this.editorComponent = editor;
|
| 48 | 60 |
JComboBox comboBox = editor.getCombobox();
|
| 49 |
- comboBox.setFocusable(false);
|
|
| 50 | 61 |
editorComponent.setOpaque(false);
|
| 51 | 62 |
comboBox.removeActionListener(this.delegate);
|
| 52 | 63 |
|
| ... | ... | @@ -55,6 +66,7 @@ public class JaxxComboBoxCellEditor extends DefaultCellEditor { |
| 55 | 66 |
@Override
|
| 56 | 67 |
public void setValue(Object value) {
|
| 57 | 68 |
editor.setSelectedItem(value);
|
| 69 |
+ super.setValue(value);
|
|
| 58 | 70 |
}
|
| 59 | 71 |
|
| 60 | 72 |
@Override
|
| ... | ... | @@ -62,39 +74,22 @@ public class JaxxComboBoxCellEditor extends DefaultCellEditor { |
| 62 | 74 |
return editor.getModel().getSelectedItem();
|
| 63 | 75 |
}
|
| 64 | 76 |
|
| 65 |
- @Override
|
|
| 66 |
- public boolean shouldSelectCell(EventObject anEvent) {
|
|
| 67 |
- if (anEvent instanceof MouseEvent) {
|
|
| 68 |
- MouseEvent e = (MouseEvent) anEvent;
|
|
| 69 |
- return e.getID() != MouseEvent.MOUSE_DRAGGED;
|
|
| 70 |
- }
|
|
| 71 |
- return true;
|
|
| 72 |
- }
|
|
| 73 |
- |
|
| 77 |
+ @SuppressWarnings("unchecked")
|
|
| 74 | 78 |
@Override
|
| 75 | 79 |
public boolean stopCellEditing() {
|
| 76 | 80 |
if (comboBox.isEditable()) {
|
| 77 |
- // Commit edited value.
|
|
| 78 |
- comboBox.actionPerformed(new ActionEvent(JaxxComboBoxCellEditor.this, 0, ""));
|
|
| 81 |
+ Object cellEditorValue = getCellEditorValue();
|
|
| 82 |
+ if (cellEditorValue != null && !editor.getConfig().getBeanType().isAssignableFrom(cellEditorValue.getClass())) {
|
|
| 83 |
+ setValue(null);
|
|
| 84 |
+ }
|
|
| 79 | 85 |
}
|
| 80 | 86 |
return super.stopCellEditing();
|
| 81 | 87 |
}
|
| 82 |
- |
|
| 83 |
- @Override
|
|
| 84 |
- public void actionPerformed(ActionEvent e) {
|
|
| 85 |
- JaxxComboBoxCellEditor.this.stopCellEditing();
|
|
| 86 |
- }
|
|
| 87 | 88 |
};
|
| 88 | 89 |
|
| 89 | 90 |
comboBox.addActionListener(this.delegate);
|
| 90 | 91 |
}
|
| 91 | 92 |
|
| 92 |
- public static <B> JaxxComboBoxCellEditor newEditor(Class<B> dataType, MultiJXPathDecorator<B> decorator) {
|
|
| 93 |
- JaxxComboBox<B> editor = UIHelper.newJaxxComboBox(dataType, decorator, Collections.emptyList());
|
|
| 94 |
- editor.setMinimumSize(new Dimension(0, 24));
|
|
| 95 |
- return new JaxxComboBoxCellEditor(editor);
|
|
| 96 |
- }
|
|
| 97 |
- |
|
| 98 | 93 |
@Override
|
| 99 | 94 |
public JaxxComboBox<?> getComponent() {
|
| 100 | 95 |
return (JaxxComboBox<?>) super.getComponent();
|
| ... | ... | @@ -186,6 +186,7 @@ observe.ui.datasource.storage.config.referentiel.storage |
| 186 | 186 |
observe.ui.datasource.storage.config.right.storage
|
| 187 | 187 |
observe.ui.datasource.storage.config.source.storage
|
| 188 | 188 |
observe.ui.datasource.storage.step.label
|
| 189 |
+observe.ui.menu.actions
|
|
| 189 | 190 |
observe.ui.message.no.report.selected
|
| 190 | 191 |
observe.ui.message.select.report
|
| 191 | 192 |
observe.ui.title.choose.db.dump.directory
|
| ... | ... | @@ -24,7 +24,7 @@ package fr.ird.observe.client.datasource.actions; |
| 24 | 24 |
|
| 25 | 25 |
import com.google.auto.service.AutoService;
|
| 26 | 26 |
import fr.ird.observe.client.WithClientUIContext;
|
| 27 |
-import fr.ird.observe.client.datasource.actions.menu.AdminUIMenu;
|
|
| 27 |
+import fr.ird.observe.client.datasource.actions.actions.LaunchAdminAction;
|
|
| 28 | 28 |
import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
| 29 | 29 |
import fr.ird.observe.client.datasource.editor.api.DataSourceEditor;
|
| 30 | 30 |
import fr.ird.observe.client.datasource.editor.api.DataSourceEditorBodyContent;
|
| ... | ... | @@ -35,6 +35,7 @@ import fr.ird.observe.client.main.body.NoBodyContentComponent; |
| 35 | 35 |
import fr.ird.observe.client.util.UIHelper;
|
| 36 | 36 |
import fr.ird.observe.dto.ObserveUtil;
|
| 37 | 37 |
import fr.ird.observe.dto.db.configuration.ObserveDataSourceConfiguration;
|
| 38 |
+import io.ultreia.java4all.i18n.I18n;
|
|
| 38 | 39 |
import io.ultreia.java4all.util.SingletonSupplier;
|
| 39 | 40 |
import org.apache.logging.log4j.LogManager;
|
| 40 | 41 |
import org.apache.logging.log4j.Logger;
|
| ... | ... | @@ -42,7 +43,9 @@ import org.nuiton.jaxx.runtime.JAXXUtil; |
| 42 | 43 |
import org.nuiton.jaxx.runtime.context.JAXXContextEntryDef;
|
| 43 | 44 |
import org.nuiton.jaxx.runtime.context.JAXXInitialContext;
|
| 44 | 45 |
|
| 46 |
+import javax.swing.JMenu;
|
|
| 45 | 47 |
import javax.swing.JMenuBar;
|
| 48 |
+import javax.swing.JMenuItem;
|
|
| 46 | 49 |
import javax.swing.SwingUtilities;
|
| 47 | 50 |
import java.util.Objects;
|
| 48 | 51 |
import java.util.function.Supplier;
|
| ... | ... | @@ -72,11 +75,29 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi |
| 72 | 75 |
@Override
|
| 73 | 76 |
public void install(ObserveMainUI mainUI) {
|
| 74 | 77 |
super.install(mainUI);
|
| 75 |
- AdminUIMenu menu = new AdminUIMenu(UIHelper.initialContext(mainUI, mainUI.getModel()));
|
|
| 78 |
+ JMenu menu = new JMenu(I18n.t("observe.ui.menu.actions"));
|
|
| 79 |
+ menu.setMnemonic('A');
|
|
| 80 |
+ addMenuAction(mainUI, menu, AdminStep.SYNCHRONIZE);
|
|
| 81 |
+ addMenuAction(mainUI, menu, AdminStep.REFERENTIAL_SYNCHRONIZE);
|
|
| 82 |
+ menu.addSeparator();
|
|
| 83 |
+ addMenuAction(mainUI, menu, AdminStep.EXPORT_DATA);
|
|
| 84 |
+ addMenuAction(mainUI, menu, AdminStep.DATA_SYNCHRONIZE);
|
|
| 85 |
+ menu.addSeparator();
|
|
| 86 |
+ addMenuAction(mainUI, menu, AdminStep.CONSOLIDATE);
|
|
| 87 |
+ addMenuAction(mainUI, menu, AdminStep.ACTIVITY_LL_PAIRING);
|
|
| 88 |
+ addMenuAction(mainUI, menu, AdminStep.VALIDATE);
|
|
| 89 |
+ addMenuAction(mainUI, menu, AdminStep.REPORT);
|
|
| 76 | 90 |
JMenuBar menuBar = mainUI.getMenu();
|
| 77 | 91 |
menuBar.add(menu, 2);
|
| 78 | 92 |
}
|
| 79 | 93 |
|
| 94 |
+ protected void addMenuAction(ObserveMainUI mainUI, JMenu menu, AdminStep step) {
|
|
| 95 |
+ LaunchAdminAction action = new LaunchAdminAction(step);
|
|
| 96 |
+ JMenuItem menuItem = new JMenuItem();
|
|
| 97 |
+ LaunchAdminAction.init(mainUI, menuItem, action);
|
|
| 98 |
+ menu.add(menuItem);
|
|
| 99 |
+ }
|
|
| 100 |
+ |
|
| 80 | 101 |
@Override
|
| 81 | 102 |
public void show(ObserveMainUI mainUI) {
|
| 82 | 103 |
super.show(mainUI);
|
| ... | ... | @@ -102,12 +123,7 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi |
| 102 | 123 |
|
| 103 | 124 |
AdminUI ui = get();
|
| 104 | 125 |
AdminUIModel model = ui.getModel();
|
| 105 |
- |
|
| 106 |
-// ConfigModel.doCloseSource(model.getConfigModel().getRightSourceModel().getSource());
|
|
| 107 |
-// ConfigModel.doCloseSource(model.getConfigModel().getLeftSourceModel().getSource());
|
|
| 108 |
- |
|
| 109 | 126 |
model.destroy();
|
| 110 |
- |
|
| 111 | 127 |
ui.destroy();
|
| 112 | 128 |
ui.dispose();
|
| 113 | 129 |
|
| ... | ... | @@ -135,7 +151,6 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi |
| 135 | 151 |
AdminStep adminStep = mainUI.getContextValue(AdminStep.class);
|
| 136 | 152 |
AdminUIModel model = new AdminUIModel(Objects.requireNonNull(adminStep));
|
| 137 | 153 |
JAXXInitialContext uiContext = UIHelper.initialContext(mainUI, model);
|
| 138 |
- |
|
| 139 | 154 |
//FIXME:BodyContent Review jaxx to remove this...
|
| 140 | 155 |
// apply action
|
| 141 | 156 |
uiContext.add(APPLY_DEF, () -> {
|
| ... | ... | @@ -150,30 +165,23 @@ public class AdminUIBodyContent extends MainUIBodyContent<AdminUI> implements Wi |
| 150 | 165 |
}
|
| 151 | 166 |
|
| 152 | 167 |
private void doClose(boolean wasCanceled) {
|
| 153 |
- log.info(this + ", was canceled ? " + wasCanceled);
|
|
| 154 |
- |
|
| 168 |
+ log.info(String.format("%s, was canceled ? %s", this, wasCanceled));
|
|
| 155 | 169 |
AdminUI ui = get();
|
| 156 | 170 |
AdminUIModel model = ui.getModel();
|
| 157 |
- |
|
| 158 | 171 |
ObserveSwingDataSource.doCloseSource(model.getConfigModel().getRightSourceModel().getSource());
|
| 159 | 172 |
ObserveSwingDataSource.doCloseSource(model.getConfigModel().getLeftSourceModel().getSource());
|
| 160 |
- |
|
| 161 | 173 |
ObserveMainUI mainUI = getClientUIContext().getMainUI();
|
| 162 |
- |
|
| 163 | 174 |
ObserveDataSourceConfiguration sourceConfiguration = model.getConfigModel().getPreviousSourceConfiguration();
|
| 164 | 175 |
if (sourceConfiguration == null) {
|
| 165 | 176 |
// no previous data source
|
| 166 | 177 |
mainUI.changeBodyContent(NoBodyContentComponent.class);
|
| 167 | 178 |
return;
|
| 168 | 179 |
}
|
| 169 |
- |
|
| 170 | 180 |
// reopen data source
|
| 171 | 181 |
ObserveSwingDataSource source = getClientUIContext().getDataSourcesManager().newDataSource(sourceConfiguration);
|
| 172 | 182 |
// attach it to ui
|
| 173 | 183 |
DataSourceEditorBodyContent dataSourceEditorBodyContent = mainUI.getMainUIBodyContentManager().getBodyTyped(DataSourceEditor.class, DataSourceEditorBodyContent.class);
|
| 174 | 184 |
// load it
|
| 175 | 185 |
dataSourceEditorBodyContent.loadStorage(mainUI, source);
|
| 176 |
- |
|
| 177 | 186 |
}
|
| 178 |
- |
|
| 179 | 187 |
}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 1 |
+package fr.ird.observe.client.datasource.actions.actions;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*
|
| 4 | 4 |
* #%L
|
| ... | ... | @@ -24,8 +24,8 @@ package fr.ird.observe.client.datasource.actions.menu.actions; |
| 24 | 24 |
|
| 25 | 25 |
import fr.ird.observe.client.datasource.actions.AdminStep;
|
| 26 | 26 |
import fr.ird.observe.client.datasource.actions.AdminUI;
|
| 27 |
-import fr.ird.observe.client.datasource.actions.menu.AdminUIMenu;
|
|
| 28 | 27 |
import fr.ird.observe.client.main.ObserveMainUI;
|
| 28 |
+import fr.ird.observe.client.main.actions.MainUIActionSupport;
|
|
| 29 | 29 |
import fr.ird.observe.dto.I18nEnumHelper;
|
| 30 | 30 |
import org.apache.logging.log4j.LogManager;
|
| 31 | 31 |
import org.apache.logging.log4j.Logger;
|
| ... | ... | @@ -41,13 +41,13 @@ import static io.ultreia.java4all.i18n.I18n.t; |
| 41 | 41 |
* @author Tony Chemit - dev@tchemit.fr
|
| 42 | 42 |
* @since 3.13
|
| 43 | 43 |
*/
|
| 44 |
-public abstract class LaunchAdminActionSupport extends AdminUIMenuActionSupport {
|
|
| 44 |
+public class LaunchAdminAction extends MainUIActionSupport {
|
|
| 45 | 45 |
|
| 46 |
- private static final Logger log = LogManager.getLogger(LaunchAdminActionSupport.class);
|
|
| 46 |
+ private static final Logger log = LogManager.getLogger(LaunchAdminAction.class);
|
|
| 47 | 47 |
|
| 48 | 48 |
private final AdminStep action;
|
| 49 | 49 |
|
| 50 |
- LaunchAdminActionSupport(AdminStep action) {
|
|
| 50 |
+ public LaunchAdminAction(AdminStep action) {
|
|
| 51 | 51 |
super(t(Objects.requireNonNull(action).getOperationLabel()), t(action.getOperationDescription()), action.getIconName(), action.getMnemonic());
|
| 52 | 52 |
this.action = action;
|
| 53 | 53 |
}
|
| ... | ... | @@ -63,15 +63,13 @@ public abstract class LaunchAdminActionSupport extends AdminUIMenuActionSupport |
| 63 | 63 |
// }
|
| 64 | 64 |
|
| 65 | 65 |
@Override
|
| 66 |
- protected void doActionPerformed(ActionEvent e, AdminUIMenu ui) {
|
|
| 66 |
+ protected void doActionPerformed(ActionEvent e, ObserveMainUI ui) {
|
|
| 67 | 67 |
log.info(String.format("Will start admin action: %s", I18nEnumHelper.getLabel(action)));
|
| 68 |
- ObserveMainUI mainUI = getClientUIContext().getMainUI();
|
|
| 69 |
- mainUI.setContextValue(action);
|
|
| 68 |
+ ui.setContextValue(action);
|
|
| 70 | 69 |
try {
|
| 71 |
- mainUI.changeBodyContent(AdminUI.class);
|
|
| 70 |
+ ui.changeBodyContent(AdminUI.class);
|
|
| 72 | 71 |
} finally {
|
| 73 |
- mainUI.removeContextValue(AdminStep.class);
|
|
| 72 |
+ ui.removeContextValue(AdminStep.class);
|
|
| 74 | 73 |
}
|
| 75 | 74 |
}
|
| 76 |
- |
|
| 77 | 75 |
}
|
| 1 |
-<!--
|
|
| 2 |
- #%L
|
|
| 3 |
- ObServe Client :: DataSource :: Actions
|
|
| 4 |
- %%
|
|
| 5 |
- Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
- %%
|
|
| 7 |
- This program is free software: you can redistribute it and/or modify
|
|
| 8 |
- it under the terms of the GNU General Public License as
|
|
| 9 |
- published by the Free Software Foundation, either version 3 of the
|
|
| 10 |
- License, or (at your option) any later version.
|
|
| 11 |
- This program is distributed in the hope that it will be useful,
|
|
| 12 |
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 13 |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 14 |
- GNU General Public License for more details.
|
|
| 15 |
- You should have received a copy of the GNU General Public
|
|
| 16 |
- License along with this program. If not, see
|
|
| 17 |
- <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 18 |
- #L%
|
|
| 19 |
- -->
|
|
| 20 |
-<JMenu id='menuActions'>
|
|
| 21 |
- |
|
| 22 |
- <import>
|
|
| 23 |
- fr.ird.observe.client.main.MainUIModel
|
|
| 24 |
- </import>
|
|
| 25 |
- |
|
| 26 |
- <MainUIModel id="uiModel" initializer="getContextValue(MainUIModel.class)"/>
|
|
| 27 |
- |
|
| 28 |
- <JMenuItem id='launchSynchronizeAction'/>
|
|
| 29 |
- <JMenuItem id='launchReferentialSynchronizeAction'/>
|
|
| 30 |
- <JSeparator/>
|
|
| 31 |
- <JMenuItem id='launchExportDataAction'/>
|
|
| 32 |
- <JMenuItem id='launchDataSynchronizeAction'/>
|
|
| 33 |
- <JSeparator/>
|
|
| 34 |
- <JMenuItem id='launchConsolidateAction'/>
|
|
| 35 |
- <JMenuItem id='launchActivityLonglinePairingAction'/>
|
|
| 36 |
- <JMenuItem id='launchValidateAction'/>
|
|
| 37 |
- <JMenuItem id='launchReportAction'/>
|
|
| 38 |
-</JMenu>
|
| 1 |
-/*-
|
|
| 2 |
- * #%L
|
|
| 3 |
- * ObServe Client :: DataSource :: Actions
|
|
| 4 |
- * %%
|
|
| 5 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 6 |
- * %%
|
|
| 7 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 8 |
- * it under the terms of the GNU General Public License as
|
|
| 9 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 10 |
- * License, or (at your option) any later version.
|
|
| 11 |
- *
|
|
| 12 |
- * This program is distributed in the hope that it will be useful,
|
|
| 13 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
- * GNU General Public License for more details.
|
|
| 16 |
- *
|
|
| 17 |
- * You should have received a copy of the GNU General Public
|
|
| 18 |
- * License along with this program. If not, see
|
|
| 19 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 20 |
- * #L%
|
|
| 21 |
- */
|
|
| 22 |
-#menuActions {
|
|
| 23 |
- text: "observe.ui.menu.actions";
|
|
| 24 |
- mnemonic: A;
|
|
| 25 |
- enabled: {uiModel.isActionsEnabled()};
|
|
| 26 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.WithClientUIContext;
|
|
| 26 |
-import fr.ird.observe.client.datasource.actions.menu.AdminUIMenu;
|
|
| 27 |
-import org.nuiton.jaxx.runtime.swing.action.JComponentActionSupport;
|
|
| 28 |
- |
|
| 29 |
-import javax.swing.KeyStroke;
|
|
| 30 |
- |
|
| 31 |
-/**
|
|
| 32 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 33 |
- * @since ?
|
|
| 34 |
- */
|
|
| 35 |
-public abstract class AdminUIMenuActionSupport extends JComponentActionSupport<AdminUIMenu> implements WithClientUIContext {
|
|
| 36 |
- |
|
| 37 |
- protected AdminUIMenuActionSupport(String label, String shortDescription, String actionIcon, KeyStroke acceleratorKey) {
|
|
| 38 |
- super(label, shortDescription, actionIcon, acceleratorKey);
|
|
| 39 |
- }
|
|
| 40 |
- |
|
| 41 |
- protected AdminUIMenuActionSupport(String actionCommandKey, String label, String shortDescription, String actionIcon, KeyStroke acceleratorKey) {
|
|
| 42 |
- super(actionCommandKey, label, shortDescription, actionIcon, acceleratorKey);
|
|
| 43 |
- }
|
|
| 44 |
- |
|
| 45 |
- protected AdminUIMenuActionSupport(String label, String shortDescription, String actionIcon, char acceleratorKey) {
|
|
| 46 |
- super(label, shortDescription, actionIcon, acceleratorKey);
|
|
| 47 |
- }
|
|
| 48 |
- |
|
| 49 |
- protected AdminUIMenuActionSupport(String actionCommandKey, String label, String shortDescription, String actionIcon, char acceleratorKey) {
|
|
| 50 |
- super(actionCommandKey, label, shortDescription, actionIcon, acceleratorKey);
|
|
| 51 |
- }
|
|
| 52 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created by tchemit on 20/11/2018.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- */
|
|
| 32 |
-public class LaunchActivityLlPairingAction extends LaunchAdminActionSupport {
|
|
| 33 |
- |
|
| 34 |
- public LaunchActivityLlPairingAction() {
|
|
| 35 |
- super(AdminStep.ACTIVITY_LL_PAIRING);
|
|
| 36 |
- }
|
|
| 37 |
- |
|
| 38 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created on 05/12/16.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- * @since 6.0
|
|
| 32 |
- */
|
|
| 33 |
-public class LaunchConsolidateAction extends LaunchAdminActionSupport {
|
|
| 34 |
- |
|
| 35 |
- public LaunchConsolidateAction() {
|
|
| 36 |
- super(AdminStep.CONSOLIDATE);
|
|
| 37 |
- }
|
|
| 38 |
- |
|
| 39 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created on 05/12/16.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- * @since 6.0
|
|
| 32 |
- */
|
|
| 33 |
-public class LaunchDataSynchronizeAction extends LaunchAdminActionSupport {
|
|
| 34 |
- |
|
| 35 |
- public LaunchDataSynchronizeAction() {
|
|
| 36 |
- super(AdminStep.DATA_SYNCHRONIZE);
|
|
| 37 |
- }
|
|
| 38 |
- |
|
| 39 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created on 05/12/16.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- * @since 6.0
|
|
| 32 |
- */
|
|
| 33 |
-public class LaunchExportDataAction extends LaunchAdminActionSupport {
|
|
| 34 |
- |
|
| 35 |
- public LaunchExportDataAction() {
|
|
| 36 |
- super(AdminStep.EXPORT_DATA);
|
|
| 37 |
- }
|
|
| 38 |
- |
|
| 39 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created on 05/12/16.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- * @since 6.0
|
|
| 32 |
- */
|
|
| 33 |
-public class LaunchReferentialSynchronizeAction extends LaunchAdminActionSupport {
|
|
| 34 |
- |
|
| 35 |
- public LaunchReferentialSynchronizeAction() {
|
|
| 36 |
- super(AdminStep.REFERENTIAL_SYNCHRONIZE);
|
|
| 37 |
- }
|
|
| 38 |
- |
|
| 39 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created on 05/12/16.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- * @since 6.0
|
|
| 32 |
- */
|
|
| 33 |
-public class LaunchReportAction extends LaunchAdminActionSupport {
|
|
| 34 |
- |
|
| 35 |
- public LaunchReportAction() {
|
|
| 36 |
- super(AdminStep.REPORT);
|
|
| 37 |
- }
|
|
| 38 |
- |
|
| 39 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created on 05/12/16.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- * @since 6.0
|
|
| 32 |
- */
|
|
| 33 |
-public class LaunchSynchronizeAction extends LaunchAdminActionSupport {
|
|
| 34 |
- |
|
| 35 |
- public LaunchSynchronizeAction() {
|
|
| 36 |
- super(AdminStep.SYNCHRONIZE);
|
|
| 37 |
- }
|
|
| 38 |
- |
|
| 39 |
-}
|
| 1 |
-package fr.ird.observe.client.datasource.actions.menu.actions;
|
|
| 2 |
- |
|
| 3 |
-/*-
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Client :: DataSource :: Actions
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.client.datasource.actions.AdminStep;
|
|
| 26 |
- |
|
| 27 |
-/**
|
|
| 28 |
- * Created on 05/12/16.
|
|
| 29 |
- *
|
|
| 30 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 31 |
- * @since 6.0
|
|
| 32 |
- */
|
|
| 33 |
-public class LaunchValidateAction extends LaunchAdminActionSupport {
|
|
| 34 |
- |
|
| 35 |
- public LaunchValidateAction() {
|
|
| 36 |
- super(AdminStep.VALIDATE);
|
|
| 37 |
- }
|
|
| 38 |
- |
|
| 39 |
-}
|
| ... | ... | @@ -34,7 +34,6 @@ import fr.ird.observe.client.datasource.actions.pairing.ll.tree.node.ActivityLlP |
| 34 | 34 |
import fr.ird.observe.client.datasource.actions.pairing.tree.node.ActivityPairingNodeSupport;
|
| 35 | 35 |
import fr.ird.observe.client.datasource.actions.pairing.tree.node.ActivityPairingProgramNode;
|
| 36 | 36 |
import fr.ird.observe.client.util.DtoIconHelper;
|
| 37 |
-import fr.ird.observe.client.util.UIHelper;
|
|
| 38 | 37 |
import fr.ird.observe.client.util.treetable.JaxxComboBoxCellEditor;
|
| 39 | 38 |
import fr.ird.observe.dto.data.ll.common.TripDto;
|
| 40 | 39 |
import fr.ird.observe.dto.data.ll.common.TripReference;
|
| ... | ... | @@ -76,92 +75,6 @@ import java.util.function.Supplier; |
| 76 | 75 |
*/
|
| 77 | 76 |
public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClientConfig, WithClientUIContext {
|
| 78 | 77 |
|
| 79 |
- public ActivityLlPairingTreeTable(ActivityLlPairingTreeTableModel treeModel) {
|
|
| 80 |
- super(treeModel);
|
|
| 81 |
- setTreeCellRenderer(new ActivityLlPairingTreeTableTreeCellRenderer(getClientUIContext().getDecoratorService()));
|
|
| 82 |
- setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
|
| 83 |
- setCellSelectionEnabled(true);
|
|
| 84 |
- setRootVisible(false);
|
|
| 85 |
- setRowHeight(26);
|
|
| 86 |
- getTableHeader().setReorderingAllowed(false);
|
|
| 87 |
- }
|
|
| 88 |
- |
|
| 89 |
- @Override
|
|
| 90 |
- public ActivityLlPairingTreeTableModel getTreeTableModel() {
|
|
| 91 |
- return (ActivityLlPairingTreeTableModel) super.getTreeTableModel();
|
|
| 92 |
- }
|
|
| 93 |
- |
|
| 94 |
- public void openTable(ActivityLlPairingRootNode rootNode) {
|
|
| 95 |
- |
|
| 96 |
- getTreeTableModel().setRoot(rootNode);
|
|
| 97 |
- |
|
| 98 |
- expandAll();
|
|
| 99 |
- |
|
| 100 |
- // auto expand nodes when selected
|
|
| 101 |
- addTreeSelectionListener(e -> {
|
|
| 102 |
- int selectedRow = getSelectedRow();
|
|
| 103 |
- if (selectedRow != -1) {
|
|
| 104 |
- if (!isExpanded(selectedRow)) {
|
|
| 105 |
- SwingUtilities.invokeLater(() -> expandRow(selectedRow));
|
|
| 106 |
- }
|
|
| 107 |
- }
|
|
| 108 |
- });
|
|
| 109 |
- }
|
|
| 110 |
- |
|
| 111 |
- public void initTable(ActivityLlPairingModel model, Supplier<Integer> width) {
|
|
| 112 |
- |
|
| 113 |
- setColumnFactory(new ColumnFactory() {
|
|
| 114 |
- |
|
| 115 |
- @Override
|
|
| 116 |
- public void configureColumnWidths(JXTable table, TableColumnExt columnExt) {
|
|
| 117 |
- if (table.getColumn(0).equals(columnExt)) {
|
|
| 118 |
- columnExt.setPreferredWidth(width.get());
|
|
| 119 |
- columnExt.setMinWidth(columnExt.getPreferredWidth());
|
|
| 120 |
- return;
|
|
| 121 |
- }
|
|
| 122 |
- if (table.getColumn(1).equals(columnExt)) {
|
|
| 123 |
- columnExt.setPreferredWidth(width.get());
|
|
| 124 |
- columnExt.setMinWidth(columnExt.getPreferredWidth());
|
|
| 125 |
- return;
|
|
| 126 |
- }
|
|
| 127 |
- if (table.getColumn(2).equals(columnExt)) {
|
|
| 128 |
- columnExt.setPreferredWidth(50);
|
|
| 129 |
- columnExt.setMinWidth(50);
|
|
| 130 |
- return;
|
|
| 131 |
- }
|
|
| 132 |
- super.configureColumnWidths(table, columnExt);
|
|
| 133 |
- columnExt.setMinWidth(columnExt.getPreferredWidth());
|
|
| 134 |
- }
|
|
| 135 |
- });
|
|
| 136 |
- getTreeTableModel().addTreeModelListener(new TreeModelListener() {
|
|
| 137 |
- @Override
|
|
| 138 |
- public void treeNodesChanged(TreeModelEvent e) {
|
|
| 139 |
- |
|
| 140 |
- model.recomputeSelectedValues();
|
|
| 141 |
- }
|
|
| 142 |
- |
|
| 143 |
- @Override
|
|
| 144 |
- public void treeNodesInserted(TreeModelEvent e) {
|
|
| 145 |
- |
|
| 146 |
- }
|
|
| 147 |
- |
|
| 148 |
- @Override
|
|
| 149 |
- public void treeNodesRemoved(TreeModelEvent e) {
|
|
| 150 |
- |
|
| 151 |
- }
|
|
| 152 |
- |
|
| 153 |
- @Override
|
|
| 154 |
- public void treeStructureChanged(TreeModelEvent e) {
|
|
| 155 |
- |
|
| 156 |
- }
|
|
| 157 |
- |
|
| 158 |
- });
|
|
| 159 |
- DecoratorService decoratorService = getClientUIContext().getDecoratorService();
|
|
| 160 |
- setDefaultRenderer(Object.class, new ActivityLlPairingTreeTableCellRenderer(this, getClientConfig(), decoratorService));
|
|
| 161 |
- setDefaultEditor(Object.class, new ActivityLlPairingTreeTableCellEditor(this, getClientConfig(), decoratorService));
|
|
| 162 |
- |
|
| 163 |
- }
|
|
| 164 |
- |
|
| 165 | 78 |
static class ActivityLlPairingTreeTableCellRenderer implements TableCellRenderer {
|
| 166 | 79 |
|
| 167 | 80 |
// Render booleans (inclusive)
|
| ... | ... | @@ -251,6 +164,91 @@ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClien |
| 251 | 164 |
}
|
| 252 | 165 |
}
|
| 253 | 166 |
|
| 167 |
+ public ActivityLlPairingTreeTable(ActivityLlPairingTreeTableModel treeModel) {
|
|
| 168 |
+ super(treeModel);
|
|
| 169 |
+ setTreeCellRenderer(new ActivityLlPairingTreeTableTreeCellRenderer(getClientUIContext().getDecoratorService()));
|
|
| 170 |
+ setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
|
| 171 |
+ setCellSelectionEnabled(true);
|
|
| 172 |
+ setRootVisible(false);
|
|
| 173 |
+ setRowHeight(26);
|
|
| 174 |
+ getTableHeader().setReorderingAllowed(false);
|
|
| 175 |
+ }
|
|
| 176 |
+ |
|
| 177 |
+ @Override
|
|
| 178 |
+ public ActivityLlPairingTreeTableModel getTreeTableModel() {
|
|
| 179 |
+ return (ActivityLlPairingTreeTableModel) super.getTreeTableModel();
|
|
| 180 |
+ }
|
|
| 181 |
+ |
|
| 182 |
+ public void openTable(ActivityLlPairingRootNode rootNode) {
|
|
| 183 |
+ |
|
| 184 |
+ getTreeTableModel().setRoot(rootNode);
|
|
| 185 |
+ |
|
| 186 |
+ expandAll();
|
|
| 187 |
+ |
|
| 188 |
+ // auto expand nodes when selected
|
|
| 189 |
+ addTreeSelectionListener(e -> {
|
|
| 190 |
+ int selectedRow = getSelectedRow();
|
|
| 191 |
+ if (selectedRow != -1) {
|
|
| 192 |
+ if (!isExpanded(selectedRow)) {
|
|
| 193 |
+ SwingUtilities.invokeLater(() -> expandRow(selectedRow));
|
|
| 194 |
+ }
|
|
| 195 |
+ }
|
|
| 196 |
+ });
|
|
| 197 |
+ }
|
|
| 198 |
+ |
|
| 199 |
+ public void initTable(ActivityLlPairingModel model, Supplier<Integer> width) {
|
|
| 200 |
+ |
|
| 201 |
+ setColumnFactory(new ColumnFactory() {
|
|
| 202 |
+ |
|
| 203 |
+ @Override
|
|
| 204 |
+ public void configureColumnWidths(JXTable table, TableColumnExt columnExt) {
|
|
| 205 |
+ if (table.getColumn(0).equals(columnExt)) {
|
|
| 206 |
+ columnExt.setPreferredWidth(width.get());
|
|
| 207 |
+ columnExt.setMinWidth(columnExt.getPreferredWidth());
|
|
| 208 |
+ return;
|
|
| 209 |
+ }
|
|
| 210 |
+ if (table.getColumn(1).equals(columnExt)) {
|
|
| 211 |
+ columnExt.setPreferredWidth(width.get());
|
|
| 212 |
+ columnExt.setMinWidth(columnExt.getPreferredWidth());
|
|
| 213 |
+ return;
|
|
| 214 |
+ }
|
|
| 215 |
+ if (table.getColumn(2).equals(columnExt)) {
|
|
| 216 |
+ columnExt.setPreferredWidth(50);
|
|
| 217 |
+ columnExt.setMinWidth(50);
|
|
| 218 |
+ return;
|
|
| 219 |
+ }
|
|
| 220 |
+ super.configureColumnWidths(table, columnExt);
|
|
| 221 |
+ columnExt.setMinWidth(columnExt.getPreferredWidth());
|
|
| 222 |
+ }
|
|
| 223 |
+ });
|
|
| 224 |
+ getTreeTableModel().addTreeModelListener(new TreeModelListener() {
|
|
| 225 |
+ @Override
|
|
| 226 |
+ public void treeNodesChanged(TreeModelEvent e) {
|
|
| 227 |
+ |
|
| 228 |
+ model.recomputeSelectedValues();
|
|
| 229 |
+ }
|
|
| 230 |
+ |
|
| 231 |
+ @Override
|
|
| 232 |
+ public void treeNodesInserted(TreeModelEvent e) {
|
|
| 233 |
+ |
|
| 234 |
+ }
|
|
| 235 |
+ |
|
| 236 |
+ @Override
|
|
| 237 |
+ public void treeNodesRemoved(TreeModelEvent e) {
|
|
| 238 |
+ |
|
| 239 |
+ }
|
|
| 240 |
+ |
|
| 241 |
+ @Override
|
|
| 242 |
+ public void treeStructureChanged(TreeModelEvent e) {
|
|
| 243 |
+ |
|
| 244 |
+ }
|
|
| 245 |
+ |
|
| 246 |
+ });
|
|
| 247 |
+ DecoratorService decoratorService = getClientUIContext().getDecoratorService();
|
|
| 248 |
+ setDefaultRenderer(Object.class, new ActivityLlPairingTreeTableCellRenderer(this, getClientConfig(), decoratorService));
|
|
| 249 |
+ setDefaultEditor(Object.class, new ActivityLlPairingTreeTableCellEditor(this, getClientConfig(), decoratorService));
|
|
| 250 |
+ }
|
|
| 251 |
+ |
|
| 254 | 252 |
class ActivityLlPairingTreeTableCellEditor implements TableCellEditor {
|
| 255 | 253 |
|
| 256 | 254 |
private final TableCellEditor booleanEditor;
|
| ... | ... | @@ -276,14 +274,15 @@ public class ActivityLlPairingTreeTable extends JXTreeTable implements WithClien |
| 276 | 274 |
Objects.requireNonNull(node);
|
| 277 | 275 |
if (column == 1) {
|
| 278 | 276 |
if (node instanceof ActivityLlPairingActivityNode) {
|
| 279 |
- JaxxComboBox<?> component = pairingEditor.getComponent();
|
|
| 277 |
+ @SuppressWarnings("unchecked") JaxxComboBox<ActivityPairingResultItem> component = (JaxxComboBox<ActivityPairingResultItem>) pairingEditor.getComponent();
|
|
| 280 | 278 |
ActivityLlPairingActivityNode activityLlPairingActivityNode = (ActivityLlPairingActivityNode) node;
|
| 281 | 279 |
ImmutableList<ActivityPairingResultItem> availableActivities = getTreeTableModel().getAvailableActivities(activityLlPairingActivityNode);
|
| 282 | 280 |
ActivityPairingResultItem selectedValue = activityLlPairingActivityNode.getSelectedValue();
|
| 283 | 281 |
if (!availableActivities.contains(selectedValue)) {
|
| 284 | 282 |
selectedValue = null;
|
| 285 | 283 |
}
|
| 286 |
- UIHelper.fillComboBox(component.getCombobox(), availableActivities, selectedValue);
|
|
| 284 |
+ component.setData(availableActivities);
|
|
| 285 |
+ component.setSelectedItem(selectedValue);
|
|
| 287 | 286 |
editor = pairingEditor;
|
| 288 | 287 |
}
|
| 289 | 288 |
} else if (column == 2) {
|
| 1 |
-<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.h2.backup.InitStorageModel" -->
|
|
| 1 |
+<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel" -->
|
|
| 2 | 2 |
<#--
|
| 3 | 3 |
#%L
|
| 4 | 4 |
ObServe Client :: Core
|
| 1 |
-<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.h2.backup.InitStorageModel" -->
|
|
| 1 |
+<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel" -->
|
|
| 2 | 2 |
<#--
|
| 3 | 3 |
#%L
|
| 4 | 4 |
ObServe Client :: Core
|
| 1 |
-<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.h2.backup.InitStorageModel" -->
|
|
| 1 |
+<#-- @ftlvariable name=".data_model" type="fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel" -->
|
|
| 2 | 2 |
<#--
|
| 3 | 3 |
#%L
|
| 4 | 4 |
ObServe Client :: Core
|
| 1 |
-package fr.ird.observe.client.datasource.h2.backup;
|
|
| 1 |
+package fr.ird.observe.client.datasource.api.h2.backup;
|
|
| 2 | 2 |
|
| 3 | 3 |
/*-
|
| 4 | 4 |
* #%L
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.client.datasource.h2.backup; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.client.datasource.h2.backup.BackupStorage;
|
|
| 25 | 26 |
import io.ultreia.java4all.application.template.spi.GenerateTemplate;
|
| 26 | 27 |
|
| 27 | 28 |
import java.io.File;
|
| ... | ... | @@ -58,10 +58,8 @@ |
| 58 | 58 |
|
| 59 | 59 |
<JPanel constraints='BorderLayout.CENTER' layout='{new GridLayout(0,1)}'>
|
| 60 | 60 |
<JButton id="stopServerMode"/>
|
| 61 |
- <JSeparator/>
|
|
| 62 | 61 |
<JButton id="startH2WebServer"/>
|
| 63 | 62 |
<JButton id="stopH2WebServer"/>
|
| 64 |
- |
|
| 65 | 63 |
</JPanel>
|
| 66 | 64 |
|
| 67 | 65 |
</JPanel>
|
| ... | ... | @@ -28,8 +28,8 @@ import fr.ird.observe.client.datasource.api.ObserveDataSourcesManager; |
| 28 | 28 |
import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
|
| 29 | 29 |
import fr.ird.observe.client.datasource.h2.backup.BackupStorage;
|
| 30 | 30 |
import fr.ird.observe.client.datasource.h2.backup.BackupsManager;
|
| 31 |
-import fr.ird.observe.client.datasource.h2.backup.InitStorageModel;
|
|
| 32 |
-import fr.ird.observe.client.datasource.h2.backup.InitStorageModelTemplate;
|
|
| 31 |
+import fr.ird.observe.client.datasource.api.h2.backup.InitStorageModel;
|
|
| 32 |
+import fr.ird.observe.client.datasource.api.h2.backup.InitStorageModelTemplate;
|
|
| 33 | 33 |
import fr.ird.observe.client.main.ObserveMainUI;
|
| 34 | 34 |
import fr.ird.observe.client.util.ObserveSwingTechnicalException;
|
| 35 | 35 |
import fr.ird.observe.dto.db.configuration.DataSourceConnectMode;
|
| ... | ... | @@ -36,6 +36,10 @@ JToolBar { |
| 36 | 36 |
enabled: {uiModel.isStorageReloadEnabled()};
|
| 37 | 37 |
}
|
| 38 | 38 |
|
| 39 |
+#showStorageInfo {
|
|
| 40 |
+ enabled: {uiModel.isStorageCloseEnabled()};
|
|
| 41 |
+}
|
|
| 42 |
+ |
|
| 39 | 43 |
#closeStorage {
|
| 40 | 44 |
enabled: {uiModel.isStorageCloseEnabled()};
|
| 41 | 45 |
}
|
| ... | ... | @@ -81,6 +81,11 @@ |
| 81 | 81 |
<artifactId>http-api</artifactId>
|
| 82 | 82 |
<scope>provided</scope>
|
| 83 | 83 |
</dependency>
|
| 84 |
+ <dependency>
|
|
| 85 |
+ <groupId>io.ultreia.java4all.jaxx</groupId>
|
|
| 86 |
+ <artifactId>jaxx-runtime-spi</artifactId>
|
|
| 87 |
+ <scope>provided</scope>
|
|
| 88 |
+ </dependency>
|
|
| 84 | 89 |
<dependency>
|
| 85 | 90 |
<groupId>io.ultreia.java4all.i18n</groupId>
|
| 86 | 91 |
<artifactId>i18n-runtime</artifactId>
|
| ... | ... | @@ -26,6 +26,8 @@ import fr.ird.observe.dto.SimpleDto; |
| 26 | 26 |
import fr.ird.observe.dto.data.ActivityAware;
|
| 27 | 27 |
import fr.ird.observe.dto.data.ll.observation.ActivityReference;
|
| 28 | 28 |
import io.ultreia.java4all.lang.Numbers;
|
| 29 |
+import org.nuiton.decorator.Decorator;
|
|
| 30 |
+import org.nuiton.jaxx.runtime.bean.BeanDecoratorAware;
|
|
| 29 | 31 |
|
| 30 | 32 |
import java.util.Date;
|
| 31 | 33 |
import java.util.Objects;
|
| ... | ... | @@ -38,11 +40,12 @@ import static io.ultreia.java4all.i18n.I18n.t; |
| 38 | 40 |
*
|
| 39 | 41 |
* @author Tony Chemit - dev@tchemit.fr
|
| 40 | 42 |
*/
|
| 41 |
-public class ActivityPairingResultItem implements SimpleDto {
|
|
| 43 |
+public class ActivityPairingResultItem implements SimpleDto, BeanDecoratorAware {
|
|
| 42 | 44 |
|
| 43 | 45 |
private final ActivityReference observationActivity;
|
| 44 | 46 |
private final long computedTime;
|
| 45 | 47 |
private final float computedDistance;
|
| 48 |
+ protected transient Decorator<?> decorator;
|
|
| 46 | 49 |
private String computedTimeStr;
|
| 47 | 50 |
|
| 48 | 51 |
public static ActivityPairingResultItem create(ActivityAware activityLogbook, ActivityReference activityObsReference) {
|
| ... | ... | @@ -59,6 +62,16 @@ public class ActivityPairingResultItem implements SimpleDto { |
| 59 | 62 |
this.computedDistance = Numbers.roundTwoDigits((float) computedDistance);
|
| 60 | 63 |
}
|
| 61 | 64 |
|
| 65 |
+ @Override
|
|
| 66 |
+ public Decorator<?> decorator() {
|
|
| 67 |
+ return decorator;
|
|
| 68 |
+ }
|
|
| 69 |
+ |
|
| 70 |
+ @Override
|
|
| 71 |
+ public void registerDecorator(Decorator<?> decorator) {
|
|
| 72 |
+ this.decorator = Objects.requireNonNull(decorator);
|
|
| 73 |
+ }
|
|
| 74 |
+ |
|
| 62 | 75 |
public ActivityReference getObservationActivity() {
|
| 63 | 76 |
return observationActivity;
|
| 64 | 77 |
}
|
| ... | ... | @@ -102,4 +115,14 @@ public class ActivityPairingResultItem implements SimpleDto { |
| 102 | 115 |
public int hashCode() {
|
| 103 | 116 |
return Objects.hash(observationActivity);
|
| 104 | 117 |
}
|
| 118 |
+ |
|
| 119 |
+ @Override
|
|
| 120 |
+ public String toString() {
|
|
| 121 |
+ if (decorator == null) {
|
|
| 122 |
+ return super.toString();
|
|
| 123 |
+ }
|
|
| 124 |
+ return decorate();
|
|
| 125 |
+ }
|
|
| 126 |
+ |
|
| 127 |
+ |
|
| 105 | 128 |
}
|
| ... | ... | @@ -161,7 +161,7 @@ |
| 161 | 161 |
<!-- <lib.version.java4all.topia>1.43</lib.version.java4all.topia>-->
|
| 162 | 162 |
|
| 163 | 163 |
<!-- <lib.version.java4all.eugene>3.0-alpha-38</lib.version.java4all.eugene>-->
|
| 164 |
- <lib.version.java4all.jaxx>3.0.0-RC-3-SNAPSHOT</lib.version.java4all.jaxx>
|
|
| 164 |
+ <lib.version.java4all.jaxx>3.0.0-RC-3</lib.version.java4all.jaxx>
|
|
| 165 | 165 |
<!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>-->
|
| 166 | 166 |
<!--<lib.version.java4all.application-template>1.0.2-SNAPSHOT</lib.version.java4all.application-template>-->
|
| 167 | 167 |
<!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>-->
|
| ... | ... | @@ -42,8 +42,10 @@ import org.apache.logging.log4j.Logger; |
| 42 | 42 |
import org.nuiton.topia.persistence.script.SqlScriptConsumer;
|
| 43 | 43 |
import org.nuiton.topia.persistence.script.TopiaBlobsContainer;
|
| 44 | 44 |
import org.nuiton.topia.persistence.script.TopiaSqlScript;
|
| 45 |
+import org.nuiton.util.TimeLog;
|
|
| 45 | 46 |
import org.nuiton.version.Version;
|
| 46 | 47 |
|
| 48 |
+import java.util.Collections;
|
|
| 47 | 49 |
import java.util.Set;
|
| 48 | 50 |
import java.util.TreeSet;
|
| 49 | 51 |
|
| ... | ... | @@ -74,7 +76,7 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 74 | 76 |
|
| 75 | 77 |
String tripId = exportRequest.getTripId();
|
| 76 | 78 |
|
| 77 |
- log.info("Start export of trip: " + tripId);
|
|
| 79 |
+ log.info(String.format("Start export of trip: %s", tripId));
|
|
| 78 | 80 |
Version dbVersion = serviceContext.getServiceInitializer().optionalConnection().orElseThrow().getDataSourceInformation().getVersion();
|
| 79 | 81 |
|
| 80 | 82 |
AddSqlScriptProducerRequest request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres(dbVersion) : AddSqlScriptProducerRequest.forH2(dbVersion))
|
| ... | ... | @@ -89,17 +91,14 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 89 | 91 |
|
| 90 | 92 |
ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
|
| 91 | 93 |
|
| 92 |
- Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds());
|
|
| 93 |
- Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds());
|
|
| 94 |
- |
|
| 95 | 94 |
String tripId = request.getTripId();
|
| 96 | 95 |
|
| 97 | 96 |
long t0 = System.nanoTime();
|
| 98 | 97 |
|
| 99 |
- boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds);
|
|
| 98 |
+ boolean deleted = deleteTrip(persistenceContext, tripId, Collections.emptySet());
|
|
| 100 | 99 |
if (deleted) {
|
| 101 | 100 |
long time = System.nanoTime() - t0;
|
| 102 |
- log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(time));
|
|
| 101 |
+ log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(time)));
|
|
| 103 | 102 |
return new DeleteTripResult(request, time);
|
| 104 | 103 |
}
|
| 105 | 104 |
return null;
|
| ... | ... | @@ -110,24 +109,33 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 110 | 109 |
|
| 111 | 110 |
ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
|
| 112 | 111 |
|
| 113 |
- Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds());
|
|
| 114 |
- Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds());
|
|
| 115 |
- |
|
| 116 | 112 |
String tripId = request.getTripId();
|
| 117 | 113 |
|
| 118 |
- long t0 = System.nanoTime();
|
|
| 114 |
+ long t1 = TimeLog.getTime();
|
|
| 115 |
+ TopiaSqlScript sqlContent = request.getSqlContent();
|
|
| 116 |
+ // detect ids in import script
|
|
| 117 |
+ Set<String> ids = new TreeSet<>();
|
|
| 118 |
+ for (String sqlStatement : sqlContent.getLocation()) {
|
|
| 119 |
+ if (sqlStatement.toLowerCase().trim().startsWith("insert into")) {
|
|
| 120 |
+ String id = sqlStatement.substring(sqlStatement.indexOf("VALUES") + 6);
|
|
| 121 |
+ id = id.substring(id.indexOf("'") + 1);
|
|
| 122 |
+ id = id.substring(0, id.indexOf("'"));
|
|
| 123 |
+ ids.add(id);
|
|
| 124 |
+ }
|
|
| 125 |
+ }
|
|
| 126 |
+ log.info(String.format("Found in trip: %s, %d ids to import in %s.", tripId, ids.size(), Strings.convertTime(t1, System.nanoTime())));
|
|
| 127 |
+ t1 = System.nanoTime();
|
|
| 119 | 128 |
|
| 120 |
- boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds);
|
|
| 121 |
- long t1 = System.nanoTime();
|
|
| 129 |
+ boolean deleted = deleteTrip(persistenceContext, tripId, ids);
|
|
| 122 | 130 |
long deleteTime = 0;
|
| 123 | 131 |
if (deleted) {
|
| 124 |
- deleteTime = System.nanoTime() - t0;
|
|
| 125 |
- log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(deleteTime));
|
|
| 132 |
+ deleteTime = System.nanoTime() - t1;
|
|
| 133 |
+ log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(deleteTime)));
|
|
| 126 | 134 |
}
|
| 135 |
+ t1 = System.nanoTime();
|
|
| 127 | 136 |
|
| 128 |
- log.info("Start import of trip: " + request.getTripId());
|
|
| 137 |
+ log.info(String.format("Start import of trip: %s", request.getTripId()));
|
|
| 129 | 138 |
|
| 130 |
- TopiaSqlScript sqlContent = request.getSqlContent();
|
|
| 131 | 139 |
Set<TopiaBlobsContainer> blobsContainers = sqlContent.getBlobsContainers();
|
| 132 | 140 |
|
| 133 | 141 |
SqlScriptConsumer.Builder consumerBuilder = SqlScriptConsumer.builder(sqlContent.getLocation()).batchSize(1000);
|
| ... | ... | @@ -135,38 +143,42 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 135 | 143 |
consumerBuilder.blobs(blobsContainers);
|
| 136 | 144 |
}
|
| 137 | 145 |
persistenceContext.getSqlSupport().doSqlWork(consumerBuilder.build());
|
| 138 |
- |
|
| 139 |
- persistenceContext.commit();
|
|
| 146 |
+ persistenceContext.flush();
|
|
| 140 | 147 |
|
| 141 | 148 |
long t2 = System.nanoTime();
|
| 142 | 149 |
|
| 143 |
- log.info("Import of trip: " + tripId + " done in " + Strings.convertTime(t1, t2));
|
|
| 150 |
+ log.info(String.format("Import of trip: %s done in %s", tripId, Strings.convertTime(t1, t2)));
|
|
| 144 | 151 |
return new ImportTripResult(request, true, t2 - t1, deleted, deleteTime);
|
| 145 | 152 |
}
|
| 146 | 153 |
|
| 147 |
- private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> tripSeineIds, Set<String> tripLonglineIds) {
|
|
| 154 |
+ private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> ids) {
|
|
| 148 | 155 |
|
| 149 | 156 |
long t0 = System.nanoTime();
|
| 150 | 157 |
|
| 151 |
- boolean deleted = tripSeineIds.contains(tripId) || tripLonglineIds.contains(tripId);
|
|
| 158 |
+ boolean deleted = persistenceContext.exists(tripId);
|
|
| 152 | 159 |
|
| 153 | 160 |
if (deleted) {
|
| 154 |
- log.info("Start delete of trip: " + tripId);
|
|
| 161 |
+ log.info(String.format("Start delete of trip: %s", tripId));
|
|
| 155 | 162 |
DeleteSqlScriptProducerRequest sqlRequest = DeleteSqlScriptProducerRequest.of(tripId);
|
| 156 | 163 |
TopiaSqlScript sqlScript = sqlScriptProducerService.produceDeleteSqlScript(sqlRequest);
|
| 157 | 164 |
|
| 158 |
- //FIXME Make sure this always work!!! For the moment stay as before
|
|
| 159 |
-// if (tripLonglineIds.contains(tripId) && serviceContext.getTopiaApplicationContext().getConfiguration().isH2Configuration()) {
|
|
| 160 |
-// serviceContext.getTopiaApplicationContext().executeSqlStatementsWithH2AndRemoveIntegrity(persistenceContext, sqlScript);
|
|
| 161 |
-// } else {
|
|
| 162 |
-// persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript));
|
|
| 163 |
-// }
|
|
| 164 | 165 |
persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript));
|
| 165 | 166 |
|
| 166 |
- log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(t0, System.nanoTime()));
|
|
| 167 |
- persistenceContext.commit();
|
|
| 167 |
+ log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(t0, System.nanoTime())));
|
|
| 168 |
+ persistenceContext.flush();
|
|
| 169 |
+ }
|
|
| 170 |
+ Set<String> existingIds = new TreeSet<>();
|
|
| 171 |
+ if (!ids.isEmpty()) {
|
|
| 172 |
+ for (String id : ids) {
|
|
| 173 |
+ if (persistenceContext.exists(id)) {
|
|
| 174 |
+ log.error(String.format("Can't import trip %s, - found existing id in target database (%s)", tripId, id));
|
|
| 175 |
+ existingIds.add(id);
|
|
| 176 |
+ }
|
|
| 177 |
+ }
|
|
| 178 |
+ }
|
|
| 179 |
+ if (!existingIds.isEmpty()) {
|
|
| 180 |
+ 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)));
|
|
| 168 | 181 |
}
|
| 169 | 182 |
return deleted;
|
| 170 | 183 |
}
|
| 171 |
- |
|
| 172 | 184 |
}
|