Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
b6e9c668
by Tony Chemit at 2020-05-13T17:09:08+02:00
-
00924f75
by Tony Chemit at 2020-05-13T17:09:10+02:00
-
b7dc0bc2
by Tony Chemit at 2020-05-13T17:09:10+02:00
28 changed files:
- client-core/src/main/i18n/getters/java.getter
- client-core/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/CancelRemoteUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/CancelServerUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DeleteRemoteUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DeleteServerUIAction.java
- + client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DuplicateRemoteUIAction.java
- + client-core/src/main/java/fr/ird/observe/client/ui/actions/storage/presets/DuplicateServerUIAction.java
- client-core/src/main/java/fr/ird/observe/client/ui/storage/presets/RemotePresetsUI.jaxx
- client-core/src/main/java/fr/ird/observe/client/ui/storage/presets/RemotePresetsUI.jcss
- client-core/src/main/java/fr/ird/observe/client/ui/storage/presets/RemotePresetsUIHandler.java
- dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java
- observe-i18n/src/main/i18n/translations/observe_en_GB.properties
- observe-i18n/src/main/i18n/translations/observe_es_ES.properties
- observe-i18n/src/main/i18n/translations/observe_fr_FR.properties
- + persistence/.mvn/i18n/parse-java
- persistence/pom.xml
- + persistence/src/main/i18n/getters/java.getter
- persistence/src/main/java/fr/ird/observe/entities/referentiel/DuplicateLengthLengthParameterException.java
- persistence/src/main/java/fr/ird/observe/entities/referentiel/DuplicateLengthWeightParameterException.java
- persistence/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameterNotFoundException.java
- persistence/src/main/java/fr/ird/observe/entities/referentiel/LengthLengthParameters.java
- persistence/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameterNotFoundException.java
- persistence/src/main/java/fr/ird/observe/entities/referentiel/LengthWeightParameters.java
- pom.xml
- services-local/src/main/java/fr/ird/observe/services/local/service/actions/consolidate/ConsolidateDataServiceLocal.java
- services-local/src/main/java/fr/ird/observe/services/local/service/actions/consolidate/ConsolidationActivitySeineDataContext.java
- services-local/src/test/java/fr/ird/observe/services/local/entity/LengthWeightParemetersTest.java
Changes:
| ... | ... | @@ -44,6 +44,9 @@ observe.action.delete.remote.tip |
| 44 | 44 |
observe.action.delete.server.tip
|
| 45 | 45 |
observe.action.delete.tip
|
| 46 | 46 |
observe.action.detail
|
| 47 |
+observe.action.duplicate
|
|
| 48 |
+observe.action.duplicate.remote.tip
|
|
| 49 |
+observe.action.duplicate.server.tip
|
|
| 47 | 50 |
observe.action.exit
|
| 48 | 51 |
observe.action.exit.tip
|
| 49 | 52 |
observe.action.floatingObjectPresets
|
| ... | ... | @@ -86,6 +86,7 @@ public abstract class ObserveKeyStrokes { |
| 86 | 86 |
public static final KeyStroke KEY_STROKE_RESET_DATA = KeyStroke.getKeyStroke("pressed F7");
|
| 87 | 87 |
public static final KeyStroke KEY_STROKE_NEW_NEXT_DATA = KeyStroke.getKeyStroke("pressed F4");
|
| 88 | 88 |
public static final KeyStroke KEY_STROKE_DELETE_DATA_GLOBAL = KeyStroke.getKeyStroke("pressed F6");
|
| 89 |
+ public static final KeyStroke KEY_STROKE_DUPLICATE = KeyStroke.getKeyStroke("pressed F2");
|
|
| 89 | 90 |
public static final KeyStroke KEY_STROKE_OPEN_DATA = KeyStroke.getKeyStroke("pressed F2");
|
| 90 | 91 |
public static final KeyStroke KEY_STROKE_CLOSE_DATA = KeyStroke.getKeyStroke("pressed F3");
|
| 91 | 92 |
public static final KeyStroke KEY_STROKE_SAVE_DATA = KeyStroke.getKeyStroke("pressed F5");
|
| ... | ... | @@ -57,6 +57,8 @@ public class CancelRemoteUIAction extends PresetsUIActionSupport { |
| 57 | 57 |
ObserveSwingApplicationContext.get().getConfig().removeRemoteDataSourceConfiguration(configuration);
|
| 58 | 58 |
ui.getModel().setRemoteDataSourceConfiguration(null);
|
| 59 | 59 |
ui.getModel().setRemoteCreateMode(false);
|
| 60 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 61 |
+ ui.getRemoteConfigurations().setSelectedIndex(newConfiguration);
|
|
| 60 | 62 |
}
|
| 61 | 63 |
|
| 62 | 64 |
}
|
| ... | ... | @@ -57,6 +57,8 @@ public class CancelServerUIAction extends PresetsUIActionSupport { |
| 57 | 57 |
ObserveSwingApplicationContext.get().getConfig().removeServerDataSourceConfiguration(configuration);
|
| 58 | 58 |
ui.getModel().setServerDataSourceConfiguration(null);
|
| 59 | 59 |
ui.getModel().setServerCreateMode(false);
|
| 60 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 61 |
+ ui.getServerConfigurations().setSelectedIndex(newConfiguration);
|
|
| 60 | 62 |
}
|
| 61 | 63 |
|
| 62 | 64 |
}
|
| ... | ... | @@ -69,6 +69,8 @@ public class DeleteRemoteUIAction extends PresetsUIActionSupport { |
| 69 | 69 |
ui.getModel().setRemoteDataSourceConfigurations(configurations);
|
| 70 | 70 |
ObserveSwingApplicationContext.get().getConfig().removeRemoteDataSourceConfiguration(configuration);
|
| 71 | 71 |
ui.getModel().setRemoteDataSourceConfiguration(null);
|
| 72 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 73 |
+ ui.getRemoteConfigurations().setSelectedIndex(newConfiguration);
|
|
| 72 | 74 |
}
|
| 73 | 75 |
}
|
| 74 | 76 |
}
|
| ... | ... | @@ -71,6 +71,8 @@ public class DeleteServerUIAction extends PresetsUIActionSupport { |
| 71 | 71 |
ui.getModel().setServerDataSourceConfigurations(configurations);
|
| 72 | 72 |
ObserveSwingApplicationContext.get().getConfig().removeServerDataSourceConfiguration(configuration);
|
| 73 | 73 |
ui.getModel().setServerDataSourceConfiguration(null);
|
| 74 |
+ int newConfiguration = configurations.isEmpty() ? -1 : 0;
|
|
| 75 |
+ ui.getServerConfigurations().setSelectedIndex(newConfiguration);
|
|
| 74 | 76 |
}
|
| 75 | 77 |
|
| 76 | 78 |
}
|
| 1 |
+package fr.ird.observe.client.ui.actions.storage.presets;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client core
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2020 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.ui.ObserveKeyStrokes;
|
|
| 26 |
+import fr.ird.observe.client.ui.ObserveMainUI;
|
|
| 27 |
+import fr.ird.observe.client.ui.storage.presets.RemotePresetsUI;
|
|
| 28 |
+import fr.ird.observe.dto.presets.RemoteDataSourceConfiguration;
|
|
| 29 |
+ |
|
| 30 |
+import java.util.ArrayList;
|
|
| 31 |
+import java.util.List;
|
|
| 32 |
+ |
|
| 33 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 34 |
+ |
|
| 35 |
+public class DuplicateRemoteUIAction extends PresetsUIActionSupport {
|
|
| 36 |
+ |
|
| 37 |
+ public static final String ACTION_NAME = DuplicateRemoteUIAction.class.getName();
|
|
| 38 |
+ |
|
| 39 |
+ public DuplicateRemoteUIAction(ObserveMainUI mainUI) {
|
|
| 40 |
+ super(mainUI, ACTION_NAME, n("observe.action.duplicate"), n("observe.action.duplicate.remote.tip"), "mode-create", ObserveKeyStrokes.KEY_STROKE_DUPLICATE);
|
|
| 41 |
+ }
|
|
| 42 |
+ |
|
| 43 |
+ @Override
|
|
| 44 |
+ protected void doActionPerformed(RemotePresetsUI ui) {
|
|
| 45 |
+ |
|
| 46 |
+ RemoteDataSourceConfiguration incomingConfiguration = ui.getModel().getRemoteDataSourceConfiguration();
|
|
| 47 |
+ |
|
| 48 |
+ RemoteDataSourceConfiguration configuration = new RemoteDataSourceConfiguration();
|
|
| 49 |
+ |
|
| 50 |
+ configuration.setLogin(incomingConfiguration.getLogin());
|
|
| 51 |
+ configuration.setPassword(incomingConfiguration.getPassword());
|
|
| 52 |
+ configuration.setName(incomingConfiguration.getName() + " (Copie)");
|
|
| 53 |
+ configuration.setUrl(incomingConfiguration.getUrl());
|
|
| 54 |
+ |
|
| 55 |
+ List<RemoteDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getRemoteDataSourceConfigurations());
|
|
| 56 |
+ configurations.add(configuration);
|
|
| 57 |
+ ui.getModel().setRemoteDataSourceConfigurations(configurations);
|
|
| 58 |
+ ui.getModel().setRemoteCreateMode(true);
|
|
| 59 |
+ ui.getRemoteConfigurations().setSelectedValue(configuration, true);
|
|
| 60 |
+ }
|
|
| 61 |
+}
|
| 1 |
+package fr.ird.observe.client.ui.actions.storage.presets;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client core
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2020 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.ui.ObserveKeyStrokes;
|
|
| 26 |
+import fr.ird.observe.client.ui.ObserveMainUI;
|
|
| 27 |
+import fr.ird.observe.client.ui.storage.presets.RemotePresetsUI;
|
|
| 28 |
+import fr.ird.observe.dto.presets.ServerDataSourceConfiguration;
|
|
| 29 |
+ |
|
| 30 |
+import java.util.ArrayList;
|
|
| 31 |
+import java.util.List;
|
|
| 32 |
+ |
|
| 33 |
+import static io.ultreia.java4all.i18n.I18n.n;
|
|
| 34 |
+ |
|
| 35 |
+public class DuplicateServerUIAction extends PresetsUIActionSupport {
|
|
| 36 |
+ |
|
| 37 |
+ public static final String ACTION_NAME = DuplicateServerUIAction.class.getName();
|
|
| 38 |
+ |
|
| 39 |
+ public DuplicateServerUIAction(ObserveMainUI mainUI) {
|
|
| 40 |
+ super(mainUI, ACTION_NAME, n("observe.action.duplicate"), n("observe.action.duplicate.server.tip"), "mode-create", ObserveKeyStrokes.KEY_STROKE_DUPLICATE);
|
|
| 41 |
+ }
|
|
| 42 |
+ |
|
| 43 |
+ @Override
|
|
| 44 |
+ protected void doActionPerformed(RemotePresetsUI ui) {
|
|
| 45 |
+ |
|
| 46 |
+ ServerDataSourceConfiguration incomingConfiguration = ui.getModel().getServerDataSourceConfiguration();
|
|
| 47 |
+ ServerDataSourceConfiguration configuration = new ServerDataSourceConfiguration();
|
|
| 48 |
+ |
|
| 49 |
+ configuration.setDatabaseName(incomingConfiguration.getDatabaseName());
|
|
| 50 |
+ configuration.setLogin(incomingConfiguration.getLogin());
|
|
| 51 |
+ configuration.setPassword(incomingConfiguration.getPassword());
|
|
| 52 |
+ configuration.setName(incomingConfiguration.getName() + " (Copie)");
|
|
| 53 |
+ configuration.setUrl(incomingConfiguration.getUrl());
|
|
| 54 |
+ |
|
| 55 |
+ List<ServerDataSourceConfiguration> configurations = new ArrayList<>(ui.getModel().getServerDataSourceConfigurations());
|
|
| 56 |
+ configurations.add(configuration);
|
|
| 57 |
+ ui.getModel().setServerDataSourceConfigurations(configurations);
|
|
| 58 |
+ ui.getModel().setServerCreateMode(true);
|
|
| 59 |
+ ui.getServerConfigurations().setSelectedValue(configuration, true);
|
|
| 60 |
+ |
|
| 61 |
+ }
|
|
| 62 |
+}
|
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 |
<http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 |
#L%
|
| 21 | 21 |
-->
|
| 22 |
-<JPanel layout="{new BorderLayout()}">
|
|
| 22 |
+<org.jdesktop.swingx.JXTitledPanel id="dataSourcePresets">
|
|
| 23 | 23 |
|
| 24 | 24 |
<import>
|
| 25 | 25 |
fr.ird.observe.dto.presets.RemoteDataSourceConfiguration
|
| ... | ... | @@ -28,6 +28,8 @@ |
| 28 | 28 |
fr.ird.observe.client.ui.actions.storage.presets.CreatePresetUIAction
|
| 29 | 29 |
fr.ird.observe.client.ui.actions.storage.presets.DeleteRemoteUIAction
|
| 30 | 30 |
fr.ird.observe.client.ui.actions.storage.presets.DeleteServerUIAction
|
| 31 |
+ fr.ird.observe.client.ui.actions.storage.presets.DuplicateRemoteUIAction
|
|
| 32 |
+ fr.ird.observe.client.ui.actions.storage.presets.DuplicateServerUIAction
|
|
| 31 | 33 |
fr.ird.observe.client.ui.actions.storage.presets.QuitPresetsUIAction
|
| 32 | 34 |
fr.ird.observe.client.ui.actions.storage.presets.CancelRemoteUIAction
|
| 33 | 35 |
fr.ird.observe.client.ui.actions.storage.presets.ResetRemoteUIAction
|
| ... | ... | @@ -39,24 +41,26 @@ |
| 39 | 41 |
fr.ird.observe.client.ui.actions.storage.presets.TestServerUIAction
|
| 40 | 42 |
|
| 41 | 43 |
org.nuiton.jaxx.widgets.select.BeanComboBox
|
| 42 |
- |
|
| 44 |
+ java.awt.CardLayout
|
|
| 43 | 45 |
</import>
|
| 44 | 46 |
|
| 45 | 47 |
<RemotePresetsUIModel id="model" initializer="getContextValue(RemotePresetsUIModel.class)"/>
|
| 46 | 48 |
|
| 47 | 49 |
<JTabbedPane id='tabs' constraints='BorderLayout.CENTER'>
|
| 48 | 50 |
<tab id='remoteTab' title="observe.storage.remote.presets.title">
|
| 49 |
- <JSplitPane id="remotePanel">
|
|
| 50 |
- <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/>
|
|
| 51 |
- <JPanel id="remoteContentPanel" layout="{new BorderLayout()}">
|
|
| 52 |
- <JLabel id="noRemoteSelected" constraints='BorderLayout.CENTER'/>
|
|
| 53 |
- <Table id="remoteForm" constraints='BorderLayout.SOUTH' fill="both">
|
|
| 51 |
+ <JPanel id="remotePanel" layout="{new BorderLayout()}">
|
|
| 52 |
+ <JScrollPane id='remoteConfigurationsPane' constraints='BorderLayout.CENTER'>
|
|
| 53 |
+ <JList id='remoteConfigurations' genericType="RemoteDataSourceConfiguration"/>
|
|
| 54 |
+ </JScrollPane>
|
|
| 55 |
+ <JPanel id="remoteContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'>
|
|
| 56 |
+ <JLabel id="noRemoteSelected" constraints='"empty"'/>
|
|
| 57 |
+ <Table id="remoteForm" constraints='"form"' fill="both">
|
|
| 54 | 58 |
<row>
|
| 55 | 59 |
<cell anchor='west'>
|
| 56 | 60 |
<JLabel text='observe.storage.remote.name'/>
|
| 57 | 61 |
</cell>
|
| 58 | 62 |
<cell weightx='1' fill="both" anchor='east'>
|
| 59 |
- <JTextField id="remoteName" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 63 |
+ <JTextField id="remoteName" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 60 | 64 |
</cell>
|
| 61 | 65 |
</row>
|
| 62 | 66 |
<row>
|
| ... | ... | @@ -64,7 +68,7 @@ |
| 64 | 68 |
<JLabel text='observe.storage.remote.url'/>
|
| 65 | 69 |
</cell>
|
| 66 | 70 |
<cell weightx='1' fill="both" anchor='east'>
|
| 67 |
- <JTextField id="remoteUrl" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 71 |
+ <JTextField id="remoteUrl" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 68 | 72 |
</cell>
|
| 69 | 73 |
</row>
|
| 70 | 74 |
<row>
|
| ... | ... | @@ -72,7 +76,7 @@ |
| 72 | 76 |
<JLabel text='observe.storage.remote.login'/>
|
| 73 | 77 |
</cell>
|
| 74 | 78 |
<cell weightx='1' fill="both" anchor='east'>
|
| 75 |
- <JTextField id="remoteLogin" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 79 |
+ <JTextField id="remoteLogin" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 76 | 80 |
</cell>
|
| 77 | 81 |
</row>
|
| 78 | 82 |
<row>
|
| ... | ... | @@ -80,7 +84,7 @@ |
| 80 | 84 |
<JLabel text='observe.storage.remote.password'/>
|
| 81 | 85 |
</cell>
|
| 82 | 86 |
<cell weightx='1' fill="both" anchor='east'>
|
| 83 |
- <JTextField id="remotePassword" onKeyReleased="model.setRemoteModified(true);"/>
|
|
| 87 |
+ <JTextField id="remotePassword" onKeyReleased="handler.setRemoteModified(event);"/>
|
|
| 84 | 88 |
</cell>
|
| 85 | 89 |
</row>
|
| 86 | 90 |
<row>
|
| ... | ... | @@ -97,26 +101,29 @@ |
| 97 | 101 |
<JButton id="saveRemoteAction"/>
|
| 98 | 102 |
<JButton id="deleteRemoteAction"/>
|
| 99 | 103 |
<JButton id="testRemoteAction"/>
|
| 104 |
+ <JButton id="duplicateRemoteAction"/>
|
|
| 100 | 105 |
</JPanel>
|
| 101 | 106 |
</cell>
|
| 102 | 107 |
</row>
|
| 103 | 108 |
</Table>
|
| 104 | 109 |
</JPanel>
|
| 105 |
- </JSplitPane>
|
|
| 110 |
+ </JPanel>
|
|
| 106 | 111 |
</tab>
|
| 107 | 112 |
<tab id='serverTab' title="observe.storage.server.presets.title">
|
| 108 | 113 |
|
| 109 |
- <JSplitPane id="serverPanel">
|
|
| 110 |
- <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/>
|
|
| 111 |
- <JPanel id="serverContentPanel" layout="{new BorderLayout()}">
|
|
| 112 |
- <JLabel id="noServerSelected" constraints='BorderLayout.CENTER'/>
|
|
| 113 |
- <Table id="serverForm" constraints='BorderLayout.SOUTH' fill="both">
|
|
| 114 |
+ <JPanel id="serverPanel" layout="{new BorderLayout()}" >
|
|
| 115 |
+ <JScrollPane id='serverConfigurationsPane' constraints='BorderLayout.CENTER'>
|
|
| 116 |
+ <JList id='serverConfigurations' genericType="ServerDataSourceConfiguration"/>
|
|
| 117 |
+ </JScrollPane>
|
|
| 118 |
+ <JPanel id="serverContentPanel" layout="{new CardLayout()}" constraints='BorderLayout.SOUTH' border='{new TitledBorder("")}'>
|
|
| 119 |
+ <JLabel id="noServerSelected" constraints='"empty"'/>
|
|
| 120 |
+ <Table id="serverForm" constraints='"form"' fill="both">
|
|
| 114 | 121 |
<row>
|
| 115 | 122 |
<cell anchor='west'>
|
| 116 | 123 |
<JLabel text='observe.storage.remote.name'/>
|
| 117 | 124 |
</cell>
|
| 118 | 125 |
<cell weightx='1' fill="both" anchor='east'>
|
| 119 |
- <JTextField id="serverName" onKeyReleased="model.setServerModified(true);"/>
|
|
| 126 |
+ <JTextField id="serverName" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 120 | 127 |
</cell>
|
| 121 | 128 |
</row>
|
| 122 | 129 |
<row>
|
| ... | ... | @@ -124,7 +131,7 @@ |
| 124 | 131 |
<JLabel text='observe.storage.remote.url'/>
|
| 125 | 132 |
</cell>
|
| 126 | 133 |
<cell weightx='1' fill="both" anchor='east'>
|
| 127 |
- <JTextField id="serverUrl" onKeyReleased="model.setServerModified(true);"/>
|
|
| 134 |
+ <JTextField id="serverUrl" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 128 | 135 |
</cell>
|
| 129 | 136 |
</row>
|
| 130 | 137 |
<row>
|
| ... | ... | @@ -132,7 +139,7 @@ |
| 132 | 139 |
<JLabel text='observe.storage.remote.login'/>
|
| 133 | 140 |
</cell>
|
| 134 | 141 |
<cell weightx='1' fill="both" anchor='east'>
|
| 135 |
- <JTextField id="serverLogin" onKeyReleased="model.setServerModified(true);"/>
|
|
| 142 |
+ <JTextField id="serverLogin" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 136 | 143 |
</cell>
|
| 137 | 144 |
</row>
|
| 138 | 145 |
<row>
|
| ... | ... | @@ -140,7 +147,7 @@ |
| 140 | 147 |
<JLabel text='observe.storage.remote.password'/>
|
| 141 | 148 |
</cell>
|
| 142 | 149 |
<cell weightx='1' fill="both" anchor='east'>
|
| 143 |
- <JTextField id="serverPassword" onKeyReleased="model.setServerModified(true);"/>
|
|
| 150 |
+ <JTextField id="serverPassword" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 144 | 151 |
</cell>
|
| 145 | 152 |
</row>
|
| 146 | 153 |
<row>
|
| ... | ... | @@ -148,7 +155,7 @@ |
| 148 | 155 |
<JLabel id="serverDataBaseLabel" text='observe.storage.server.dataBase'/>
|
| 149 | 156 |
</cell>
|
| 150 | 157 |
<cell weightx='1' fill="both" anchor='east'>
|
| 151 |
- <JTextField id="serverDataBase" onKeyReleased="model.setServerModified(true);"/>
|
|
| 158 |
+ <JTextField id="serverDataBase" onKeyReleased="handler.setServerModified(event);"/>
|
|
| 152 | 159 |
</cell>
|
| 153 | 160 |
</row>
|
| 154 | 161 |
|
| ... | ... | @@ -160,12 +167,13 @@ |
| 160 | 167 |
<JButton id="saveServerAction"/>
|
| 161 | 168 |
<JButton id="deleteServerAction"/>
|
| 162 | 169 |
<JButton id="testServerAction"/>
|
| 170 |
+ <JButton id="duplicateServerAction"/>
|
|
| 163 | 171 |
</JPanel>
|
| 164 | 172 |
</cell>
|
| 165 | 173 |
</row>
|
| 166 | 174 |
</Table>
|
| 167 | 175 |
</JPanel>
|
| 168 |
- </JSplitPane>
|
|
| 176 |
+ </JPanel>
|
|
| 169 | 177 |
</tab>
|
| 170 | 178 |
</JTabbedPane>
|
| 171 | 179 |
|
| ... | ... | @@ -174,4 +182,4 @@ |
| 174 | 182 |
<JButton id="quitAction"/>
|
| 175 | 183 |
</JPanel>
|
| 176 | 184 |
|
| 177 |
-</JPanel>
|
|
| 185 |
+</org.jdesktop.swingx.JXTitledPanel>
|
| ... | ... | @@ -21,15 +21,10 @@ |
| 21 | 21 |
*/
|
| 22 | 22 |
|
| 23 | 23 |
#noRemoteSelected {
|
| 24 |
- visible: true;
|
|
| 25 | 24 |
text:"observe.storage.presets.no.selected";
|
| 26 | 25 |
horizontalAlignment: center;
|
| 27 | 26 |
}
|
| 28 | 27 |
|
| 29 |
-#remoteForm {
|
|
| 30 |
- visible: false;
|
|
| 31 |
-}
|
|
| 32 |
- |
|
| 33 | 28 |
#remoteName {
|
| 34 | 29 |
text:{SwingUtil.getStringValue(model.getRemoteDataSourceConfiguration().getName())};
|
| 35 | 30 |
}
|
| ... | ... | @@ -52,15 +47,10 @@ |
| 52 | 47 |
}
|
| 53 | 48 |
|
| 54 | 49 |
#noServerSelected {
|
| 55 |
- visible: true;
|
|
| 56 | 50 |
text:"observe.storage.presets.no.selected";
|
| 57 | 51 |
horizontalAlignment: center;
|
| 58 | 52 |
}
|
| 59 | 53 |
|
| 60 |
-#serverForm {
|
|
| 61 |
- visible: false;
|
|
| 62 |
-}
|
|
| 63 |
- |
|
| 64 | 54 |
#serverName {
|
| 65 | 55 |
text:{SwingUtil.getStringValue(model.getServerDataSourceConfiguration().getName())};
|
| 66 | 56 |
}
|
| ... | ... | @@ -87,6 +77,7 @@ |
| 87 | 77 |
|
| 88 | 78 |
#resetRemoteAction {
|
| 89 | 79 |
_observeAction:{ResetRemoteUIAction.ACTION_NAME};
|
| 80 |
+ enabled:{model.isRemoteModified()};
|
|
| 90 | 81 |
}
|
| 91 | 82 |
|
| 92 | 83 |
#saveRemoteAction {
|
| ... | ... | @@ -98,6 +89,10 @@ |
| 98 | 89 |
_observeAction:{DeleteRemoteUIAction.ACTION_NAME};
|
| 99 | 90 |
}
|
| 100 | 91 |
|
| 92 |
+#duplicateRemoteAction {
|
|
| 93 |
+ _observeAction:{DuplicateRemoteUIAction.ACTION_NAME};
|
|
| 94 |
+}
|
|
| 95 |
+ |
|
| 101 | 96 |
#testRemoteAction {
|
| 102 | 97 |
_observeAction:{TestRemoteUIAction.ACTION_NAME};
|
| 103 | 98 |
}
|
| ... | ... | @@ -120,6 +115,10 @@ |
| 120 | 115 |
_observeAction:{DeleteServerUIAction.ACTION_NAME};
|
| 121 | 116 |
}
|
| 122 | 117 |
|
| 118 |
+#duplicateServerAction {
|
|
| 119 |
+ _observeAction:{DuplicateServerUIAction.ACTION_NAME};
|
|
| 120 |
+}
|
|
| 121 |
+ |
|
| 123 | 122 |
#testServerAction {
|
| 124 | 123 |
_observeAction:{TestServerUIAction.ACTION_NAME};
|
| 125 | 124 |
}
|
| ... | ... | @@ -44,7 +44,7 @@ import javax.swing.JPanel; |
| 44 | 44 |
import javax.swing.JSplitPane;
|
| 45 | 45 |
import javax.swing.KeyStroke;
|
| 46 | 46 |
import javax.swing.SwingUtilities;
|
| 47 |
-import java.awt.BorderLayout;
|
|
| 47 |
+import java.awt.CardLayout;
|
|
| 48 | 48 |
import java.awt.event.KeyEvent;
|
| 49 | 49 |
import java.util.List;
|
| 50 | 50 |
import java.util.Objects;
|
| ... | ... | @@ -105,6 +105,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 105 | 105 |
ui.getModel().setRemoteModified(false);
|
| 106 | 106 |
} else {
|
| 107 | 107 |
ui.getModel().setRemoteDataSourceConfiguration(ui.getRemoteConfigurations().getSelectedValue());
|
| 108 |
+ ui.getRemoteName().requestFocusInWindow();
|
|
| 108 | 109 |
}
|
| 109 | 110 |
});
|
| 110 | 111 |
|
| ... | ... | @@ -124,17 +125,12 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 124 | 125 |
ui.getModel().addPropertyChangeListener("remoteDataSourceConfiguration", evt -> {
|
| 125 | 126 |
|
| 126 | 127 |
RemoteDataSourceConfiguration oldValue = (RemoteDataSourceConfiguration) evt.getOldValue();
|
| 127 |
- |
|
| 128 | 128 |
if (ui.getModel().getRemoteDataSourceConfiguration() == null) {
|
| 129 |
- ui.getRemoteContentPanel().remove(ui.getRemoteForm());
|
|
| 130 |
- ui.getRemoteContentPanel().add(ui.getNoRemoteSelected(), BorderLayout.CENTER);
|
|
| 131 |
- UIHelper.askFocus(ui.getCreateAction());
|
|
| 129 |
+ ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "empty");
|
|
| 130 |
+ ui.getCreateAction().requestFocusInWindow();
|
|
| 132 | 131 |
} else {
|
| 133 | 132 |
if (oldValue == null) {
|
| 134 |
- ui.getRemoteForm().setVisible(true);
|
|
| 135 |
- ui.getRemoteContentPanel().remove(ui.getNoRemoteSelected());
|
|
| 136 |
- ui.getRemoteContentPanel().add(ui.getRemoteForm(), BorderLayout.CENTER);
|
|
| 137 |
- UIHelper.askFocus(ui.getRemoteName());
|
|
| 133 |
+ ((CardLayout) ui.getRemoteContentPanel().getLayout()).show(ui.getRemoteContentPanel(), "form");
|
|
| 138 | 134 |
}
|
| 139 | 135 |
ui.getModel().setRemoteModified(false);
|
| 140 | 136 |
}
|
| ... | ... | @@ -146,10 +142,12 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 146 | 142 |
if ((Boolean) evt.getNewValue()) {
|
| 147 | 143 |
remoteActions.remove(ui.getResetRemoteAction());
|
| 148 | 144 |
remoteActions.remove(ui.getDeleteRemoteAction());
|
| 145 |
+ remoteActions.remove(ui.getDuplicateRemoteAction());
|
|
| 149 | 146 |
remoteActions.add(ui.getCancelRemoteAction(), 0);
|
| 150 | 147 |
} else {
|
| 151 | 148 |
remoteActions.add(ui.getResetRemoteAction(), 0);
|
| 152 | 149 |
remoteActions.add(ui.getDeleteRemoteAction(), 2);
|
| 150 |
+ remoteActions.add(ui.getDuplicateRemoteAction());
|
|
| 153 | 151 |
remoteActions.remove(ui.getCancelRemoteAction());
|
| 154 | 152 |
}
|
| 155 | 153 |
});
|
| ... | ... | @@ -169,6 +167,7 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 169 | 167 |
ui.getModel().setServerModified(false);
|
| 170 | 168 |
} else {
|
| 171 | 169 |
ui.getModel().setServerDataSourceConfiguration(ui.getServerConfigurations().getSelectedValue());
|
| 170 |
+ ui.getServerName().requestFocusInWindow();
|
|
| 172 | 171 |
}
|
| 173 | 172 |
});
|
| 174 | 173 |
|
| ... | ... | @@ -190,15 +189,11 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 190 | 189 |
ServerDataSourceConfiguration oldValue = (ServerDataSourceConfiguration) evt.getOldValue();
|
| 191 | 190 |
|
| 192 | 191 |
if (ui.getModel().getServerDataSourceConfiguration() == null) {
|
| 193 |
- ui.getServerContentPanel().remove(ui.getServerForm());
|
|
| 194 |
- ui.getServerContentPanel().add(ui.getNoServerSelected(), BorderLayout.CENTER);
|
|
| 195 |
- UIHelper.askFocus(ui.getCreateAction());
|
|
| 192 |
+ ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "empty");
|
|
| 193 |
+ ui.getCreateAction().requestFocusInWindow();
|
|
| 196 | 194 |
} else {
|
| 197 | 195 |
if (oldValue == null) {
|
| 198 |
- ui.getServerForm().setVisible(true);
|
|
| 199 |
- ui.getServerContentPanel().remove(ui.getNoServerSelected());
|
|
| 200 |
- ui.getServerContentPanel().add(ui.getServerForm(), BorderLayout.CENTER);
|
|
| 201 |
- UIHelper.askFocus(ui.getServerName());
|
|
| 196 |
+ ((CardLayout) ui.getServerContentPanel().getLayout()).show(ui.getServerContentPanel(), "form");
|
|
| 202 | 197 |
}
|
| 203 | 198 |
ui.getModel().setServerModified(false);
|
| 204 | 199 |
}
|
| ... | ... | @@ -210,11 +205,13 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 210 | 205 |
if ((Boolean) evt.getNewValue()) {
|
| 211 | 206 |
serverActions.remove(ui.getResetServerAction());
|
| 212 | 207 |
serverActions.remove(ui.getDeleteServerAction());
|
| 208 |
+ serverActions.remove(ui.getDuplicateServerAction());
|
|
| 213 | 209 |
serverActions.add(ui.getCancelServerAction(), 0);
|
| 214 | 210 |
} else {
|
| 215 | 211 |
|
| 216 | 212 |
serverActions.add(ui.getResetServerAction(), 0);
|
| 217 | 213 |
serverActions.add(ui.getDeleteServerAction(), 2);
|
| 214 |
+ serverActions.add(ui.getDuplicateServerAction());
|
|
| 218 | 215 |
serverActions.remove(ui.getCancelServerAction());
|
| 219 | 216 |
}
|
| 220 | 217 |
});
|
| ... | ... | @@ -222,6 +219,13 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 222 | 219 |
ui.getServerActions().remove(0);
|
| 223 | 220 |
UIHelper.askFocus(ui.getCreateAction());
|
| 224 | 221 |
|
| 222 |
+ if (ui.getRemoteConfigurations().getModel().getSize()>0) {
|
|
| 223 |
+ ui.getRemoteConfigurations().setSelectedIndex(0);
|
|
| 224 |
+ }
|
|
| 225 |
+ |
|
| 226 |
+ if (ui.getServerConfigurations().getModel().getSize()>0) {
|
|
| 227 |
+ ui.getServerConfigurations().setSelectedIndex(0);
|
|
| 228 |
+ }
|
|
| 225 | 229 |
}
|
| 226 | 230 |
|
| 227 | 231 |
protected void init(JSplitPane editor) {
|
| ... | ... | @@ -243,8 +247,33 @@ public class RemotePresetsUIHandler implements UIHandler<RemotePresetsUI> { |
| 243 | 247 |
log.debug("init common action " + actionId);
|
| 244 | 248 |
}
|
| 245 | 249 |
|
| 250 |
+ if (actionId.contains("Remote")) {
|
|
| 251 |
+ inputMap = ui.getRemoteContentPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
| 252 |
+ actionMap = ui.getRemoteContentPanel().getActionMap();
|
|
| 253 |
+ } else if (actionId.contains("Server")) {
|
|
| 254 |
+ inputMap = ui.getServerContentPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
| 255 |
+ actionMap = ui.getServerContentPanel().getActionMap();
|
|
| 256 |
+ } else {
|
|
| 257 |
+ inputMap = ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
|
|
| 258 |
+ actionMap = ui.getActionMap();
|
|
| 259 |
+ }
|
|
| 246 | 260 |
action.initForMainUi(editor, inputMap, actionMap);
|
| 247 | 261 |
editor.putClientProperty(UIActionSupport.CLIENT_PROPERTY_UI, ui);
|
| 248 | 262 |
|
| 249 | 263 |
}
|
| 264 |
+ |
|
| 265 |
+ protected void setServerModified(KeyEvent event) {
|
|
| 266 |
+ if (event.isActionKey()) {
|
|
| 267 |
+ return;
|
|
| 268 |
+ }
|
|
| 269 |
+ ui.getModel().setServerModified(true);
|
|
| 270 |
+ }
|
|
| 271 |
+ |
|
| 272 |
+ protected void setRemoteModified(KeyEvent event) {
|
|
| 273 |
+ if (event.isActionKey()) {
|
|
| 274 |
+ return;
|
|
| 275 |
+ }
|
|
| 276 |
+ ui.getModel().setRemoteModified(true);
|
|
| 277 |
+ }
|
|
| 278 |
+ |
|
| 250 | 279 |
}
|
| ... | ... | @@ -1084,4 +1084,17 @@ public class DecoratorService extends DecoratorProvider { |
| 1084 | 1084 |
}
|
| 1085 | 1085 |
|
| 1086 | 1086 |
};
|
| 1087 |
+ |
|
| 1088 |
+ public String toString(Object o) {
|
|
| 1089 |
+ if (o==null) {
|
|
| 1090 |
+ return null;
|
|
| 1091 |
+ }
|
|
| 1092 |
+ if (o instanceof ReferentialDtoReference) {
|
|
| 1093 |
+ return getReferentialReferenceDecorator(((ReferentialDtoReference<?,?>) o).getReferenceType()).toString(o);
|
|
| 1094 |
+ }
|
|
| 1095 |
+ if (o instanceof DataDtoReference) {
|
|
| 1096 |
+ return getDataReferenceDecorator(((DataDtoReference<?,?>) o).getReferenceType()).toString(o);
|
|
| 1097 |
+ }
|
|
| 1098 |
+ return getDecoratorByType(o.getClass()).toString(o);
|
|
| 1099 |
+ }
|
|
| 1087 | 1100 |
}
|
| ... | ... | @@ -72,6 +72,9 @@ observe.action.delete.tip=Delete |
| 72 | 72 |
observe.action.detail=Details
|
| 73 | 73 |
observe.action.do.backup=Backup local database
|
| 74 | 74 |
observe.action.do.backup.tip=Make a backup of local database before applying modifications.
|
| 75 |
+observe.action.duplicate=Duplicate
|
|
| 76 |
+observe.action.duplicate.remote.tip=Duplicate remote
|
|
| 77 |
+observe.action.duplicate.server.tip=Duplicate server
|
|
| 75 | 78 |
observe.action.exit=Quit
|
| 76 | 79 |
observe.action.exit.tip=quit Observe
|
| 77 | 80 |
observe.action.floatingObjectPresets=Floating Object references
|
| ... | ... | @@ -1948,6 +1951,10 @@ observe.converter.error.float.format=Decimal format not correct for value %s |
| 1948 | 1951 |
observe.converter.error.no.convertor=could not convert decimal %s using convertor %s
|
| 1949 | 1952 |
observe.converter.error.noValue=No value to convert using convertor %s
|
| 1950 | 1953 |
observe.entity.message.updating=object '%1$s' is in editing mode.
|
| 1954 |
+observe.error.DuplicateLengthLengthParameterException=Found multiple length length relation for species\: %s, ocean\: %s, sex\: %s, date\: %s \:\n * %s
|
|
| 1955 |
+observe.error.DuplicateLengthWeightParameterException=Found multiple length weight paramters for species\: %s, ocean\: %s, sex\: %s, date\: %s \:\n * %s
|
|
| 1956 |
+observe.error.LengthLengthParameterNotFoundException=No length length relation found for species\: %s, ocean\: %s, sex\: %s, date\: %s \: %s
|
|
| 1957 |
+observe.error.LengthWeightParameterNotFoundException=No length weight relation found for species\: %s, ocean\: %s, sex\: %s, date\: %s \: %s
|
|
| 1951 | 1958 |
observe.error.can.not.create.directory=Can't create directory %&$s\!
|
| 1952 | 1959 |
observe.error.storage.could.not.backup.unsane.local.db=Can not save an borken database
|
| 1953 | 1960 |
observe.error.storage.could.not.load.local.db=Could not open local database for reason\: %s
|
| ... | ... | @@ -72,6 +72,9 @@ observe.action.delete.tip=Eliminar |
| 72 | 72 |
observe.action.detail=Ver detalles
|
| 73 | 73 |
observe.action.do.backup=Guardar la base local
|
| 74 | 74 |
observe.action.do.backup.tip=Hacer copia de seguridad de la base local antes de aplicar los cambios
|
| 75 |
+observe.action.duplicate=Duplicate \#TODO
|
|
| 76 |
+observe.action.duplicate.remote.tip=Duplicate remote \#TODO
|
|
| 77 |
+observe.action.duplicate.server.tip=Duplicate server \#TODO
|
|
| 75 | 78 |
observe.action.exit=Salir
|
| 76 | 79 |
observe.action.exit.tip=Salir de ObServe
|
| 77 | 80 |
observe.action.floatingObjectPresets=Referencias de objetos flotantes
|
| ... | ... | @@ -1948,6 +1951,10 @@ observe.converter.error.float.format=Formato de decimal incorrecto para el valor |
| 1948 | 1951 |
observe.converter.error.no.convertor=Impossible de convertir el decimal %s con el convertidor %s
|
| 1949 | 1952 |
observe.converter.error.noValue=Ningún valor necesita ser convertida con el convertidor %s
|
| 1950 | 1953 |
observe.entity.message.updating=Se está modificando el objeto actual '%1$s'.
|
| 1954 |
+observe.error.DuplicateLengthLengthParameterException=Found multiple length length relation for species\: %s, ocean\: %s, sex\: %s, date\: %s \:\n * %s \#TODO
|
|
| 1955 |
+observe.error.DuplicateLengthWeightParameterException=Found multiple length weight relation for species\: %s, ocean\: %s, sex\: %s, date\: %s \:\n * %s \#TODO
|
|
| 1956 |
+observe.error.LengthLengthParameterNotFoundException=No length length relation found for species\: %s, ocean\: %s, sex\: %s, date\: %s \: %s \#TODO
|
|
| 1957 |
+observe.error.LengthWeightParameterNotFoundException=No length weight relation found for species\: %s, ocean\: %s, sex\: %s, date\: %s \: %s \#TODO
|
|
| 1951 | 1958 |
observe.error.can.not.create.directory=¡Imposible crear el directorio %1$s\!
|
| 1952 | 1959 |
observe.error.storage.could.not.backup.unsane.local.db=Impossible grabar una base dañada
|
| 1953 | 1960 |
observe.error.storage.could.not.load.local.db=Impossible grabar la base local por la razón siguiente \: %s
|
| ... | ... | @@ -72,6 +72,9 @@ observe.action.delete.tip=Supprimer |
| 72 | 72 |
observe.action.detail=Voir les détails
|
| 73 | 73 |
observe.action.do.backup=Sauver la base locale
|
| 74 | 74 |
observe.action.do.backup.tip=Effectuer une sauvegarde de la base locale avant d'appliquer les changements
|
| 75 |
+observe.action.duplicate=Dupliquer
|
|
| 76 |
+observe.action.duplicate.remote.tip=Duplicate la connexion distante
|
|
| 77 |
+observe.action.duplicate.server.tip=Duplicate la connexion server
|
|
| 75 | 78 |
observe.action.exit=Quitter
|
| 76 | 79 |
observe.action.exit.tip=Quitter ObServe
|
| 77 | 80 |
observe.action.floatingObjectPresets=Objets flottants de références
|
| ... | ... | @@ -1948,6 +1951,10 @@ observe.converter.error.float.format=Format de décimal incorrecte pour la valeu |
| 1948 | 1951 |
observe.converter.error.no.convertor=Impossible de convertir le décimal %s depuis le convertisseur %s
|
| 1949 | 1952 |
observe.converter.error.noValue=Aucune valeur à convertir pour le convertisseur %s
|
| 1950 | 1953 |
observe.entity.message.updating=L'objet '%1$s' est en cours de modification.
|
| 1954 |
+observe.error.DuplicateLengthLengthParameterException=Plusieurs relations taille-taille ont été trouvées pour l'espèce\: %s, l'ocean\: %s, le sexe\: %s et la date\: %s \:\n * %s
|
|
| 1955 |
+observe.error.DuplicateLengthWeightParameterException=Plusieurs relations taille-poids ont été trouvées pour l'espèce\: %s, l'ocean\: %s, le sexe\: %s et la date\: %s \:\n * %s
|
|
| 1956 |
+observe.error.LengthLengthParameterNotFoundException=Aucune relation taille-taille trouvée pour l'espèce\: %s, l'ocean\: %s, le sexe\: %s et la date\: %s
|
|
| 1957 |
+observe.error.LengthWeightParameterNotFoundException=Aucune relation taille-poids trouvée pour l'espèce\: %s, l'ocean\: %s, le sexe\: %s et la date\: %s
|
|
| 1951 | 1958 |
observe.error.can.not.create.directory=Création du répertoire %1$s impossible\!
|
| 1952 | 1959 |
observe.error.storage.could.not.backup.unsane.local.db=Impossible d'enregistrer une base non endommagée
|
| 1953 | 1960 |
observe.error.storage.could.not.load.local.db=Impossible d'ouvrir la base locale pour la raison suivante \: %s
|
| ... | ... | @@ -86,7 +86,10 @@ |
| 86 | 86 |
<artifactId>nuiton-csv</artifactId>
|
| 87 | 87 |
<scope>test</scope>
|
| 88 | 88 |
</dependency>
|
| 89 |
- |
|
| 89 |
+ <dependency>
|
|
| 90 |
+ <groupId>io.ultreia.java4all.i18n</groupId>
|
|
| 91 |
+ <artifactId>i18n-runtime</artifactId>
|
|
| 92 |
+ </dependency>
|
|
| 90 | 93 |
<dependency>
|
| 91 | 94 |
<groupId>io.ultreia.java4all.http</groupId>
|
| 92 | 95 |
<artifactId>http-api</artifactId>
|
| 1 |
+observe.error.DuplicateLengthWeightParameterException
|
|
| 2 |
+observe.error.LengthLengthParameterNotFoundException
|
|
| 3 |
+observe.error.LengthWeightParameterNotFoundException
|
| ... | ... | @@ -22,8 +22,20 @@ package fr.ird.observe.entities.referentiel; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.binder.referential.ReferentialEntityReferenceBinderSupport;
|
|
| 26 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 27 |
+import fr.ird.observe.dto.referential.LengthLengthParameterDto;
|
|
| 28 |
+import fr.ird.observe.dto.referential.LengthLengthParameterReference;
|
|
| 29 |
+import fr.ird.observe.dto.referential.LengthWeightParameterDto;
|
|
| 30 |
+import fr.ird.observe.dto.referential.LengthWeightParameterReference;
|
|
| 31 |
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 32 |
+import fr.ird.observe.spi.DbModelHelper;
|
|
| 33 |
+ |
|
| 25 | 34 |
import java.util.Date;
|
| 26 | 35 |
import java.util.List;
|
| 36 |
+import java.util.stream.Collectors;
|
|
| 37 |
+ |
|
| 38 |
+import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 27 | 39 |
|
| 28 | 40 |
/**
|
| 29 | 41 |
* Created on 28/08/15.
|
| ... | ... | @@ -44,7 +56,8 @@ public class DuplicateLengthLengthParameterException extends RuntimeException { |
| 44 | 56 |
|
| 45 | 57 |
protected final List<LengthLengthParameter> foundLengthLengthParameters;
|
| 46 | 58 |
|
| 47 |
- public DuplicateLengthLengthParameterException(Species species, Ocean ocean, Sex sex, Date date, List<LengthLengthParameter> foundLengthLengthParameters) {
|
|
| 59 |
+ public DuplicateLengthLengthParameterException(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date, List<LengthLengthParameter> foundLengthLengthParameters) {
|
|
| 60 |
+ super(buildMessage(decoratorService, species, ocean, sex, date, foundLengthLengthParameters));
|
|
| 48 | 61 |
this.species = species;
|
| 49 | 62 |
this.ocean = ocean;
|
| 50 | 63 |
this.sex = sex;
|
| ... | ... | @@ -52,6 +65,18 @@ public class DuplicateLengthLengthParameterException extends RuntimeException { |
| 52 | 65 |
this.foundLengthLengthParameters = foundLengthLengthParameters;
|
| 53 | 66 |
}
|
| 54 | 67 |
|
| 68 |
+ private static String buildMessage(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date, List<LengthLengthParameter> foundLengthLengthParameters) {
|
|
| 69 |
+ ReferentialEntityReferenceBinderSupport<LengthLengthParameterDto, LengthLengthParameterReference, LengthLengthParameter> entityContext = DbModelHelper.fromReferentialEntity(LengthLengthParameter.class).toEntityReferenceBinder();
|
|
| 70 |
+ ReferentialLocale referentialLocale = decoratorService.getReferentialLocale();
|
|
| 71 |
+ return t("observe.error.DuplicateLengthWeightParameterException",
|
|
| 72 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, species),
|
|
| 73 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, ocean),
|
|
| 74 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, sex),
|
|
| 75 |
+ date,
|
|
| 76 |
+ foundLengthLengthParameters.stream().map(e -> entityContext.toReference(referentialLocale, e)).map(decoratorService::toString).collect(Collectors.joining("\n * "))
|
|
| 77 |
+ );
|
|
| 78 |
+ }
|
|
| 79 |
+ |
|
| 55 | 80 |
public Species getSpecies() {
|
| 56 | 81 |
return species;
|
| 57 | 82 |
}
|
| ... | ... | @@ -22,8 +22,20 @@ package fr.ird.observe.entities.referentiel; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.binder.referential.ReferentialEntityReferenceBinderSupport;
|
|
| 26 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 27 |
+import fr.ird.observe.dto.referential.LengthWeightParameterDto;
|
|
| 28 |
+import fr.ird.observe.dto.referential.LengthWeightParameterReference;
|
|
| 29 |
+import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 30 |
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 31 |
+import fr.ird.observe.spi.DbModelHelper;
|
|
| 32 |
+import fr.ird.observe.spi.context.ReferentialEntityContext;
|
|
| 33 |
+ |
|
| 25 | 34 |
import java.util.Date;
|
| 26 | 35 |
import java.util.List;
|
| 36 |
+import java.util.stream.Collectors;
|
|
| 37 |
+ |
|
| 38 |
+import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 27 | 39 |
|
| 28 | 40 |
/**
|
| 29 | 41 |
* Created on 28/08/15.
|
| ... | ... | @@ -44,7 +56,8 @@ public class DuplicateLengthWeightParameterException extends RuntimeException { |
| 44 | 56 |
|
| 45 | 57 |
protected final List<LengthWeightParameter> foundLengthWeightParameters;
|
| 46 | 58 |
|
| 47 |
- public DuplicateLengthWeightParameterException(Species species, Ocean ocean, Sex sex, Date date, List<LengthWeightParameter> foundLengthWeightParameters) {
|
|
| 59 |
+ public DuplicateLengthWeightParameterException(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date, List<LengthWeightParameter> foundLengthWeightParameters) {
|
|
| 60 |
+ super(buildMessage(decoratorService, species, ocean, sex, date, foundLengthWeightParameters));
|
|
| 48 | 61 |
this.species = species;
|
| 49 | 62 |
this.ocean = ocean;
|
| 50 | 63 |
this.sex = sex;
|
| ... | ... | @@ -52,6 +65,18 @@ public class DuplicateLengthWeightParameterException extends RuntimeException { |
| 52 | 65 |
this.foundLengthWeightParameters = foundLengthWeightParameters;
|
| 53 | 66 |
}
|
| 54 | 67 |
|
| 68 |
+ private static String buildMessage(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date, List<LengthWeightParameter> foundLengthWeightParameters) {
|
|
| 69 |
+ ReferentialEntityReferenceBinderSupport<LengthWeightParameterDto, LengthWeightParameterReference, LengthWeightParameter> entityContext = DbModelHelper.fromReferentialEntity(LengthWeightParameter.class).toEntityReferenceBinder();
|
|
| 70 |
+ ReferentialLocale referentialLocale = decoratorService.getReferentialLocale();
|
|
| 71 |
+ return t("observe.error.DuplicateLengthWeightParameterException",
|
|
| 72 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, species),
|
|
| 73 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, ocean),
|
|
| 74 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, sex),
|
|
| 75 |
+ date,
|
|
| 76 |
+ foundLengthWeightParameters.stream().map(e -> entityContext.toReference(referentialLocale, e)).map(decoratorService::toString).collect(Collectors.joining("\n * "))
|
|
| 77 |
+ );
|
|
| 78 |
+ }
|
|
| 79 |
+ |
|
| 55 | 80 |
public Species getSpecies() {
|
| 56 | 81 |
return species;
|
| 57 | 82 |
}
|
| ... | ... | @@ -22,8 +22,15 @@ package fr.ird.observe.entities.referentiel; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 26 |
+import fr.ird.observe.dto.reference.ReferentialDtoReference;
|
|
| 27 |
+import fr.ird.observe.dto.referential.ReferentialDto;
|
|
| 28 |
+import fr.ird.observe.spi.DbModelHelper;
|
|
| 29 |
+ |
|
| 25 | 30 |
import java.util.Date;
|
| 26 | 31 |
|
| 32 |
+import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 33 |
+ |
|
| 27 | 34 |
/**
|
| 28 | 35 |
* Created on 29/08/15.
|
| 29 | 36 |
*
|
| ... | ... | @@ -41,13 +48,23 @@ public class LengthLengthParameterNotFoundException extends RuntimeException { |
| 41 | 48 |
|
| 42 | 49 |
protected final Date date;
|
| 43 | 50 |
|
| 44 |
- public LengthLengthParameterNotFoundException(Species species, Ocean ocean, Sex sex, Date date) {
|
|
| 51 |
+ public LengthLengthParameterNotFoundException(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date) {
|
|
| 52 |
+ super(buildMessage(decoratorService, species, ocean, sex, date));
|
|
| 45 | 53 |
this.species = species;
|
| 46 | 54 |
this.ocean = ocean;
|
| 47 | 55 |
this.sex = sex;
|
| 48 | 56 |
this.date = date;
|
| 49 | 57 |
}
|
| 50 | 58 |
|
| 59 |
+ private static String buildMessage(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date) {
|
|
| 60 |
+ |
|
| 61 |
+ return t("observe.error.LengthLengthParameterNotFoundException",
|
|
| 62 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, species),
|
|
| 63 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, ocean),
|
|
| 64 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, sex),
|
|
| 65 |
+ date);
|
|
| 66 |
+ }
|
|
| 67 |
+ |
|
| 51 | 68 |
public Species getSpecies() {
|
| 52 | 69 |
return species;
|
| 53 | 70 |
}
|
| ... | ... | @@ -64,4 +81,10 @@ public class LengthLengthParameterNotFoundException extends RuntimeException { |
| 64 | 81 |
return date;
|
| 65 | 82 |
}
|
| 66 | 83 |
|
| 84 |
+ static <E extends ObserveReferentialEntity> String toString(DecoratorService decoratorService, E entity) {
|
|
| 85 |
+ if (entity == null) {
|
|
| 86 |
+ return null;
|
|
| 87 |
+ }
|
|
| 88 |
+ return decoratorService.toString(DbModelHelper.fromReferentialEntity(entity).toEntityReferenceBinder().toReference(decoratorService.getReferentialLocale(), entity));
|
|
| 89 |
+ }
|
|
| 67 | 90 |
}
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.entities.referentiel; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 25 | 26 |
import fr.ird.observe.persistence.ObserveTopiaDaoSupplier;
|
| 26 | 27 |
import org.apache.commons.collections4.CollectionUtils;
|
| 27 | 28 |
|
| ... | ... | @@ -49,6 +50,7 @@ public class LengthLengthParameters { |
| 49 | 50 |
* <p>
|
| 50 | 51 |
* Si non trouvé sur le sexe (et que le sexe n'est pas indéterminé) , alors on recherche avec le sexe indéterminé (sexe=0).
|
| 51 | 52 |
*
|
| 53 |
+ * @param decoratorService decorator service
|
|
| 52 | 54 |
* @param daoSupplier la transaction en cours d'utilisation
|
| 53 | 55 |
* @param species l'espèce sur lequel on recherche le paramétrage
|
| 54 | 56 |
* @param ocean l'ocean recherché (peut être null)
|
| ... | ... | @@ -59,7 +61,7 @@ public class LengthLengthParameters { |
| 59 | 61 |
* @return le paramétrage adéquate
|
| 60 | 62 |
* @since 1.5
|
| 61 | 63 |
*/
|
| 62 |
- public static Optional<LengthLengthParameter> findLengthLengthParameter(ObserveTopiaDaoSupplier daoSupplier,
|
|
| 64 |
+ public static Optional<LengthLengthParameter> findLengthLengthParameter(DecoratorService decoratorService, ObserveTopiaDaoSupplier daoSupplier,
|
|
| 63 | 65 |
Species species,
|
| 64 | 66 |
Ocean ocean,
|
| 65 | 67 |
Sex sex,
|
| ... | ... | @@ -85,7 +87,7 @@ public class LengthLengthParameters { |
| 85 | 87 |
}
|
| 86 | 88 |
|
| 87 | 89 |
if (CollectionUtils.isEmpty(list)) {
|
| 88 |
- throw new LengthLengthParameterNotFoundException(species, ocean, sex, date);
|
|
| 90 |
+ throw new LengthLengthParameterNotFoundException(decoratorService, species, ocean, sex, date);
|
|
| 89 | 91 |
}
|
| 90 | 92 |
|
| 91 | 93 |
// if (inputSizeMeasureType != null) {
|
| ... | ... | @@ -116,193 +118,14 @@ public class LengthLengthParameters { |
| 116 | 118 |
// au final il ne devrait en rester qu'un
|
| 117 | 119 |
|
| 118 | 120 |
if (list.size() > 1) {
|
| 119 |
- throw new DuplicateLengthLengthParameterException(species, ocean, sex, date, list);
|
|
| 121 |
+ throw new DuplicateLengthLengthParameterException(decoratorService, species, ocean, sex, date, list);
|
|
| 120 | 122 |
}
|
| 121 | 123 |
|
| 122 | 124 |
return Optional.of(list.get(0));
|
| 123 |
- |
|
| 124 | 125 |
}
|
| 125 |
-//
|
|
| 126 |
-// /**
|
|
| 127 |
-// * Recherche de la liste des {@link LengthLengthParameter} à partir des paramètres donnés.
|
|
| 128 |
-// * <p>
|
|
| 129 |
-// * La recherche peut ne peut être aussi exacte que les paramètres donnés :
|
|
| 130 |
-// * <p>
|
|
| 131 |
-// * Dans le cas d'une espèce faune, si non trouvé alors on recherche sur son
|
|
| 132 |
-// * speciesGroup d'espèce.
|
|
| 133 |
-// * <p>
|
|
| 134 |
-// * Si non trouvé pour l'océan donné (et que celui-ci est non null), alors on
|
|
| 135 |
-// * recherche avec un ocean vide.
|
|
| 136 |
-// *
|
|
| 137 |
-// * @param daoSupplier la transaction en cours d'utilisation
|
|
| 138 |
-// * @param species l'espèce sur lequel on recherche le paramétrage
|
|
| 139 |
-// * @param ocean l'ocean recherché (peut être null)
|
|
| 140 |
-// * @param sex le sexe recherché (on essayera sans sexe (sexe.code=0) si non trouvé)
|
|
| 141 |
-// * @param date le jour recherché
|
|
| 142 |
-// * @return le paramétrage adéquate
|
|
| 143 |
-// * @since 1.5
|
|
| 144 |
-// */
|
|
| 145 |
-// public static List<LengthLengthParameter> findLengthLengthParameter0(ObserveTopiaDaoSupplier daoSupplier,
|
|
| 146 |
-// Species species,
|
|
| 147 |
-// Ocean ocean,
|
|
| 148 |
-// Sex sex,
|
|
| 149 |
-// Date date) {
|
|
| 150 |
-//
|
|
| 151 |
-// Objects.requireNonNull(daoSupplier, "daoSupplier parameter can't be null");
|
|
| 152 |
-// Objects.requireNonNull(species, "species parameter can't be null");
|
|
| 153 |
-// Objects.requireNonNull(sex, "sex parameter can't be null");
|
|
| 154 |
-//
|
|
| 155 |
-// List<LengthLengthParameter> list = findBySpecies(daoSupplier, species);
|
|
| 156 |
-//
|
|
| 157 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 158 |
-//
|
|
| 159 |
-// // aucun parametrage pour le type donne
|
|
| 160 |
-// return null;
|
|
| 161 |
-// }
|
|
| 162 |
-//
|
|
| 163 |
-// // filtrage par ocean
|
|
| 164 |
-// List<LengthLengthParameter> filterByOcean = filterByOcean(list, ocean);
|
|
| 165 |
-//
|
|
| 166 |
-// if (CollectionUtils.isEmpty(filterByOcean) && ocean != null) {
|
|
| 167 |
-//
|
|
| 168 |
-// // filtre par ocean null
|
|
| 169 |
-// filterByOcean = filterByOcean(list, null);
|
|
| 170 |
-// }
|
|
| 171 |
-// list = filterByOcean;
|
|
| 172 |
-//
|
|
| 173 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 174 |
-//
|
|
| 175 |
-// // pas d'ocean adequate
|
|
| 176 |
-// return null;
|
|
| 177 |
-// }
|
|
| 178 |
-//
|
|
| 179 |
-// // filtrage par sexe
|
|
| 180 |
-// list = filterBySexe(list, sex);
|
|
| 181 |
-//
|
|
| 182 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 183 |
-//
|
|
| 184 |
-// // pas de sexe adequate
|
|
| 185 |
-// return null;
|
|
| 186 |
-// }
|
|
| 187 |
-//
|
|
| 188 |
-// // filtrage par startDate de validite
|
|
| 189 |
-// list = filterByDateDebutValidite(list, date);
|
|
| 190 |
-//
|
|
| 191 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 192 |
-//
|
|
| 193 |
-// // pas de date de debut adequate
|
|
| 194 |
-// return null;
|
|
| 195 |
-// }
|
|
| 196 |
-//
|
|
| 197 |
-// // filtrage par endDate de validite
|
|
| 198 |
-// list = filterByDateFinValidite(list, date);
|
|
| 199 |
-//
|
|
| 200 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 201 |
-//
|
|
| 202 |
-// // pas de date de fin adequate
|
|
| 203 |
-// return null;
|
|
| 204 |
-// }
|
|
| 205 |
-//
|
|
| 206 |
-// return list;
|
|
| 207 |
-//
|
|
| 208 |
-// }
|
|
| 209 | 126 |
|
| 210 | 127 |
private static Sex getUnknownSex(ObserveTopiaDaoSupplier daoSupplier) {
|
| 211 | 128 |
return daoSupplier.getSexDao().forCodeEquals("0").findUnique();
|
| 212 | 129 |
}
|
| 213 | 130 |
|
| 214 |
-// public static List<LengthLengthParameter> findBySpecies(ObserveTopiaDaoSupplier daoSupplier, Species species) {
|
|
| 215 |
-//
|
|
| 216 |
-// LengthLengthParameterTopiaDao dao = daoSupplier.getLengthLengthParameterDao();
|
|
| 217 |
-//
|
|
| 218 |
-// List<LengthLengthParameter> list = dao.forSpeciesEquals(species).findAll();
|
|
| 219 |
-//
|
|
| 220 |
-// // on supprime les paramétrages qui ont a=0 ou a=null ou b=0 ou b = null
|
|
| 221 |
-// Iterator<LengthLengthParameter> itr = list.iterator();
|
|
| 222 |
-// while (itr.hasNext()) {
|
|
| 223 |
-// LengthLengthParameter p = itr.next();
|
|
| 224 |
-// Double a = p.getCoefficientValue(FormulaHelper.COEFFICIENT_A);
|
|
| 225 |
-// if (a == null || a == 0) {
|
|
| 226 |
-// itr.remove();
|
|
| 227 |
-// continue;
|
|
| 228 |
-// }
|
|
| 229 |
-//
|
|
| 230 |
-// Double b = p.getCoefficientValue(FormulaHelper.COEFFICIENT_B);
|
|
| 231 |
-// // on autorise d'avoir b à 0 (mais cela ne permet plus de calculer la taille à partir du poids)
|
|
| 232 |
-//// if (b == null || b == 0) {
|
|
| 233 |
-// if (b == null) {
|
|
| 234 |
-// itr.remove();
|
|
| 235 |
-// }
|
|
| 236 |
-// }
|
|
| 237 |
-// return list;
|
|
| 238 |
-//
|
|
| 239 |
-// }
|
|
| 240 |
- |
|
| 241 |
-// public static List<LengthLengthParameter> filterByOcean(List<LengthLengthParameter> list, Ocean ocean) {
|
|
| 242 |
-// List<LengthLengthParameter> result = new ArrayList<>();
|
|
| 243 |
-// if (ocean == null) {
|
|
| 244 |
-//
|
|
| 245 |
-// // on n'accepte que les parametrage sans ocean
|
|
| 246 |
-// for (LengthLengthParameter parametrageLengthWeight : list) {
|
|
| 247 |
-// if (parametrageLengthWeight.getOcean() == null) {
|
|
| 248 |
-// result.add(parametrageLengthWeight);
|
|
| 249 |
-// }
|
|
| 250 |
-// }
|
|
| 251 |
-// } else {
|
|
| 252 |
-// for (LengthLengthParameter parametrageLengthWeight : list) {
|
|
| 253 |
-// if (ocean.equals(parametrageLengthWeight.getOcean())) {
|
|
| 254 |
-// result.add(parametrageLengthWeight);
|
|
| 255 |
-// }
|
|
| 256 |
-// }
|
|
| 257 |
-// }
|
|
| 258 |
-// return result;
|
|
| 259 |
-// }
|
|
| 260 |
-//
|
|
| 261 |
-// public static List<LengthLengthParameter> filterBySexe(List<LengthLengthParameter> list, Sex sex) {
|
|
| 262 |
-// return list.stream().filter(l -> l.getSex() == sex).collect(Collectors.toList());
|
|
| 263 |
-// }
|
|
| 264 |
-//
|
|
| 265 |
-// public static List<LengthLengthParameter> filterByInputSizeMeasureType(List<LengthLengthParameter> list, SizeMeasureType sizeMeasureType) {
|
|
| 266 |
-// return list.stream().filter(l -> l.getInputSizeMeasureType() == sizeMeasureType).collect(Collectors.toList());
|
|
| 267 |
-// }
|
|
| 268 |
-//public static List<LengthLengthParameter> filterByOutputSizeMeasureType(List<LengthLengthParameter> list, SizeMeasureType sizeMeasureType) {
|
|
| 269 |
-// return list.stream().filter(l -> l.getOutputSizeMeasureType() == sizeMeasureType).collect(Collectors.toList());
|
|
| 270 |
-// }
|
|
| 271 |
-//
|
|
| 272 |
-// public static List<LengthLengthParameter> filterByDateDebutValidite(List<LengthLengthParameter> list, Date startDate) {
|
|
| 273 |
-// return list.stream()
|
|
| 274 |
-// .filter(l -> l.getStartDate() == null || l.getStartDate().before(startDate) || l.getStartDate().equals(startDate))
|
|
| 275 |
-// .collect(Collectors.toList());
|
|
| 276 |
-// }
|
|
| 277 |
-//
|
|
| 278 |
-// public static List<LengthLengthParameter> filterByDateFinValidite(List<LengthLengthParameter> list, Date endDate) {
|
|
| 279 |
-// List<LengthLengthParameter> result = new ArrayList<>();
|
|
| 280 |
-//
|
|
| 281 |
-// if (endDate == null) {
|
|
| 282 |
-// // on n'accepte que les parametrages selon les critères suivants :
|
|
| 283 |
-// // - sans date de fin (i.e en cours de validite)
|
|
| 284 |
-// for (LengthLengthParameter parametrageLengthWeight : list) {
|
|
| 285 |
-//
|
|
| 286 |
-// Date date = parametrageLengthWeight.getEndDate();
|
|
| 287 |
-// if (date == null) {
|
|
| 288 |
-// result.add(parametrageLengthWeight);
|
|
| 289 |
-// }
|
|
| 290 |
-// }
|
|
| 291 |
-// } else {
|
|
| 292 |
-// // on n'accepte que les parametrages selon les critères suivants :
|
|
| 293 |
-// // - sans date de fin (i.e en cours de validite)
|
|
| 294 |
-// // - ceux dont la date de fin est avant la date de fin donnée
|
|
| 295 |
-// for (LengthLengthParameter parametrageLengthWeight : list) {
|
|
| 296 |
-//
|
|
| 297 |
-// Date date = parametrageLengthWeight.getEndDate();
|
|
| 298 |
-// if (date == null ||
|
|
| 299 |
-// date.after(endDate) ||
|
|
| 300 |
-// date.equals(endDate)) {
|
|
| 301 |
-// result.add(parametrageLengthWeight);
|
|
| 302 |
-// }
|
|
| 303 |
-// }
|
|
| 304 |
-// }
|
|
| 305 |
-// return result;
|
|
| 306 |
-// }
|
|
| 307 |
- |
|
| 308 | 131 |
}
|
| ... | ... | @@ -22,7 +22,15 @@ package fr.ird.observe.entities.referentiel; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 26 |
+import fr.ird.observe.dto.referential.SpeciesDto;
|
|
| 27 |
+import fr.ird.observe.spi.DbModelHelper;
|
|
| 28 |
+import fr.ird.observe.spi.DtoModelHelper;
|
|
| 29 |
+ |
|
| 25 | 30 |
import java.util.Date;
|
| 31 |
+import java.util.stream.Collectors;
|
|
| 32 |
+ |
|
| 33 |
+import static io.ultreia.java4all.i18n.I18n.t;
|
|
| 26 | 34 |
|
| 27 | 35 |
/**
|
| 28 | 36 |
* Created on 29/08/15.
|
| ... | ... | @@ -41,13 +49,23 @@ public class LengthWeightParameterNotFoundException extends RuntimeException { |
| 41 | 49 |
|
| 42 | 50 |
protected final Date date;
|
| 43 | 51 |
|
| 44 |
- public LengthWeightParameterNotFoundException(Species species, Ocean ocean, Sex sex, Date date) {
|
|
| 52 |
+ public LengthWeightParameterNotFoundException(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date) {
|
|
| 53 |
+ super(buildMessage(decoratorService, species, ocean, sex, date));
|
|
| 45 | 54 |
this.species = species;
|
| 46 | 55 |
this.ocean = ocean;
|
| 47 | 56 |
this.sex = sex;
|
| 48 | 57 |
this.date = date;
|
| 49 | 58 |
}
|
| 50 | 59 |
|
| 60 |
+ private static String buildMessage(DecoratorService decoratorService, Species species, Ocean ocean, Sex sex, Date date) {
|
|
| 61 |
+ |
|
| 62 |
+ return t("observe.error.LengthWeightParameterNotFoundException",
|
|
| 63 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, species),
|
|
| 64 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, ocean),
|
|
| 65 |
+ LengthLengthParameterNotFoundException.toString(decoratorService, sex),
|
|
| 66 |
+ date);
|
|
| 67 |
+ }
|
|
| 68 |
+ |
|
| 51 | 69 |
public Species getSpecies() {
|
| 52 | 70 |
return species;
|
| 53 | 71 |
}
|
| ... | ... | @@ -22,6 +22,7 @@ package fr.ird.observe.entities.referentiel; |
| 22 | 22 |
* #L%
|
| 23 | 23 |
*/
|
| 24 | 24 |
|
| 25 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 25 | 26 |
import fr.ird.observe.persistence.ObserveTopiaDaoSupplier;
|
| 26 | 27 |
import org.apache.commons.collections4.CollectionUtils;
|
| 27 | 28 |
|
| ... | ... | @@ -47,16 +48,17 @@ public class LengthWeightParameters { |
| 47 | 48 |
* <p>
|
| 48 | 49 |
* Si non trouvé sur le sexe (et que le sexe n'est pas indéterminé) , alors on recherche avec le sexe indéterminé (sexe=0).
|
| 49 | 50 |
*
|
| 50 |
- * @param daoSupplier la transaction en cours d'utilisation
|
|
| 51 |
- * @param species l'espèce sur lequel on recherche le paramétrage
|
|
| 52 |
- * @param sex le sexe recherché (on essayera sans sexe (sexe.code=0) si non trouvé)
|
|
| 53 |
- * @param ocean l'ocean recherché (peut être null)
|
|
| 54 |
- * @param date le jour recherché
|
|
| 55 |
- * @param sizeMeasureType le type de mensuration recherché
|
|
| 51 |
+ * @param decoratorService decorator service
|
|
| 52 |
+ * @param daoSupplier la transaction en cours d'utilisation
|
|
| 53 |
+ * @param species l'espèce sur lequel on recherche le paramétrage
|
|
| 54 |
+ * @param sex le sexe recherché (on essayera sans sexe (sexe.code=0) si non trouvé)
|
|
| 55 |
+ * @param ocean l'ocean recherché (peut être null)
|
|
| 56 |
+ * @param date le jour recherché
|
|
| 57 |
+ * @param sizeMeasureType le type de mensuration recherché
|
|
| 56 | 58 |
* @return le paramétrage adéquate
|
| 57 | 59 |
* @since 1.5
|
| 58 | 60 |
*/
|
| 59 |
- public static LengthWeightParameter findLengthWeightParameter(ObserveTopiaDaoSupplier daoSupplier,
|
|
| 61 |
+ public static LengthWeightParameter findLengthWeightParameter(DecoratorService decoratorService, ObserveTopiaDaoSupplier daoSupplier,
|
|
| 60 | 62 |
Species species, Sex sex, Ocean ocean, Date date, SizeMeasureType sizeMeasureType) {
|
| 61 | 63 |
|
| 62 | 64 |
// Sex unknownSex = getUnknownSex(daoSupplier);
|
| ... | ... | @@ -77,7 +79,7 @@ public class LengthWeightParameters { |
| 77 | 79 |
// }
|
| 78 | 80 |
|
| 79 | 81 |
if (CollectionUtils.isEmpty(list)) {
|
| 80 |
- throw new LengthWeightParameterNotFoundException(species, ocean, sex, date);
|
|
| 82 |
+ throw new LengthWeightParameterNotFoundException(decoratorService, species, ocean, sex, date);
|
|
| 81 | 83 |
}
|
| 82 | 84 |
|
| 83 | 85 |
// if (sizeMeasureType != null) {
|
| ... | ... | @@ -96,190 +98,11 @@ public class LengthWeightParameters { |
| 96 | 98 |
// au final il ne devrait en rester qu'un
|
| 97 | 99 |
|
| 98 | 100 |
if (list.size() > 1) {
|
| 99 |
- throw new DuplicateLengthWeightParameterException(species, ocean, sex, date, list);
|
|
| 101 |
+ throw new DuplicateLengthWeightParameterException(decoratorService, species, ocean, sex, date, list);
|
|
| 100 | 102 |
}
|
| 101 | 103 |
|
| 102 | 104 |
return Objects.requireNonNull(list.get(0));
|
| 103 | 105 |
|
| 104 | 106 |
}
|
| 105 | 107 |
|
| 106 |
-// /**
|
|
| 107 |
-// * Recherche de la liste des {@link LengthWeightParameter} à partir des paramètres donnés.
|
|
| 108 |
-// * <p>
|
|
| 109 |
-// * La recherche peut ne peut être aussi exacte que les paramètres donnés :
|
|
| 110 |
-// * <p>
|
|
| 111 |
-// * Dans le cas d'une espèce faune, si non trouvé alors on recherche sur son
|
|
| 112 |
-// * speciesGroup d'espèce.
|
|
| 113 |
-// * <p>
|
|
| 114 |
-// * Si non trouvé pour l'océan donné (et que celui-ci est non null), alors on
|
|
| 115 |
-// * recherche avec un ocean vide.
|
|
| 116 |
-// *
|
|
| 117 |
-// * @param daoSupplier la transaction en cours d'utilisation
|
|
| 118 |
-// * @param species l'espèce sur lequel on recherche le paramétrage
|
|
| 119 |
-// * @param ocean l'ocean recherché (peut être null)
|
|
| 120 |
-// * @param sex le sexe recherché (on essayera sans sexe (sexe.code=0) si non trouvé)
|
|
| 121 |
-// * @param date le jour recherché
|
|
| 122 |
-// * @return le paramétrage adéquate
|
|
| 123 |
-// * @since 1.5
|
|
| 124 |
-// */
|
|
| 125 |
-// public static List<LengthWeightParameter> findLengthWeightParameter0(ObserveTopiaDaoSupplier daoSupplier,
|
|
| 126 |
-// Species species,
|
|
| 127 |
-// Ocean ocean,
|
|
| 128 |
-// Sex sex,
|
|
| 129 |
-// Date date) {
|
|
| 130 |
-//
|
|
| 131 |
-// Objects.requireNonNull(daoSupplier, "daoSupplier parameter can't be null");
|
|
| 132 |
-// Objects.requireNonNull(species, "species parameter can't be null");
|
|
| 133 |
-// Objects.requireNonNull(sex, "sex parameter can't be null");
|
|
| 134 |
-//
|
|
| 135 |
-// List<LengthWeightParameter> list = findBySpecies(daoSupplier, species);
|
|
| 136 |
-//
|
|
| 137 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 138 |
-//
|
|
| 139 |
-// // aucun parametrage pour le type donne
|
|
| 140 |
-// return null;
|
|
| 141 |
-// }
|
|
| 142 |
-//
|
|
| 143 |
-// // filtrage par ocean
|
|
| 144 |
-// List<LengthWeightParameter> filterByOcean = filterByOcean(list, ocean);
|
|
| 145 |
-//
|
|
| 146 |
-// if (CollectionUtils.isEmpty(filterByOcean) && ocean != null) {
|
|
| 147 |
-//
|
|
| 148 |
-// // filtre par ocean null
|
|
| 149 |
-// filterByOcean = filterByOcean(list, null);
|
|
| 150 |
-// }
|
|
| 151 |
-// list = filterByOcean;
|
|
| 152 |
-//
|
|
| 153 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 154 |
-//
|
|
| 155 |
-// // pas d'ocean adequate
|
|
| 156 |
-// return null;
|
|
| 157 |
-// }
|
|
| 158 |
-//
|
|
| 159 |
-// // filtrage par sexe
|
|
| 160 |
-// list = filterBySexe(list, sex);
|
|
| 161 |
-//
|
|
| 162 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 163 |
-//
|
|
| 164 |
-// // pas de sexe adequate
|
|
| 165 |
-// return null;
|
|
| 166 |
-// }
|
|
| 167 |
-//
|
|
| 168 |
-// // filtrage par startDate de validite
|
|
| 169 |
-// list = filterByDateDebutValidite(list, date);
|
|
| 170 |
-//
|
|
| 171 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 172 |
-//
|
|
| 173 |
-// // pas de date de debut adequate
|
|
| 174 |
-// return null;
|
|
| 175 |
-// }
|
|
| 176 |
-//
|
|
| 177 |
-// // filtrage par endDate de validite
|
|
| 178 |
-// list = filterByDateFinValidite(list, date);
|
|
| 179 |
-//
|
|
| 180 |
-// if (CollectionUtils.isEmpty(list)) {
|
|
| 181 |
-//
|
|
| 182 |
-// // pas de date de fin adequate
|
|
| 183 |
-// return null;
|
|
| 184 |
-// }
|
|
| 185 |
-//
|
|
| 186 |
-// return list;
|
|
| 187 |
-//
|
|
| 188 |
-// }
|
|
| 189 |
- |
|
| 190 |
-// private static Sex getUnknownSex(ObserveTopiaDaoSupplier daoSupplier) {
|
|
| 191 |
-// return daoSupplier.getSexDao().forCodeEquals("0").findUnique();
|
|
| 192 |
-// }
|
|
| 193 |
- |
|
| 194 |
-// public static List<LengthWeightParameter> findBySpecies(ObserveTopiaDaoSupplier daoSupplier, Species species) {
|
|
| 195 |
-//
|
|
| 196 |
-// LengthWeightParameterTopiaDao dao = daoSupplier.getLengthWeightParameterDao();
|
|
| 197 |
-//
|
|
| 198 |
-// List<LengthWeightParameter> list = dao.forSpeciesEquals(species).findAll();
|
|
| 199 |
-//
|
|
| 200 |
-// // on supprime les paramétrages qui ont a=0 ou a=null ou b=0 ou b = null
|
|
| 201 |
-// Iterator<LengthWeightParameter> itr = list.iterator();
|
|
| 202 |
-// while (itr.hasNext()) {
|
|
| 203 |
-// LengthWeightParameter p = itr.next();
|
|
| 204 |
-// Double a = p.getCoefficientValue(FormulaHelper.COEFFICIENT_A);
|
|
| 205 |
-// if (a == null || a == 0) {
|
|
| 206 |
-// itr.remove();
|
|
| 207 |
-// continue;
|
|
| 208 |
-// }
|
|
| 209 |
-//
|
|
| 210 |
-// Double b = p.getCoefficientValue(FormulaHelper.COEFFICIENT_B);
|
|
| 211 |
-// // on autorise d'avoir b à 0 (mais cela ne permet plus de calculer la taille à partir du poids)
|
|
| 212 |
-//// if (b == null || b == 0) {
|
|
| 213 |
-// if (b == null) {
|
|
| 214 |
-// itr.remove();
|
|
| 215 |
-// }
|
|
| 216 |
-// }
|
|
| 217 |
-// return list;
|
|
| 218 |
-//
|
|
| 219 |
-// }
|
|
| 220 |
-//
|
|
| 221 |
-// public static List<LengthWeightParameter> filterByOcean(List<LengthWeightParameter> list, Ocean ocean) {
|
|
| 222 |
-// List<LengthWeightParameter> result = new ArrayList<>();
|
|
| 223 |
-// if (ocean == null) {
|
|
| 224 |
-//
|
|
| 225 |
-// // on n'accepte que les parametrage sans ocean
|
|
| 226 |
-// for (LengthWeightParameter parametrageLengthWeight : list) {
|
|
| 227 |
-// if (parametrageLengthWeight.getOcean() == null) {
|
|
| 228 |
-// result.add(parametrageLengthWeight);
|
|
| 229 |
-// }
|
|
| 230 |
-// }
|
|
| 231 |
-// } else {
|
|
| 232 |
-// for (LengthWeightParameter parametrageLengthWeight : list) {
|
|
| 233 |
-// if (ocean.equals(parametrageLengthWeight.getOcean())) {
|
|
| 234 |
-// result.add(parametrageLengthWeight);
|
|
| 235 |
-// }
|
|
| 236 |
-// }
|
|
| 237 |
-// }
|
|
| 238 |
-// return result;
|
|
| 239 |
-// }
|
|
| 240 |
-//
|
|
| 241 |
-// public static List<LengthWeightParameter> filterBySexe(List<LengthWeightParameter> list, Sex sex) {
|
|
| 242 |
-// return list.stream().filter(l -> l.getSex() == sex).collect(Collectors.toList());
|
|
| 243 |
-// }
|
|
| 244 |
-//
|
|
| 245 |
-// public static List<LengthWeightParameter> filterBySizeMeasureType(List<LengthWeightParameter> list, SizeMeasureType sizeMeasureType) {
|
|
| 246 |
-// return list.stream().filter(l -> l.getSizeMeasureType() == sizeMeasureType).collect(Collectors.toList());
|
|
| 247 |
-// }
|
|
| 248 |
-//
|
|
| 249 |
-// public static List<LengthWeightParameter> filterByDateDebutValidite(List<LengthWeightParameter> list, Date startDate) {
|
|
| 250 |
-// return list.stream()
|
|
| 251 |
-// .filter(l -> l.getStartDate() == null || l.getStartDate().before(startDate) || l.getStartDate().equals(startDate))
|
|
| 252 |
-// .collect(Collectors.toList());
|
|
| 253 |
-// }
|
|
| 254 |
-//
|
|
| 255 |
-// public static List<LengthWeightParameter> filterByDateFinValidite(List<LengthWeightParameter> list, Date endDate) {
|
|
| 256 |
-// List<LengthWeightParameter> result = new ArrayList<>();
|
|
| 257 |
-//
|
|
| 258 |
-// if (endDate == null) {
|
|
| 259 |
-// // on n'accepte que les parametrages selon les critères suivants :
|
|
| 260 |
-// // - sans date de fin (i.e en cours de validite)
|
|
| 261 |
-// for (LengthWeightParameter parametrageLengthWeight : list) {
|
|
| 262 |
-//
|
|
| 263 |
-// Date date = parametrageLengthWeight.getEndDate();
|
|
| 264 |
-// if (date == null) {
|
|
| 265 |
-// result.add(parametrageLengthWeight);
|
|
| 266 |
-// }
|
|
| 267 |
-// }
|
|
| 268 |
-// } else {
|
|
| 269 |
-// // on n'accepte que les parametrages selon les critères suivants :
|
|
| 270 |
-// // - sans date de fin (i.e en cours de validite)
|
|
| 271 |
-// // - ceux dont la date de fin est avant la date de fin donnée
|
|
| 272 |
-// for (LengthWeightParameter parametrageLengthWeight : list) {
|
|
| 273 |
-//
|
|
| 274 |
-// Date date = parametrageLengthWeight.getEndDate();
|
|
| 275 |
-// if (date == null ||
|
|
| 276 |
-// date.after(endDate) ||
|
|
| 277 |
-// date.equals(endDate)) {
|
|
| 278 |
-// result.add(parametrageLengthWeight);
|
|
| 279 |
-// }
|
|
| 280 |
-// }
|
|
| 281 |
-// }
|
|
| 282 |
-// return result;
|
|
| 283 |
-// }
|
|
| 284 |
- |
|
| 285 | 108 |
}
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>io.ultreia.maven</groupId>
|
| 28 | 28 |
<artifactId>pom</artifactId>
|
| 29 |
- <version>2020.21</version>
|
|
| 29 |
+ <version>2020.25</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<groupId>fr.ird.observe</groupId>
|
| ... | ... | @@ -163,7 +163,7 @@ |
| 163 | 163 |
<!--can't use 1.4.197 (date has changed + blob also-->
|
| 164 | 164 |
<lib.version.h2>1.4.196</lib.version.h2>
|
| 165 | 165 |
<lib.version.java4all.eugene>3.0-alpha-26</lib.version.java4all.eugene>
|
| 166 |
- <lib.version.java4all.jaxx>3.0-alpha-68-SNAPSHOT</lib.version.java4all.jaxx>
|
|
| 166 |
+ <!--<lib.version.java4all.jaxx>3.0-alpha-68-SNAPSHOT</lib.version.java4all.jaxx>-->
|
|
| 167 | 167 |
<!--<lib.version.java4all.i18n>4.0-beta-8-SNAPSHOT</lib.version.java4all.i18n>-->
|
| 168 | 168 |
<lib.version.java4all.topia>1.1.17</lib.version.java4all.topia>
|
| 169 | 169 |
<lib.version.nuiton.utils>3.0</lib.version.nuiton.utils>
|
| ... | ... | @@ -29,6 +29,7 @@ import fr.ird.observe.dto.data.seine.FloatingObjectDto; |
| 29 | 29 |
import fr.ird.observe.dto.data.seine.FloatingObjectPartDto;
|
| 30 | 30 |
import fr.ird.observe.dto.data.seine.NonTargetCatchComputedValueSource;
|
| 31 | 31 |
import fr.ird.observe.dto.data.seine.SchoolType;
|
| 32 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 32 | 33 |
import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 33 | 34 |
import fr.ird.observe.entities.LengthWeightComputable;
|
| 34 | 35 |
import fr.ird.observe.entities.referentiel.LengthLengthParameter;
|
| ... | ... | @@ -157,7 +158,8 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements |
| 157 | 158 |
|
| 158 | 159 |
FloatingObjectConsolidateEngine floatingObjectConsolidateEngine = new FloatingObjectConsolidateEngine(simplifiedObjectTypeManager);
|
| 159 | 160 |
|
| 160 |
- Optional<ConsolidateTripSeineDataResult> consolidateTripSeineDataResult = consolidateTripSeine(referenceLocale, floatingObjectConsolidateEngine, request.getTripSeineId(), failIfLengthWeightParameterNotFound, failIfLengthLengthParameterNotFound);
|
|
| 161 |
+ DecoratorService decoratorService = new DecoratorService(getReferentialLocale());
|
|
| 162 |
+ Optional<ConsolidateTripSeineDataResult> consolidateTripSeineDataResult = consolidateTripSeine(decoratorService, referenceLocale, floatingObjectConsolidateEngine, request.getTripSeineId(), failIfLengthWeightParameterNotFound, failIfLengthLengthParameterNotFound);
|
|
| 161 | 163 |
return consolidateTripSeineDataResult.orElse(null);
|
| 162 | 164 |
}
|
| 163 | 165 |
|
| ... | ... | @@ -178,7 +180,7 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements |
| 178 | 180 |
return new SimplifiedObjectTypeManager(materialMapping, simplifiedObjectTypeSpecializedRules);
|
| 179 | 181 |
}
|
| 180 | 182 |
|
| 181 |
- private Optional<ConsolidateTripSeineDataResult> consolidateTripSeine(ReferentialLocale referenceLocale, FloatingObjectConsolidateEngine floatingObjectConsolidateEngine, String tripSeineId, boolean failIfLengthWeightParameterNotFound, boolean failIfLengthLengthParameterNotFound) {
|
|
| 183 |
+ private Optional<ConsolidateTripSeineDataResult> consolidateTripSeine(DecoratorService decoratorService, ReferentialLocale referenceLocale, FloatingObjectConsolidateEngine floatingObjectConsolidateEngine, String tripSeineId, boolean failIfLengthWeightParameterNotFound, boolean failIfLengthLengthParameterNotFound) {
|
|
| 182 | 184 |
|
| 183 | 185 |
log.info(String.format("Start consolidate trip: %s", tripSeineId));
|
| 184 | 186 |
|
| ... | ... | @@ -223,24 +225,25 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements |
| 223 | 225 |
int routeMax = tripSeine.sizeRoute();
|
| 224 | 226 |
for (Route route : tripSeine.getRoute()) {
|
| 225 | 227 |
|
| 226 |
- String routePrefix =String.format("Route [%s/%s] ", ++routeIndex, routeMax);
|
|
| 228 |
+ String routePrefix = String.format("Route [%s/%s] ", ++routeIndex, routeMax);
|
|
| 227 | 229 |
log.info(String.format("%s Start consolidate route: %s", routePrefix, route.getTopiaId()));
|
| 228 | 230 |
int activityIndex = 0;
|
| 229 | 231 |
int activityMax = route.sizeActivitySeine();
|
| 230 | 232 |
for (ActivitySeine activitySeine : route.getActivitySeine()) {
|
| 231 | 233 |
|
| 232 |
- String activityPrefix =String.format("%s - Activity [%s/%s] ", routePrefix, ++activityIndex, activityMax);
|
|
| 234 |
+ String activityPrefix = String.format("%s - Activity [%s/%s] ", routePrefix, ++activityIndex, activityMax);
|
|
| 233 | 235 |
|
| 234 | 236 |
boolean floatingObjectEmpty = activitySeine.isFloatingObjectEmpty();
|
| 235 | 237 |
if (!activitySeine.isSetOperation() && floatingObjectEmpty) {
|
| 236 |
- log.info(String.format("%s Skip activity (No set nor dcp found): %s", activityPrefix, activitySeine.getTopiaId()));
|
|
| 237 |
- continue;
|
|
| 238 |
+ log.info(String.format("%s Skip activity (No set nor dcp found): %s", activityPrefix, activitySeine.getTopiaId()));
|
|
| 239 |
+ continue;
|
|
| 238 | 240 |
}
|
| 239 | 241 |
|
| 240 | 242 |
ConsolidateActivitySeineDataResultBuilder resultBuilder = new ConsolidateActivitySeineDataResultBuilder(applicationLocale, referenceLocale, activitySeine.getTopiaId(), ActivitySeines.decorate(referenceLocale.ordinal(), activitySeine));
|
| 241 | 243 |
|
| 242 | 244 |
ConsolidationActivitySeineDataContext activityContext = new ConsolidationActivitySeineDataContext();
|
| 243 | 245 |
activityContext.locale = applicationLocale;
|
| 246 |
+ activityContext.decoratorService = decoratorService;
|
|
| 244 | 247 |
activityContext.failIfLengthWeightParameterNotFound = failIfLengthWeightParameterNotFound;
|
| 245 | 248 |
activityContext.failIfLengthLengthParameterNotFound = failIfLengthLengthParameterNotFound;
|
| 246 | 249 |
activityContext.daoSupplier = persistenceContext;
|
| ... | ... | @@ -331,9 +334,9 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements |
| 331 | 334 |
activityContext.watchTargetLength(targetLength);
|
| 332 | 335 |
|
| 333 | 336 |
updateLengthWeightAble(activityContext,
|
| 334 |
- targetLength.getSpecies(),
|
|
| 335 |
- null, /* pas de sexe precise */
|
|
| 336 |
- targetLength);
|
|
| 337 |
+ targetLength.getSpecies(),
|
|
| 338 |
+ null, /* pas de sexe precise */
|
|
| 339 |
+ targetLength);
|
|
| 337 | 340 |
|
| 338 | 341 |
activityContext.flushTargetLength();
|
| 339 | 342 |
|
| ... | ... | @@ -353,9 +356,9 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements |
| 353 | 356 |
activityContext.watchNonTargetLenght(nonTargetLength);
|
| 354 | 357 |
|
| 355 | 358 |
updateLengthWeightAble(activityContext,
|
| 356 |
- nonTargetLength.getSpecies(),
|
|
| 357 |
- nonTargetLength.getSex(),
|
|
| 358 |
- nonTargetLength);
|
|
| 359 |
+ nonTargetLength.getSpecies(),
|
|
| 360 |
+ nonTargetLength.getSex(),
|
|
| 361 |
+ nonTargetLength);
|
|
| 359 | 362 |
|
| 360 | 363 |
activityContext.flushNonTargetLength();
|
| 361 | 364 |
|
| ... | ... | @@ -411,11 +414,11 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements |
| 411 | 414 |
boolean notWhenArriving = !dcp.getObjectOperation().isWhenArriving();
|
| 412 | 415 |
boolean notWhenLeaving = !dcp.getObjectOperation().isWhenLeaving();
|
| 413 | 416 |
for (FloatingObjectPart floatingObjectPart : dcp.getFloatingObjectPart()) {
|
| 414 |
- if (floatingObjectPart.getWhenArriving()!=null && notWhenArriving) {
|
|
| 417 |
+ if (floatingObjectPart.getWhenArriving() != null && notWhenArriving) {
|
|
| 415 | 418 |
log.info(String.format("Set whenArriving to null for part: %s", floatingObjectPart.getTopiaId()));
|
| 416 | 419 |
floatingObjectPart.setWhenArriving(null);
|
| 417 | 420 |
}
|
| 418 |
- if (floatingObjectPart.getWhenLeaving()!=null && notWhenLeaving) {
|
|
| 421 |
+ if (floatingObjectPart.getWhenLeaving() != null && notWhenLeaving) {
|
|
| 419 | 422 |
log.info(String.format("Set whenLeaving to null for part: %s", floatingObjectPart.getTopiaId()));
|
| 420 | 423 |
floatingObjectPart.setWhenLeaving(null);
|
| 421 | 424 |
}
|
| ... | ... | @@ -27,6 +27,7 @@ import fr.ird.observe.dto.data.seine.DcpComputedValue; |
| 27 | 27 |
import fr.ird.observe.dto.data.seine.FloatingObjectDto;
|
| 28 | 28 |
import fr.ird.observe.dto.data.seine.FloatingObjectPartDto;
|
| 29 | 29 |
import fr.ird.observe.dto.data.seine.SchoolType;
|
| 30 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 30 | 31 |
import fr.ird.observe.entities.referentiel.LengthLengthParameter;
|
| 31 | 32 |
import fr.ird.observe.entities.referentiel.LengthLengthParameterNotFoundException;
|
| 32 | 33 |
import fr.ird.observe.entities.referentiel.LengthLengthParameters;
|
| ... | ... | @@ -72,6 +73,7 @@ class ConsolidationActivitySeineDataContext { |
| 72 | 73 |
boolean failIfLengthLengthParameterNotFound;
|
| 73 | 74 |
BeanMonitor targetLengthMonitor;
|
| 74 | 75 |
String activityPrefix;
|
| 76 |
+ DecoratorService decoratorService;
|
|
| 75 | 77 |
|
| 76 | 78 |
BeanMonitor nonTargetLengthMonitor;
|
| 77 | 79 |
|
| ... | ... | @@ -99,7 +101,7 @@ class ConsolidationActivitySeineDataContext { |
| 99 | 101 |
Ocean ocean = getOcean();
|
| 100 | 102 |
Date routeDate = getRouteDate();
|
| 101 | 103 |
try {
|
| 102 |
- return Optional.ofNullable(LengthWeightParameters.findLengthWeightParameter(daoSupplier, species, sex, ocean, routeDate, sizeMeasureType));
|
|
| 104 |
+ return Optional.ofNullable(LengthWeightParameters.findLengthWeightParameter(decoratorService, daoSupplier, species, sex, ocean, routeDate, sizeMeasureType));
|
|
| 103 | 105 |
} catch (LengthWeightParameterNotFoundException e) {
|
| 104 | 106 |
if (failIfLengthWeightParameterNotFound) {
|
| 105 | 107 |
throw e;
|
| ... | ... | @@ -113,7 +115,7 @@ class ConsolidationActivitySeineDataContext { |
| 113 | 115 |
Ocean ocean = getOcean();
|
| 114 | 116 |
Date routeDate = getRouteDate();
|
| 115 | 117 |
try {
|
| 116 |
- return LengthLengthParameters.findLengthLengthParameter(daoSupplier, species, ocean, sex, routeDate, inputSizeMeasureType, outputSizeMeasureType);
|
|
| 118 |
+ return LengthLengthParameters.findLengthLengthParameter(decoratorService, daoSupplier, species, ocean, sex, routeDate, inputSizeMeasureType, outputSizeMeasureType);
|
|
| 117 | 119 |
} catch (LengthLengthParameterNotFoundException e) {
|
| 118 | 120 |
if (failIfLengthLengthParameterNotFound) {
|
| 119 | 121 |
throw e;
|
| ... | ... | @@ -22,7 +22,9 @@ |
| 22 | 22 |
package fr.ird.observe.services.local.entity;
|
| 23 | 23 |
|
| 24 | 24 |
import com.opensymphony.xwork2.interceptor.annotations.After;
|
| 25 |
+import fr.ird.observe.dto.decoration.DecoratorService;
|
|
| 25 | 26 |
import fr.ird.observe.dto.referential.ReferenceStatus;
|
| 27 |
+import fr.ird.observe.dto.referential.ReferentialLocale;
|
|
| 26 | 28 |
import fr.ird.observe.entities.referentiel.LengthWeightParameter;
|
| 27 | 29 |
import fr.ird.observe.entities.referentiel.LengthWeightParameterNotFoundException;
|
| 28 | 30 |
import fr.ird.observe.entities.referentiel.LengthWeightParameterTopiaDao;
|
| ... | ... | @@ -61,6 +63,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { |
| 61 | 63 |
private static final Logger log = LogManager.getLogger(LengthWeightParemetersTest.class);
|
| 62 | 64 |
|
| 63 | 65 |
private ObserveTopiaPersistenceContext persistenceContext;
|
| 66 |
+ private DecoratorService decoratorService;
|
|
| 64 | 67 |
|
| 65 | 68 |
protected static void createLengthWeightParameter(LengthWeightParameterTopiaDao lengthWeightParameterDao,
|
| 66 | 69 |
Species species,
|
| ... | ... | @@ -91,6 +94,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { |
| 91 | 94 |
@Before
|
| 92 | 95 |
public void setUp() {
|
| 93 | 96 |
|
| 97 |
+ decoratorService =new DecoratorService(ReferentialLocale.FR);
|
|
| 94 | 98 |
persistenceContext = localTestMethodResource.newPersistenceContext();
|
| 95 | 99 |
|
| 96 | 100 |
SpeciesTopiaDao speciesDAO = persistenceContext.getSpeciesDao();
|
| ... | ... | @@ -239,7 +243,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { |
| 239 | 243 |
if (log.isInfoEnabled()) {
|
| 240 | 244 |
log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date);
|
| 241 | 245 |
}
|
| 242 |
- LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, expectedSizeMeasureType);
|
|
| 246 |
+ LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(decoratorService, supplier, species, sex, ocean, date, expectedSizeMeasureType);
|
|
| 243 | 247 |
|
| 244 | 248 |
Assert.assertNotNull("length weith parameter not found for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date, lengthWeightParameter);
|
| 245 | 249 |
Assert.assertEquals("Expected sex is " + expectedSex.getLabel1() + " but the one found was " + lengthWeightParameter.getSex().getLabel1(), expectedSex, lengthWeightParameter.getSex());
|
| ... | ... | @@ -255,7 +259,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { |
| 255 | 259 |
log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date);
|
| 256 | 260 |
}
|
| 257 | 261 |
try {
|
| 258 |
- LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, expectedSizeMeasureType);
|
|
| 262 |
+ LengthWeightParameters.findLengthWeightParameter(decoratorService, supplier, species, sex, ocean, date, expectedSizeMeasureType);
|
|
| 259 | 263 |
Assert.fail();
|
| 260 | 264 |
} catch (LengthWeightParameterNotFoundException e) {
|
| 261 | 265 |
|