Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
June 2018
- 1 participants
- 42 discussions
[Git][ultreiaio/ird-observe][develop-7.x] 2 commits: Fix data widget binding
by Tony CHEMIT 17 Jun '18
by Tony CHEMIT 17 Jun '18
17 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
319fe39c by Tony CHEMIT at 2018-06-17T12:07:57Z
Fix data widget binding
- - - - -
fcbf32da by Tony CHEMIT at 2018-06-17T12:08:18Z
[PS] Formulaire DCP / matériaux / Couleur de surbrillance - Closes #969
- - - - -
7 changed files:
- client-configuration/src/main/config/Client.ini
- client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
- client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
- client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
- client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/config/ShowConfigAction.java
- client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java
Changes:
=====================================
client-configuration/src/main/config/Client.ini
=====================================
--- a/client-configuration/src/main/config/Client.ini
+++ b/client-configuration/src/main/config/Client.ini
@@ -524,6 +524,13 @@ key = ui.noFocusBorderColor.color
type = java.awt.Color
defaultValue = "java.awt.Color[r=192,g=192,b=192]"
+
+[option floatingObjectMaterialErrorColor]
+description = observe.config.ui.dcp.error.color
+key = ui.dcp.error.color
+type = color
+defaultValue = java.awt.Color[r=255,g=100,b=100]
+
[option showMnemonic]
description = observe.config.ui.showMnemonic
key = ui.showMnemonic
=====================================
client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
+++ b/client-configuration/src/main/resources/i18n/client-configuration_en_GB.properties
@@ -78,6 +78,7 @@ observe.config.swingSessionFile.description=Swing session file.
observe.config.temperature.format=Default temperature format
observe.config.ui.autoPopupNumberEditor=Flag sets to true when number editor show automaticly popup
observe.config.ui.changeSynchroSrc=Flag sets to true if you can change local source in admin tasks
+observe.config.ui.dcp.error.color=Color to notify errors while validating floating object materials.
observe.config.ui.focusBorderColor=Color of the focus container border
observe.config.ui.fullscreen=Flag sets to true to lauch application in full screen mode
observe.config.ui.loadLocalStorage=Flag sets to true to load local data source when application starts
=====================================
client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
+++ b/client-configuration/src/main/resources/i18n/client-configuration_es_ES.properties
@@ -78,6 +78,7 @@ observe.config.swingSessionFile.description=Fichier de sauvegarde des états des
observe.config.temperature.format=Default temperature format \#TODO
observe.config.ui.autoPopupNumberEditor=Para mostrar automáticamente el editor numérico durante la edición de un número
observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
+observe.config.ui.dcp.error.color=Color to notify errors while validating floating object materials. \#TODO
observe.config.ui.focusBorderColor=Couleur de la bordure de la zone qui a le focus \#TODO
observe.config.ui.fullscreen=Para mostrar en modo pantalla completa la aplicación
observe.config.ui.loadLocalStorage=Cambiar la base local al iniciar la aplicación
=====================================
client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
=====================================
--- a/client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
+++ b/client-configuration/src/main/resources/i18n/client-configuration_fr_FR.properties
@@ -78,6 +78,7 @@ observe.config.swingSessionFile.description=Fichier de sauvegarde des états des
observe.config.temperature.format=Unité de température
observe.config.ui.autoPopupNumberEditor=Pour afficher automatiquement l'éditeur numérique lors de l'édition d'un nombre
observe.config.ui.changeSynchroSrc=Pour autoriser la sélection de la base source dans les opérations sur base
+observe.config.ui.dcp.error.color=Couleur pour notifier les erreurs sur la composition des dcps
observe.config.ui.focusBorderColor=Couleur de la bordure de la zone qui a le focus
observe.config.ui.fullscreen=Pour afficher l'application en mode pleine écran
observe.config.ui.loadLocalStorage=Charger la base locale au démarrage de l'application
=====================================
client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/config/ShowConfigAction.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/config/ShowConfigAction.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/config/ShowConfigAction.java
@@ -206,6 +206,7 @@ public class ShowConfigAction extends MenuActionSupport {
helper.addOption(ClientConfigOption.FOCUS_BORDER_COLOR);
helper.addOption(ClientConfigOption.NO_FOCUS_BORDER_COLOR);
+ helper.addOption(ClientConfigOption.FLOATING_OBJECT_MATERIAL_ERROR_COLOR);
helper.addOption(ClientConfigOption.DEFAULT_DB_MODE);
helper.addOption(ClientConfigOption.DEFAULT_CREATION_MODE);
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/ContentUIInitializer.java
@@ -693,6 +693,9 @@ public class ContentUIInitializer<E extends IdDto, UI extends ContentUI<E, UI>>
picker.addActionListener(e -> {
JXDatePicker source = (JXDatePicker) e.getSource();
Date date = source.getDate();
+ if (getBean()==null) {
+ return;
+ }
if (Objects.equals(date, UIHelper.getProperty(getBean(), propertyName))) {
// On n'envoie pas la demande, car cela va modifier ensuite le formulaire
// car avec oldValue=null et newValue=null, les pcs sont déclanchés...
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/FloatingObjectUIHandler.java
@@ -22,7 +22,6 @@
package fr.ird.observe.client.ui.content.data.seine;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
import fr.ird.observe.client.ObserveSwingApplicationContext;
import fr.ird.observe.client.db.ClientDataContext;
import fr.ird.observe.client.db.ObserveSwingDataSource;
@@ -72,7 +71,6 @@ import javax.swing.event.TableModelListener;
import javax.swing.event.TreeModelEvent;
import java.awt.Color;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -430,17 +428,16 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto,
FloatingObjectPartsTreeNode node = (FloatingObjectPartsTreeNode) component.getPathForRow(row).getLastPathComponent();
boolean valid1 = node.isValid(1);
boolean valid2 = node.isValid(2);
- boolean valid = valid1 && valid2;
switch (adapter.convertRowIndexToModel(adapter.column)) {
case 0:
- return !valid;
+ return false;
case 1:
return !valid1;
case 2:
return !valid2;
}
return true;
- }, Color.RED, Color.WHITE));
+ }, ObserveSwingApplicationContext.get().getConfig().getFloatingObjectMaterialErrorColor(), Color.WHITE));
}
protected void computeTabValidState(SwingValidatorMessageTableModel errorTableModel) {
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/fac4d0130ae2a3b5ee16315fe0…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/fac4d0130ae2a3b5ee16315fe0…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] Barre de progression sur calcul de données - Closes #963
by Tony CHEMIT 17 Jun '18
by Tony CHEMIT 17 Jun '18
17 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
fac4d013 by Tony CHEMIT at 2018-06-17T11:47:15Z
Barre de progression sur calcul de données - Closes #963
- - - - -
1 changed file:
- client/src/main/java/fr/ird/observe/client/ui/admin/consolidate/ConsolidateUIHandler.java
Changes:
=====================================
client/src/main/java/fr/ird/observe/client/ui/admin/consolidate/ConsolidateUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/admin/consolidate/ConsolidateUIHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/admin/consolidate/ConsolidateUIHandler.java
@@ -121,6 +121,8 @@ public class ConsolidateUIHandler extends AdminTabUIHandler<ConsolidateUI> imple
ObserveRunner.cleanMemory();
}
+ progressModel.incrementsCurrentStep();
+
ImmutableSet<ConsolidateTripSeineDataResult> results = resultsBuilder.build();
if (results.isEmpty()) {
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/fac4d0130ae2a3b5ee16315fe09…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/fac4d0130ae2a3b5ee16315fe09…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] Des racourcis clavier interfèrent avec l'autocomplétion des listes déroulantes - Closes #953
by Tony CHEMIT 17 Jun '18
by Tony CHEMIT 17 Jun '18
17 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
a14ba256 by Tony CHEMIT at 2018-06-17T11:42:59Z
Des racourcis clavier interfèrent avec l'autocomplétion des listes déroulantes - Closes #953
- - - - -
2 changed files:
- client/src/main/java/fr/ird/observe/client/ui/actions/UIActionSupport.java
- client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/MenuActionSupport.java
Changes:
=====================================
client/src/main/java/fr/ird/observe/client/ui/actions/UIActionSupport.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/actions/UIActionSupport.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/actions/UIActionSupport.java
@@ -6,15 +6,15 @@
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
+ *
+ * You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
@@ -125,7 +125,9 @@ public abstract class UIActionSupport extends AbstractAction {
//FIXME Attention on introduit un état dans l'action et si l'action est utilisée plusieurs fois dans un même écran
//FIXME cela va introduire des effets de bord
putValue(EDITOR, editor);
- register(inputMap, actionMap);
+ if (inputMap != null && actionMap != null) {
+ register(inputMap, actionMap);
+ }
}
private void register(InputMap inputMap, ActionMap actionMap) {
=====================================
client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/MenuActionSupport.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/MenuActionSupport.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/actions/main/menu/MenuActionSupport.java
@@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.actions.main.menu;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -30,7 +30,11 @@ import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
import java.awt.event.ActionEvent;
import java.util.Objects;
@@ -41,6 +45,8 @@ import java.util.Objects;
*/
public abstract class MenuActionSupport extends UIActionSupport {
+ private boolean menuSelected;
+
protected MenuActionSupport(ObserveMainUI mainUI, String actionCommandKey, String label, String shortDescription, String actionIcon, KeyStroke acceleratorKey) {
super(mainUI, actionCommandKey, label, shortDescription, actionIcon, acceleratorKey, false);
}
@@ -52,7 +58,6 @@ public abstract class MenuActionSupport extends UIActionSupport {
@Override
public void actionPerformed(ActionEvent e) {
-
if (canExecuteAction(e)) {
doActionPerformed(e);
}
@@ -67,20 +72,36 @@ public abstract class MenuActionSupport extends UIActionSupport {
return false;
}
if (editor instanceof JMenuItem) {
- return ((JMenuItem) editor).isArmed();
+ return menuSelected && ((JMenuItem) editor).isArmed();
}
return editor.isShowing();
}
@Override
public void initForMainUi(AbstractButton editor) {
- super.initForMainUi(editor);
- if (editor instanceof JButton) {
+ JComponent parent = (JComponent) editor.getParent();
+ if (parent instanceof JPopupMenu) {
+ ((JPopupMenu) parent).addPopupMenuListener(new PopupMenuListener() {
+ @Override
+ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+ menuSelected = true;
+ }
- // this is a normal button using a menu action, let's add to text accelerator
+ @Override
+ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
+ SwingUtilities.invokeLater(() -> menuSelected = false);
+ }
+ @Override
+ public void popupMenuCanceled(PopupMenuEvent e) {
+ menuSelected = false;
+ }
+ });
+ }
+ initForMainUi(editor, null, null);
+ if (editor instanceof JButton) {
+ // this is a normal button using a menu action, let's add to text accelerator
ObserveKeyStrokes.addKeyStoreToText(editor, this);
}
-
}
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/a14ba256b742a730e3892160fa1…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/a14ba256b742a730e3892160fa1…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] Page des caractéristiques d'équipements -> champs texte tronqués à l'affichage - Closes #957
by Tony CHEMIT 17 Jun '18
by Tony CHEMIT 17 Jun '18
17 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
36ff53dd by Tony CHEMIT at 2018-06-17T00:32:47Z
Page des caractéristiques d'équipements -> champs texte tronqués à l'affichage - Closes #957
- - - - -
1 changed file:
- client/src/main/java/fr/ird/observe/client/ui/content/table/GearUseFeatureMeasurementCellRenderer.java
Changes:
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/table/GearUseFeatureMeasurementCellRenderer.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/table/GearUseFeatureMeasurementCellRenderer.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/table/GearUseFeatureMeasurementCellRenderer.java
@@ -52,7 +52,7 @@ public class GearUseFeatureMeasurementCellRenderer implements TableCellRenderer
{
// texte
- TableCellRenderer cellRenderer = UIHelper.newStringTableCellRenderer(renderer, 10, true);
+ TableCellRenderer cellRenderer = UIHelper.newStringTableCellRenderer(renderer, 100, true);
renderersByCaracteristicTypeId.put("fr.ird.observe.entities.referentiel.GearCaracteristicType#1239832686123#0.1", cellRenderer);
}
{
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/36ff53dd8f6bc3a8cfb9399f441…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/36ff53dd8f6bc3a8cfb9399f441…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] 3 commits: -m[REFERENTIEL] L'écran du référentiel taille-poids plante à son ouverture - Closes #964
by Tony CHEMIT 17 Jun '18
by Tony CHEMIT 17 Jun '18
17 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
ae453e7b by Tony CHEMIT at 2018-06-17T00:25:20Z
-m[REFERENTIEL] L'écran du référentiel taille-poids plante à son ouverture - Closes #964
- - - - -
4d31f01c by Tony CHEMIT at 2018-06-17T00:25:51Z
[REFERENTIEL] L'écran du référentiel taille-taille plante - Closes #965
- - - - -
a0e85176 by Tony CHEMIT at 2018-06-17T00:27:45Z
[REFERENTIEL] Lien entre lengthlengthparameter et species ? - Closes #962
- - - - -
20 changed files:
- client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUI.jaxx
- client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUIModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthWeightParameterUIModel.java
- dto/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterDtoReferenceBinder.java
- dto/src/main/models/Observe.model
- persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityDtoBinder.java
- persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityReferenceBinder.java
- persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_3.java
- persistence/src/main/models/Observe.model
- + persistence/src/main/resources/db/migration/7.3/02_add_length_length_parameter_species-common.sql
- test/src/main/resources/db/7.3/dataForTestLongline.sql.gz
- test/src/main/resources/db/7.3/dataForTestSeine.sql.gz
- test/src/main/resources/db/7.3/empty_h2.sql.gz
- test/src/main/resources/db/7.3/empty_pg.sql.gz
- test/src/main/resources/db/7.3/referentiel.sql.gz
- validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-create-error-validation.xml
- validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-update-error-validation.xml
- validation/src/main/resources/i18n/validation_en_GB.properties
- validation/src/main/resources/i18n/validation_es_ES.properties
- validation/src/main/resources/i18n/validation_fr_FR.properties
Changes:
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUI.jaxx
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUI.jaxx
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUI.jaxx
@@ -30,6 +30,7 @@
fr.ird.observe.dto.reference.ReferentialDtoReference
fr.ird.observe.dto.referential.SizeMeasureTypeDto
fr.ird.observe.dto.referential.SizeMeasureTypeReference
+ fr.ird.observe.dto.referential.SpeciesReference
fr.ird.observe.dto.referential.LengthLengthParameterDto
fr.ird.observe.dto.referential.LengthLengthParameterReference
fr.ird.observe.client.ui.util.UIHelper
@@ -63,6 +64,16 @@
<tab id='generalTab' computeI18n="">
<Table fill="both">
+ <!-- species -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='speciesLabel'/>
+ </cell>
+ <cell anchor='east' weightx="1" fill="both">
+ <BeanComboBox id='species' constructorParams='this' genericType='SpeciesReference'/>
+ </cell>
+ </row>
+
<!-- inputSizeMeasureType -->
<row>
<cell anchor='west'>
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUIModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUIModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthLengthParameterUIModel.java
@@ -47,6 +47,7 @@ public class LengthLengthParameterUIModel extends ContentReferenceUIModel<Length
LengthLengthParameterDto.PROPERTY_STATUS,
LengthLengthParameterDto.PROPERTY_NEED_COMMENT,
LengthLengthParameterDto.PROPERTY_SOURCE,
+ LengthLengthParameterDto.PROPERTY_SPECIES,
LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE,
LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE).build();
@@ -65,13 +66,15 @@ public class LengthLengthParameterUIModel extends ContentReferenceUIModel<Length
public LengthLengthParameterUIModel() {
super(LengthLengthParameterDto.class,
- null,
+ LengthLengthParameterReference.class,
new String[]{
LengthLengthParameterDto.PROPERTY_INPUT_SIZE_MEASURE_TYPE,
LengthLengthParameterDto.PROPERTY_OUTPUT_SIZE_MEASURE_TYPE,
+ LengthLengthParameterDto.PROPERTY_SPECIES,
},
new String[]{
LengthLengthParameterUI.BINDING_INPUT_SIZE_MEASURE_TYPE_SELECTED_ITEM,
+ LengthLengthParameterUI.BINDING_SPECIES_SELECTED_ITEM,
LengthLengthParameterUI.BINDING_INPUT_OUTPUT_FORMULA_TEXT,
LengthLengthParameterUI.BINDING_OUTPUT_SIZE_MEASURE_TYPE_SELECTED_ITEM,
LengthLengthParameterUI.BINDING_OUTPUT_INPUT_FORMULA_TEXT,
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthWeightParameterUIModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthWeightParameterUIModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/ref/common/LengthWeightParameterUIModel.java
@@ -71,7 +71,7 @@ public class LengthWeightParameterUIModel extends ContentReferenceUIModel<Length
public LengthWeightParameterUIModel() {
super(LengthWeightParameterDto.class,
- null,
+ LengthWeightParameterReference.class,
new String[]{
LengthWeightParameterDto.PROPERTY_SEX,
LengthWeightParameterDto.PROPERTY_OCEAN,
=====================================
dto/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterDtoReferenceBinder.java
=====================================
--- a/dto/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterDtoReferenceBinder.java
+++ b/dto/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterDtoReferenceBinder.java
@@ -42,6 +42,7 @@ public class LengthLengthParameterDtoReferenceBinder extends ReferentialDtoRefer
public LengthLengthParameterReference toReference(ReferentialLocale referentialLocale, LengthLengthParameterDto dto) {
return new LengthLengthParameterReference(dto, dto.getCode(),
+ dto.getSpecies().getLabel(),
dto.getInputSizeMeasureType().getLabel(),
dto.getOutputSizeMeasureType().getLabel(),
dto.getInputOutputFormula(),
=====================================
dto/src/main/models/Observe.model
=====================================
--- a/dto/src/main/models/Observe.model
+++ b/dto/src/main/models/Observe.model
@@ -382,13 +382,14 @@ longitude + {*:1} Float
quadrant + {*:1} Integer
country {*:0..1} fr.ird.observe.dto.referential.CountryReference
-referential.LengthLengthParameter > referential.Referential >> WithComment | references=code,inputSizeMeasureTypeLabel,outputSizeMeasureTypeLabel,inputOutputFormula,outputInputFormula
+referential.LengthLengthParameter > referential.Referential >> WithComment | references=code,speciesLabel,inputSizeMeasureTypeLabel,outputSizeMeasureTypeLabel,inputOutputFormula,outputInputFormula
coefficients + {*:1} String
inputOutputFormula + {*:1} String
inputOutputFormulaValid + {*:1} boolean
outputInputFormula + {*:1} String
outputInputFormulaValid + {*:1} boolean
source + {*:1} String
+species {*:1} fr.ird.observe.dto.referential.SpeciesReference
inputSizeMeasureType {*:1} fr.ird.observe.dto.referential.SizeMeasureTypeReference
outputSizeMeasureType {*:1} fr.ird.observe.dto.referential.SizeMeasureTypeReference
=====================================
persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityDtoBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityDtoBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityDtoBinder.java
@@ -40,28 +40,26 @@ public class LengthLengthParameterEntityDtoBinder extends ReferentialEntityDtoBi
@Override
public void copyToEntity(ReferentialLocale referentialLocale, LengthLengthParameterDto dto, LengthLengthParameter entity) {
-
copyDtoReferentialFieldsToEntity(dto, entity);
entity.setInputOutputFormula(dto.getInputOutputFormula());
entity.setOutputInputFormula(dto.getOutputInputFormula());
+ entity.setSpecies(toEntity(dto.getSpecies()));
entity.setInputSizeMeasureType(toEntity(dto.getInputSizeMeasureType()));
entity.setOutputSizeMeasureType(toEntity(dto.getOutputSizeMeasureType()));
entity.setCoefficients(dto.getCoefficients());
entity.setSource(dto.getSource());
-
}
@Override
public void copyToDto(ReferentialLocale referentialLocale, LengthLengthParameter entity, LengthLengthParameterDto dto) {
-
copyEntityReferentialFieldsToDto(entity, dto);
dto.setInputOutputFormula(entity.getInputOutputFormula());
dto.setOutputInputFormula(entity.getOutputInputFormula());
+ dto.setSpecies(toReferentialReference(referentialLocale, entity.getSpecies()));
dto.setInputSizeMeasureType(toReferentialReference(referentialLocale, entity.getInputSizeMeasureType()));
dto.setOutputSizeMeasureType(toReferentialReference(referentialLocale, entity.getOutputSizeMeasureType()));
dto.setCoefficients(entity.getCoefficients());
dto.setSource(entity.getSource());
-
}
}
=====================================
persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityReferenceBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityReferenceBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/referential/common/LengthLengthParameterEntityReferenceBinder.java
@@ -41,12 +41,11 @@ public class LengthLengthParameterEntityReferenceBinder extends ReferentialEntit
@Override
public LengthLengthParameterReference toReference(ReferentialLocale referentialLocale, LengthLengthParameter dto) {
-
return new LengthLengthParameterReference(dto, dto.getCode(),
+ dto.getSpecies().getLabel(referentialLocale),
dto.getInputSizeMeasureType().getLabel(referentialLocale),
dto.getOutputSizeMeasureType().getLabel(referentialLocale),
dto.getInputOutputFormula(),
dto.getOutputInputFormula());
-
}
}
=====================================
persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_3.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_3.java
+++ b/persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_3.java
@@ -43,6 +43,7 @@ public class DataSourceMigrationForVersion_7_3 extends MigrationVersionResource
@Override
public void generateSqlScript(MigrationVersionResourceExecutor executor) {
executor.addScript("01", "remove_one_size_measure_type");
+ executor.addScript("02", "add_length_length_parameter_species");
}
}
=====================================
persistence/src/main/models/Observe.model
=====================================
--- a/persistence/src/main/models/Observe.model
+++ b/persistence/src/main/models/Observe.model
@@ -480,6 +480,7 @@ getLabel(referentialLocale !fr.ird.observe.dto.referential.ReferentialLocale) St
referentiel.LengthLengthParameter > referentiel.FormulaSupport | entity
inputOutputFormula + {*:1} String
outputInputFormula + {*:1} String
+species {*:1} referentiel.Species | notNull lazy=false
inputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false
outputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false
=====================================
persistence/src/main/resources/db/migration/7.3/02_add_length_length_parameter_species-common.sql
=====================================
--- /dev/null
+++ b/persistence/src/main/resources/db/migration/7.3/02_add_length_length_parameter_species-common.sql
@@ -0,0 +1,25 @@
+---
+-- #%L
+-- ObServe :: Persistence
+-- %%
+-- Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
+-- %%
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as
+-- published by the Free Software Foundation, either version 3 of the
+-- License, or (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public
+-- License along with this program. If not, see
+-- <http://www.gnu.org/licenses/gpl-3.0.html>.
+-- #L%
+---
+
+ALTER TABLE observe_common.lengthlengthparameter ADD COLUMN species VARCHAR(255);
+ALTER TABLE observe_common.lengthlengthparameter ADD CONSTRAINT fk_lengthlengthparameter_species FOREIGN KEY (species) REFERENCES observe_common.species(topiaid);
+CREATE INDEX idx_observe_common_lengthlengthparameter_species ON observe_common.lengthlengthparameter(species);
\ No newline at end of file
=====================================
test/src/main/resources/db/7.3/dataForTestLongline.sql.gz
=====================================
The diff for this file was not included because it is too large.
=====================================
test/src/main/resources/db/7.3/dataForTestSeine.sql.gz
=====================================
The diff for this file was not included because it is too large.
=====================================
test/src/main/resources/db/7.3/empty_h2.sql.gz
=====================================
--- a/test/src/main/resources/db/7.3/empty_h2.sql.gz
+++ b/test/src/main/resources/db/7.3/empty_h2.sql.gz
@@ -10,7 +10,7 @@ create table OBSERVE_COMMON.gearCaracteristic (topiaId varchar(255) not null, to
create table OBSERVE_COMMON.gearCaracteristicType (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.harbour (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, country varchar(255), locode varchar(255), name varchar(255), latitude float, longitude float, primary key (topiaId));
create table OBSERVE_COMMON.lastUpdateDate (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, type varchar(255), primary key (topiaId));
-create table OBSERVE_COMMON.lengthLengthParameter (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, coefficients varchar(255), source varchar(2147483647), inputOutputFormula varchar(255), outputInputFormula varchar(255), inputSizeMeasureType varchar(255), outputSizeMeasureType varchar(255), primary key (topiaId));
+create table OBSERVE_COMMON.lengthLengthParameter (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, coefficients varchar(255), source varchar(2147483647), inputOutputFormula varchar(255), outputInputFormula varchar(255), species varchar(255) not null, inputSizeMeasureType varchar(255), outputSizeMeasureType varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.lengthWeightParameter (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, coefficients varchar(255), source varchar(2147483647), ocean varchar(255) not null, species varchar(255) not null, sex varchar(255) not null, startDate timestamp, endDate timestamp, lengthWeightFormula varchar(255), weightLengthFormula varchar(255), meanLength float, meanWeight float, sizeMeasureType varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.ocean (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.ocean_species (species varchar(255), ocean varchar(255) not null);
@@ -118,6 +118,7 @@ alter table OBSERVE_COMMON.gear_gearcaracteristic add constraint fk_gear_gearcar
alter table OBSERVE_COMMON.gear_gearcaracteristic add constraint fk_gear_gearcaracteristic_gear foreign key (gear) references OBSERVE_COMMON.gear;
alter table OBSERVE_COMMON.gearCaracteristic add constraint fk_gearcaracteristic_gearcaracteristictype foreign key (gearCaracteristicType) references OBSERVE_COMMON.gearCaracteristicType;
alter table OBSERVE_COMMON.harbour add constraint fk_harbour_country foreign key (country) references OBSERVE_COMMON.country;
+alter table OBSERVE_COMMON.lengthLengthParameter add constraint fk_lengthlengthparameter_species foreign key (species) references OBSERVE_COMMON.species;
alter table OBSERVE_COMMON.lengthLengthParameter add constraint fk_lengthlengthparameter_inputsizemeasuretype foreign key (inputSizeMeasureType) references OBSERVE_COMMON.sizeMeasureType;
alter table OBSERVE_COMMON.lengthLengthParameter add constraint fk_lengthlengthparameter_outputsizemeasuretype foreign key (outputSizeMeasureType) references OBSERVE_COMMON.sizeMeasureType;
alter table OBSERVE_COMMON.lengthWeightParameter add constraint fk_lengthweightparameter_ocean foreign key (ocean) references OBSERVE_COMMON.ocean;
=====================================
test/src/main/resources/db/7.3/empty_pg.sql.gz
=====================================
--- a/test/src/main/resources/db/7.3/empty_pg.sql.gz
+++ b/test/src/main/resources/db/7.3/empty_pg.sql.gz
@@ -10,7 +10,7 @@ create table OBSERVE_COMMON.gearCaracteristic (topiaId varchar(255) not null, to
create table OBSERVE_COMMON.gearCaracteristicType (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.harbour (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, country varchar(255), locode varchar(255), name varchar(255), latitude float4, longitude float4, primary key (topiaId));
create table OBSERVE_COMMON.lastUpdateDate (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, type varchar(255), primary key (topiaId));
-create table OBSERVE_COMMON.lengthLengthParameter (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, coefficients varchar(255), source text, inputOutputFormula varchar(255), outputInputFormula varchar(255), inputSizeMeasureType varchar(255), outputSizeMeasureType varchar(255), primary key (topiaId));
+create table OBSERVE_COMMON.lengthLengthParameter (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, coefficients varchar(255), source text, inputOutputFormula varchar(255), outputInputFormula varchar(255), species varchar(255) not null, inputSizeMeasureType varchar(255), outputSizeMeasureType varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.lengthWeightParameter (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, coefficients varchar(255), source text, ocean varchar(255) not null, species varchar(255) not null, sex varchar(255) not null, startDate timestamp, endDate timestamp, lengthWeightFormula varchar(255), weightLengthFormula varchar(255), meanLength float4, meanWeight float4, sizeMeasureType varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.ocean (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId));
create table OBSERVE_COMMON.ocean_species (species varchar(255), ocean varchar(255) not null);
@@ -118,6 +118,7 @@ alter table if exists OBSERVE_COMMON.gear_gearcaracteristic add constraint fk_ge
alter table if exists OBSERVE_COMMON.gear_gearcaracteristic add constraint fk_gear_gearcaracteristic_gear foreign key (gear) references OBSERVE_COMMON.gear;
alter table if exists OBSERVE_COMMON.gearCaracteristic add constraint fk_gearcaracteristic_gearcaracteristictype foreign key (gearCaracteristicType) references OBSERVE_COMMON.gearCaracteristicType;
alter table if exists OBSERVE_COMMON.harbour add constraint fk_harbour_country foreign key (country) references OBSERVE_COMMON.country;
+alter table if exists OBSERVE_COMMON.lengthLengthParameter add constraint fk_lengthlengthparameter_species foreign key (species) references OBSERVE_COMMON.species;
alter table if exists OBSERVE_COMMON.lengthLengthParameter add constraint fk_lengthlengthparameter_inputsizemeasuretype foreign key (inputSizeMeasureType) references OBSERVE_COMMON.sizeMeasureType;
alter table if exists OBSERVE_COMMON.lengthLengthParameter add constraint fk_lengthlengthparameter_outputsizemeasuretype foreign key (outputSizeMeasureType) references OBSERVE_COMMON.sizeMeasureType;
alter table if exists OBSERVE_COMMON.lengthWeightParameter add constraint fk_lengthweightparameter_ocean foreign key (ocean) references OBSERVE_COMMON.ocean;
=====================================
test/src/main/resources/db/7.3/referentiel.sql.gz
=====================================
The diff for this file was not included because it is too large.
=====================================
validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-create-error-validation.xml
=====================================
--- a/validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-create-error-validation.xml
+++ b/validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-create-error-validation.xml
@@ -35,6 +35,22 @@
</field>
+
+ <field name="species">
+ <!-- pas de species selectionne -->
+ <field-validator type="required" short-circuit="true">
+ <message>observe.validation.lengthWeightParameter.required.species</message>
+ </field-validator>
+
+ <!-- clef unique species -->
+ <field-validator type="observeCollectionUniqueKeyDto" short-circuit="true">
+ <param name="collectionFieldName">editingReferentielList</param>
+ <param name="keys">species</param>
+ <!--<param name="againstMe">true</param>-->
+ <message>observe.validation.lengthWeightParameter.invalid.uniqueKey</message>
+ </field-validator>
+ </field>
+
<field name="inputSizeMeasureType">
<!-- intputSizeMeasureType desactive -->
=====================================
validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-update-error-validation.xml
=====================================
--- a/validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-update-error-validation.xml
+++ b/validation/src/main/resources/fr/ird/observe/dto/referential/LengthLengthParameterDto-update-error-validation.xml
@@ -26,6 +26,21 @@
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
<validators>
+ <field name="species">
+ <!-- pas de species selectionne -->
+ <field-validator type="required" short-circuit="true">
+ <message>observe.validation.lengthWeightParameter.required.species</message>
+ </field-validator>
+
+ <!-- clef unique species -->
+ <field-validator type="observeCollectionUniqueKeyDto" short-circuit="true">
+ <param name="collectionFieldName">editingReferentielList</param>
+ <param name="keys">species</param>
+ <!--<param name="againstMe">true</param>-->
+ <message>observe.validation.lengthWeightParameter.invalid.uniqueKey</message>
+ </field-validator>
+ </field>
+
<field name="inputOutputFormula">
<!-- pas de relation inputOutputFormula renseignee -->
<field-validator type="requiredstring" short-circuit="true">
=====================================
validation/src/main/resources/i18n/validation_en_GB.properties
=====================================
--- a/validation/src/main/resources/i18n/validation_en_GB.properties
+++ b/validation/src/main/resources/i18n/validation_en_GB.properties
@@ -103,6 +103,7 @@ observe.common.LengthLengthParameterDto.coefficients=Coefficients
observe.common.LengthLengthParameterDto.inputSizeMeasureType=Input size measure type
observe.common.LengthLengthParameterDto.outputInputFormula=Output to Input formula
observe.common.LengthLengthParameterDto.outputSizeMeasureType=Output size measure type
+observe.common.LengthLengthParameterDto.species=Species
observe.common.LengthWeightParameterDto.coefficients=Coefficients
observe.common.LengthWeightParameterDto.endDate=End date
observe.common.LengthWeightParameterDto.lengthWeightFormula=Length weight formula
=====================================
validation/src/main/resources/i18n/validation_es_ES.properties
=====================================
--- a/validation/src/main/resources/i18n/validation_es_ES.properties
+++ b/validation/src/main/resources/i18n/validation_es_ES.properties
@@ -103,6 +103,7 @@ observe.common.LengthLengthParameterDto.coefficients=Coeficientes
observe.common.LengthLengthParameterDto.inputSizeMeasureType=Type de mensuration d'entrée \#TODO
observe.common.LengthLengthParameterDto.outputInputFormula=Formule Sortie vers Entrée \#TODO
observe.common.LengthLengthParameterDto.outputSizeMeasureType=Type de mensuration de sortie \#TODO
+observe.common.LengthLengthParameterDto.species=Especie
observe.common.LengthWeightParameterDto.coefficients=Coeficientes
observe.common.LengthWeightParameterDto.endDate=Fecha de fin
observe.common.LengthWeightParameterDto.lengthWeightFormula=Relación de peso
=====================================
validation/src/main/resources/i18n/validation_fr_FR.properties
=====================================
--- a/validation/src/main/resources/i18n/validation_fr_FR.properties
+++ b/validation/src/main/resources/i18n/validation_fr_FR.properties
@@ -103,6 +103,7 @@ observe.common.LengthLengthParameterDto.coefficients=Coefficients
observe.common.LengthLengthParameterDto.inputSizeMeasureType=Type de mensuration d'entrée
observe.common.LengthLengthParameterDto.outputInputFormula=Formule sortie -> entrée
observe.common.LengthLengthParameterDto.outputSizeMeasureType=Type de mensuration de sortie
+observe.common.LengthLengthParameterDto.species=Espèce
observe.common.LengthWeightParameterDto.coefficients=Coefficients
observe.common.LengthWeightParameterDto.endDate=Fin de validité
observe.common.LengthWeightParameterDto.lengthWeightFormula=Relation Poids
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/8c0a556ca195d9c0a3057bb9b6…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/8c0a556ca195d9c0a3057bb9b6…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] Validation système observé / RHN - Closes #973
by Tony CHEMIT 16 Jun '18
by Tony CHEMIT 16 Jun '18
16 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
8c0a556c by Tony CHEMIT at 2018-06-16T09:08:19Z
Validation système observé / RHN - Closes #973
- - - - -
9 changed files:
- dto/src/main/models/Observe.model
- persistence/src/main/java/fr/ird/observe/binder/data/seine/ActivitySeineEntityDtoBinder.java
- services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java
- + services/src/main/java/fr/ird/observe/services/validation/validators/ActivitySeineObservedSystemValidator.java
- validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml
- validation/src/main/resources/i18n/validation_en_GB.properties
- validation/src/main/resources/i18n/validation_es_ES.properties
- validation/src/main/resources/i18n/validation_fr_FR.properties
- validation/src/main/resources/validators.xml
Changes:
=====================================
dto/src/main/models/Observe.model
=====================================
--- a/dto/src/main/models/Observe.model
+++ b/dto/src/main/models/Observe.model
@@ -631,6 +631,7 @@ nextFpaZone {*:0..1} fr.ird.observe.dto.referential.FpaZoneReference
dataQuality {*:0..1} fr.ird.observe.dto.referential.DataQualityReference
setSeine {*:0..1} fr.ird.observe.dto.data.seine.SetSeineReference
observedSystem {*:*} fr.ird.observe.dto.referential.seine.ObservedSystemReference
+nonTargetCatchSpecies {*:*} fr.ird.observe.dto.referential.SpeciesReference | unique
data.seine.ActivitySeineStub > data.Data
time + {*:1} Date
=====================================
persistence/src/main/java/fr/ird/observe/binder/data/seine/ActivitySeineEntityDtoBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/data/seine/ActivitySeineEntityDtoBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/data/seine/ActivitySeineEntityDtoBinder.java
@@ -10,22 +10,28 @@ package fr.ird.observe.binder.data.seine;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
+import com.google.common.collect.ImmutableSet;
import fr.ird.observe.binder.data.DataEntityDtoBinderSupport;
+import fr.ird.observe.binder.referential.common.SpeciesEntityReferenceBinder;
import fr.ird.observe.dto.data.seine.ActivitySeineDto;
import fr.ird.observe.dto.referential.ReferentialLocale;
+import fr.ird.observe.dto.referential.SpeciesReference;
import fr.ird.observe.entities.seine.ActivitySeine;
+import fr.ird.observe.entities.seine.NonTargetCatch;
+
+import java.util.stream.Collectors;
/**
* Created on 24/11/15.
@@ -40,9 +46,7 @@ public class ActivitySeineEntityDtoBinder extends DataEntityDtoBinderSupport<Act
@Override
public void copyToEntity(ReferentialLocale referentialLocale, ActivitySeineDto dto, ActivitySeine entity) {
-
copyDtoDataFieldsToEntity(dto, entity);
-
entity.setTime(dto.getTime());
entity.setLatitude(dto.getLatitude());
entity.setLongitude(dto.getLongitude());
@@ -60,14 +64,11 @@ public class ActivitySeineEntityDtoBinder extends DataEntityDtoBinderSupport<Act
entity.setNextFpaZone(toEntity(dto.getNextFpaZone()));
entity.setObservedSystem(toEntitySet(dto.getObservedSystem()));
entity.setDataQuality(toEntity(dto.getDataQuality()));
-
}
@Override
public void copyToDto(ReferentialLocale referentialLocale, ActivitySeine entity, ActivitySeineDto dto) {
-
copyEntityDataFieldsToDto(entity, dto);
-
dto.setTime(entity.getTime());
dto.setLatitude(entity.getLatitude());
dto.setLongitude(entity.getLongitude());
@@ -88,6 +89,12 @@ public class ActivitySeineEntityDtoBinder extends DataEntityDtoBinderSupport<Act
dto.setObservedSystem(toReferentialReferenceList(referentialLocale, entity.getObservedSystem()));
dto.setFloatingObjectEmpty(entity.isFloatingObjectEmpty());
dto.setDataQuality(toReferentialReference(referentialLocale, entity.getDataQuality()));
+ ImmutableSet.Builder<SpeciesReference> nonTargetSpecies = ImmutableSet.builder();
+ if (entity.getSetSeine() != null && entity.getSetSeine().isNonTargetCatchNotEmpty()) {
+ SpeciesEntityReferenceBinder binder = new SpeciesEntityReferenceBinder();
+ nonTargetSpecies.addAll(entity.getSetSeine().getNonTargetCatch().stream().map(NonTargetCatch::getSpecies).map(s -> binder.toReference(referentialLocale, s)).collect(Collectors.toSet()));
+ }
+ dto.setNonTargetCatchSpecies(nonTargetSpecies.build());
}
}
=====================================
services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java
=====================================
--- a/services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java
+++ b/services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java
@@ -313,7 +313,7 @@ public class ValidateServiceLocalTest extends ServiceLocalTestSupport {
assertValidateResult(result, TripSeineDto.class, 4);
assertValidateResult(result, RouteDto.class, 38); // 55
- assertValidateResult(result, ActivitySeineDto.class, 68); // 1516
+ assertValidateResult(result, ActivitySeineDto.class, 69); // 1516
assertValidateResult(result, TransmittingBuoyDto.class, 1);
assertValidateResult(result, SetSeineDto.class, 3);
assertValidateResult(result, NonTargetCatchDto.class, 3);
=====================================
services/src/main/java/fr/ird/observe/services/validation/validators/ActivitySeineObservedSystemValidator.java
=====================================
--- /dev/null
+++ b/services/src/main/java/fr/ird/observe/services/validation/validators/ActivitySeineObservedSystemValidator.java
@@ -0,0 +1,102 @@
+package fr.ird.observe.services.validation.validators;
+
+/*-
+ * #%L
+ * ObServe :: Services API
+ * %%
+ * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.opensymphony.xwork2.validator.ValidationException;
+import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;
+import fr.ird.observe.dto.data.seine.ActivitySeineDto;
+import fr.ird.observe.dto.decoration.DecoratorService;
+import fr.ird.observe.dto.decoration.decorators.ReferentialReferenceDecorator;
+import fr.ird.observe.dto.referential.SpeciesReference;
+import fr.ird.observe.dto.referential.seine.ObservedSystemReference;
+import fr.ird.observe.services.validation.SeineBycatchObservedSystemConfig;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Created by tchemit on 15/06/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public class ActivitySeineObservedSystemValidator extends FieldValidatorSupport {
+
+ @Override
+ public void validate(Object object) throws ValidationException {
+
+ if (object == null) {
+ // pas d'objet, donc rien a faire
+ return;
+ }
+
+ ActivitySeineDto activitySeineDto = (ActivitySeineDto) object;
+ if (!activitySeineDto.getNonTargetCatchSpecies().isEmpty()) {
+ List<ObservedSystemReference> observedSystemReferences = (List<ObservedSystemReference>) getFieldValue("observedSystems", object);
+ ImmutableMap<String, ObservedSystemReference> map = Maps.uniqueIndex(observedSystemReferences, ObservedSystemReference::getId);
+ Collection<ObservedSystemReference> observedSystems = activitySeineDto.getObservedSystem();
+ SeineBycatchObservedSystemConfig seineBycatchObservedSystemConfig = (SeineBycatchObservedSystemConfig) getFieldValue("seineBycatchObservedSystemConfig", object);
+ DecoratorService decoratorService = (DecoratorService) stack.findValue("decoratorService");
+ ReferentialReferenceDecorator<ObservedSystemReference> decorator = decoratorService.getReferentialReferenceDecorator(ObservedSystemReference.class);
+ Set<String> labels = new LinkedHashSet<>();
+ for (SpeciesReference speciesReference : activitySeineDto.getNonTargetCatchSpecies()) {
+
+ Collection<String> requiredObservedSystemBySpeciesId = seineBycatchObservedSystemConfig.getRequiredObservedSystemBySpeciesId(speciesReference.getTopiaId());
+ if (!requiredObservedSystemBySpeciesId.isEmpty()) {
+
+ log.debug("Required observed system: " + requiredObservedSystemBySpeciesId);
+ // must check that at least one of those observed system are in
+ boolean found = false;
+ for (ObservedSystemReference observedSystemReference : activitySeineDto.getObservedSystem()) {
+ if (requiredObservedSystemBySpeciesId.contains(observedSystemReference.getTopiaId())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ log.debug("references: " + observedSystems);
+ for (String observedSystemId : requiredObservedSystemBySpeciesId) {
+ ObservedSystemReference ref = map.get(observedSystemId);
+ log.debug("Required observed system id: " + observedSystemId);
+ log.debug("Required observed system: " + ref);
+ labels.add(decorator.toString(ref));
+ }
+ }
+ }
+ }
+ if (!labels.isEmpty()) {
+ // there is some missing system observed
+ stack.set("observedSystemLabels", labels);
+ addFieldError(getFieldName(), object);
+ }
+ }
+ }
+
+ @Override
+ public String getValidatorType() {
+ return "activitySeine_observedSystem";
+ }
+}
=====================================
validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml
=====================================
--- a/validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml
+++ b/validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml
@@ -318,13 +318,17 @@
</field-validator>
<!-- systeme observe selectionnee desactive -->
- <field-validator type="collectionFieldExpression">
+ <field-validator type="collectionFieldExpression" short-circuit="true">
<param name="collectionFieldName">observedSystem</param>
<param name="mode">ALL</param>
<param name="useSensitiveContext">true</param>
<param name="expression"><![CDATA[ current.enabled ]]></param>
<message>observe.validation.activity.desactivated.observedSystem</message>
</field-validator>
+ <!--observed systems required by nonTargetCatches-->
+ <field-validator type="activitySeine_observedSystem" short-circuit="true">
+ <message>observe.validation.activity.required.observedSystem.for.nonTargetCatch##${observedSystemLabels}</message>
+ </field-validator>
</field>
=====================================
validation/src/main/resources/i18n/validation_en_GB.properties
=====================================
--- a/validation/src/main/resources/i18n/validation_en_GB.properties
+++ b/validation/src/main/resources/i18n/validation_en_GB.properties
@@ -354,6 +354,7 @@ observe.validation.activity.required.comment.for.vesselActivity=A comment is req
observe.validation.activity.required.date=Observation date must be filled.
observe.validation.activity.required.latitude=Latitude must be filled.
observe.validation.activity.required.longitude=Longitude must be filled.
+observe.validation.activity.required.observedSystem.for.nonTargetCatch=Some of the following observed systems are required for the non target catches \: %s
observe.validation.activity.required.quadrant=quadrant must be filled.
observe.validation.activity.required.time=Time must be filled.
observe.validation.activity.required.vesselActivity=must be filled.
=====================================
validation/src/main/resources/i18n/validation_es_ES.properties
=====================================
--- a/validation/src/main/resources/i18n/validation_es_ES.properties
+++ b/validation/src/main/resources/i18n/validation_es_ES.properties
@@ -356,6 +356,7 @@ observe.validation.activity.required.comment.for.vesselActivity=Se necesita un c
observe.validation.activity.required.date=La fecha de observación de la actividad es mandatoria.
observe.validation.activity.required.latitude=La latitud debe ser introducida
observe.validation.activity.required.longitude=La longitud debe ser introducida
+observe.validation.activity.required.observedSystem.for.nonTargetCatch=Some of the following observed systems are required for the non target catches \: %s \#TODO
observe.validation.activity.required.quadrant=Se debe seleccionar el cuadrante.
observe.validation.activity.required.time=La hora de observación para la actividad es mandatoria.
observe.validation.activity.required.vesselActivity=Se debe seleccionar la actividad del barco.
=====================================
validation/src/main/resources/i18n/validation_fr_FR.properties
=====================================
--- a/validation/src/main/resources/i18n/validation_fr_FR.properties
+++ b/validation/src/main/resources/i18n/validation_fr_FR.properties
@@ -354,6 +354,7 @@ observe.validation.activity.required.comment.for.vesselActivity=Un commentaire e
observe.validation.activity.required.date=La date d'observation de l'activité est obligatoire.
observe.validation.activity.required.latitude=La latitude doit être renseignée.
observe.validation.activity.required.longitude=La longitude doit être renseignée.
+observe.validation.activity.required.observedSystem.for.nonTargetCatch=Certains systèmes observés parmis les suivants sont obligatoires en regard des captures de faunes accessoires \: %s
observe.validation.activity.required.quadrant=Le quadrant doit être sélectionné.
observe.validation.activity.required.time=L'heure d'observation de l'activité est obligatoire.
observe.validation.activity.required.vesselActivity=L'activité du navire est obligatoire.
=====================================
validation/src/main/resources/validators.xml
=====================================
--- a/validation/src/main/resources/validators.xml
+++ b/validation/src/main/resources/validators.xml
@@ -67,5 +67,6 @@
<validator name="coordinateLongitudeDto" class="fr.ird.observe.services.validation.validators.CoordinateLongitudeDtoFieldValidator"/>
<validator name="referentialCode" class="fr.ird.observe.services.validation.validators.ReferentialCodeValidator"/>
<validator name="nonTargetCatchObservedSystem" class="fr.ird.observe.services.validation.validators.NonTargetCatchObservedSystemValidator"/>
+ <validator name="activitySeine_observedSystem" class="fr.ird.observe.services.validation.validators.ActivitySeineObservedSystemValidator"/>
</validators>
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/8c0a556ca195d9c0a3057bb9b65…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/8c0a556ca195d9c0a3057bb9b65…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] [REFERENTIEL] Une erreur s'est glissée dans le référentiel SizeMeasureType - Closes #966
by Tony CHEMIT 14 Jun '18
by Tony CHEMIT 14 Jun '18
14 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
8f5dbe06 by Tony CHEMIT at 2018-06-14T15:41:40Z
[REFERENTIEL] Une erreur s'est glissée dans le référentiel SizeMeasureType - Closes #966
- - - - -
7 changed files:
- + persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_3.java
- + persistence/src/main/resources/db/migration/7.3/01_remove_one_size_measure_type-common.sql
- pom.xml
- test/src/main/java/fr/ird/observe/test/ObserveFixtures.java
- + test/src/main/resources/db/7.3/dataForTestLongline.sql.gz
- + test/src/main/resources/db/7.3/dataForTestSeine.sql.gz
- + test/src/main/resources/db/7.3/empty_h2.sql.gz
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/8f5dbe061483caac05aca1f4165…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/8f5dbe061483caac05aca1f4165…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] [REFERENTIEL] Une erreur s'est glissée dans le référentiel SizeMeasureType - Closes #966
by Tony CHEMIT 14 Jun '18
by Tony CHEMIT 14 Jun '18
14 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
82f6635f by Tony CHEMIT at 2018-06-14T15:01:00Z
[REFERENTIEL] Une erreur s'est glissée dans le référentiel SizeMeasureType - Closes #966
- - - - -
6 changed files:
- + persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_3.java
- + persistence/src/main/resources/db/migration/7.3/01_remove_one_size_measure_type-common.sql
- pom.xml
- + test/src/main/resources/db/7.3/dataForTestLongline.sql.gz
- + test/src/main/resources/db/7.3/dataForTestSeine.sql.gz
- + test/src/main/resources/db/7.3/empty_h2.sql.gz
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/82f6635fcf27c80e41e62396ab9…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/82f6635fcf27c80e41e62396ab9…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] [GEAR] Page des caractéristiques d'équipements -> ordonancement des caractéristiques - Closes #956
by Tony CHEMIT 14 Jun '18
by Tony CHEMIT 14 Jun '18
14 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
815494d9 by Tony CHEMIT at 2018-06-14T14:46:38Z
[GEAR] Page des caractéristiques d'équipements -> ordonancement des caractéristiques - Closes #956
- - - - -
11 changed files:
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineTableModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesMeasurementLonglinesTableModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesMeasurementSeinesTableModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineTableModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineUIHandler.java
- dto/src/main/models/Observe.model
- persistence/src/main/java/fr/ird/observe/binder/data/longline/GearUseFeaturesLonglineEntityDtoBinder.java
- persistence/src/main/java/fr/ird/observe/binder/data/longline/TripLonglineGearUseEntityDtoBinder.java
- persistence/src/main/java/fr/ird/observe/binder/data/seine/GearUseFeaturesSeineEntityDtoBinder.java
- persistence/src/main/java/fr/ird/observe/binder/data/seine/TripSeineGearUseEntityDtoBinder.java
Changes:
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineTableModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineTableModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineTableModel.java
@@ -112,7 +112,7 @@ public class GearUseFeaturesLonglineTableModel extends ContentTableModel<TripLon
measurements = measurementsTableModel.getData();
}
- rowBean.setGearUseFeaturesMeasurement(Sets.newLinkedHashSet(measurements));
+ rowBean.setGearUseFeaturesMeasurement(measurements);
super.updateRowFromEditBean();
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineUIHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesLonglineUIHandler.java
@@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.longline;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -46,6 +46,7 @@ import fr.ird.observe.dto.referential.GearDto;
import fr.ird.observe.dto.referential.GearReference;
import fr.ird.observe.dto.result.SaveResultDto;
import fr.ird.observe.services.service.referential.ReferentialService;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.jaxx.runtime.spi.UIHandler;
@@ -62,6 +63,7 @@ import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.beans.PropertyChangeListener;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -80,10 +82,9 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
/** Logger */
private static final Log log = LogFactory.getLog(GearUseFeaturesLonglineUIHandler.class);
-
+ private final Comparator<GearUseFeaturesMeasurementLonglineDto> GEAR_USE_FEATURES_MEASUREMENT_LONGLINE_DTO_COMPARATOR;
// Compute valid state of tab from the error table
protected final TableModelListener computeTabValidStateListener;
-
private final PropertyChangeListener measurementsTableModelModified;
GearUseFeaturesLonglineUIHandler() {
@@ -95,6 +96,7 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
};
measurementsTableModelModified = evt -> onMeasurementsTableModelModified((Boolean) evt.getNewValue());
+ GEAR_USE_FEATURES_MEASUREMENT_LONGLINE_DTO_COMPARATOR = Comparator.comparing(m -> StringUtils.leftPad(m.getGearCaracteristic().getCode(), 6, "0"));
}
@Override
@@ -168,12 +170,12 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
ObserveMainUI mainUI = ObserveSwingApplicationContext.get().getMainUI();
int response = UIHelper.askUser(mainUI,
- t("observe.title.delete"),
- t("observe.common.GearUseFeatures.delete"),
- JOptionPane.WARNING_MESSAGE,
- new Object[]{t("observe.choice.confirm.delete"),
- t("observe.choice.cancel")},
- 1);
+ t("observe.title.delete"),
+ t("observe.common.GearUseFeatures.delete"),
+ JOptionPane.WARNING_MESSAGE,
+ new Object[]{t("observe.choice.confirm.delete"),
+ t("observe.choice.cancel")},
+ 1);
if (response != 0) {
@@ -205,6 +207,7 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
}
return measurementLonglineDto;
})
+ .sorted(GEAR_USE_FEATURES_MEASUREMENT_LONGLINE_DTO_COMPARATOR)
.collect(Collectors.toList());
}
@@ -296,14 +299,14 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
JTable table = getUi().getTable();
UIHelper.setI18nTableHeaderRenderer(table,
- n("observe.common.GearUseFeaturesLonglineDto.table.gear"),
- n("observe.common.GearUseFeaturesLonglineDto.table.gear.tip"),
- n("observe.common.GearUseFeaturesLonglineDto.table.number"),
- n("observe.common.GearUseFeaturesLonglineDto.table.number.tip"),
- n("observe.common.GearUseFeaturesLonglineDto.table.usedInTrip"),
- n("observe.common.GearUseFeaturesLonglineDto.table.usedInTrip.tip"),
- n("observe.common.GearUseFeaturesLonglineDto.table.comment"),
- n("observe.common.GearUseFeaturesLonglineDto.table.comment.tip"));
+ n("observe.common.GearUseFeaturesLonglineDto.table.gear"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.gear.tip"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.number"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.number.tip"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.usedInTrip"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.usedInTrip.tip"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.comment"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.comment.tip"));
UIHelper.setTableColumnRenderer(table, 0, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, GearReference.class));
UIHelper.setTableColumnRenderer(table, 1, UIHelper.newEmptyNumberTableCellRenderer(renderer));
@@ -316,10 +319,10 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
JTable table = getUi().getMeasurementsTable();
UIHelper.setI18nTableHeaderRenderer(table,
- n("observe.common.GearUseFeaturesLonglineDto.table.gearCaracteristic"),
- n("observe.common.GearUseFeaturesLonglineDto.table.gearCaracteristic.tip"),
- n("observe.common.GearUseFeaturesLonglineDto.table.value"),
- n("observe.common.GearUseFeaturesLonglineDto.table.value.tip"));
+ n("observe.common.GearUseFeaturesLonglineDto.table.gearCaracteristic"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.gearCaracteristic.tip"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.value"),
+ n("observe.common.GearUseFeaturesLonglineDto.table.value.tip"));
UIHelper.setTableColumnRenderer(table, 0, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, GearCaracteristicReference.class));
UIHelper.setTableColumnRenderer(table, 1, new GearUseFeatureMeasurementCellRenderer(0, renderer));
@@ -334,12 +337,12 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
UIHelper.setTableColumnEditor(table, 1, new GearUseFeatureMeasurementCellEditor(0));
initInlineTable(getUi().getMeasurementsScrollPane(),
- table,
- getModel().getMeasurementsTableModel(),
- measurementsTableModelModified,
- getUi().getMeasurementsTablePopup(),
- getUi().getAddMeasurement(),
- getUi().getDeleteSelectedMeasurement());
+ table,
+ getModel().getMeasurementsTableModel(),
+ measurementsTableModelModified,
+ getUi().getMeasurementsTablePopup(),
+ getUi().getAddMeasurement(),
+ getUi().getDeleteSelectedMeasurement());
}
@@ -406,9 +409,9 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
// mode lecture : la marée n'est pas ouverte
addMessage(getUi(),
- NuitonValidatorScope.INFO,
- getTypeI18nKey(TripLonglineDto.class),
- t("observe.common.TripLonglineDto.message.not.open"));
+ NuitonValidatorScope.INFO,
+ getTypeI18nKey(TripLonglineDto.class),
+ t("observe.common.TripLonglineDto.message.not.open"));
return ContentMode.READ;
}
@@ -475,6 +478,9 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip
protected void loadEditBean(String beanId) {
Form<TripLonglineGearUseDto> form = getTripLonglineGearUseService().loadForm(beanId);
loadReferentialReferenceSetsInModel(form);
+ for (GearUseFeaturesLonglineDto gearUseFeaturesLonglineDto : form.getObject().getGearUseFeaturesLongline()) {
+ gearUseFeaturesLonglineDto.getGearUseFeaturesMeasurement().sort(GEAR_USE_FEATURES_MEASUREMENT_LONGLINE_DTO_COMPARATOR);
+ }
getModel().setForm(form);
TripLonglineGearUseHelper.copyTripLonglineGearUseDto(form.getObject(), getBean());
}
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesMeasurementLonglinesTableModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesMeasurementLonglinesTableModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/longline/GearUseFeaturesMeasurementLonglinesTableModel.java
@@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.longline;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -101,10 +101,12 @@ public class GearUseFeaturesMeasurementLonglinesTableModel extends EditableTable
switch (columnIndex) {
case 0:
measure.setGearCaracteristic((GearCaracteristicReference) aValue);
- String gearCaracteristicTypeId = measure.getGearCaracteristic().getGearCaracteristicTypeId();
- if (GearCaracteristicTypeHelper.isBoolean(gearCaracteristicTypeId)) {
- // on force à avoir false par défaut
- measure.setMeasurementValue("false");
+ if (aValue != null) {
+ String gearCaracteristicTypeId = measure.getGearCaracteristic().getGearCaracteristicTypeId();
+ if (GearCaracteristicTypeHelper.isBoolean(gearCaracteristicTypeId)) {
+ // on force à avoir false par défaut
+ measure.setMeasurementValue("false");
+ }
}
break;
case 1:
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesMeasurementSeinesTableModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesMeasurementSeinesTableModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesMeasurementSeinesTableModel.java
@@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.seine;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -101,10 +101,12 @@ public class GearUseFeaturesMeasurementSeinesTableModel extends EditableTableWit
switch (columnIndex) {
case 0:
measure.setGearCaracteristic((GearCaracteristicReference) aValue);
- String gearCaracteristicTypeId = measure.getGearCaracteristic().getGearCaracteristicTypeId();
- if (GearCaracteristicTypeHelper.isBoolean(gearCaracteristicTypeId)) {
- // on force à avoir false par défaut
- measure.setMeasurementValue("false");
+ if (aValue != null) {
+ String gearCaracteristicTypeId = measure.getGearCaracteristic().getGearCaracteristicTypeId();
+ if (GearCaracteristicTypeHelper.isBoolean(gearCaracteristicTypeId)) {
+ // on force à avoir false par défaut
+ measure.setMeasurementValue("false");
+ }
}
break;
case 1:
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineTableModel.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineTableModel.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineTableModel.java
@@ -10,19 +10,18 @@ package fr.ird.observe.client.ui.content.data.seine;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
-import com.google.common.collect.Sets;
import fr.ird.observe.client.ui.content.table.ContentTableMeta;
import fr.ird.observe.client.ui.content.table.ContentTableModel;
import fr.ird.observe.client.ui.content.table.ObserveContentTableUI;
@@ -113,11 +112,8 @@ public class GearUseFeaturesSeineTableModel extends ContentTableModel<TripSeineG
measurements = measurementsTableModel.getData();
}
- rowBean.setGearUseFeaturesMeasurement(Sets.newLinkedHashSet(measurements));
-
+ rowBean.setGearUseFeaturesMeasurement(measurements);
super.updateRowFromEditBean();
-
-
}
@Override
=====================================
client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineUIHandler.java
=====================================
--- a/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineUIHandler.java
+++ b/client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineUIHandler.java
@@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.content.data.seine;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -46,6 +46,7 @@ import fr.ird.observe.dto.referential.GearDto;
import fr.ird.observe.dto.referential.GearReference;
import fr.ird.observe.dto.result.SaveResultDto;
import fr.ird.observe.services.service.referential.ReferentialService;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.jaxx.runtime.spi.UIHandler;
@@ -62,6 +63,7 @@ import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.beans.PropertyChangeListener;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -81,6 +83,8 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
/** Logger */
private static final Log log = LogFactory.getLog(GearUseFeaturesSeineUIHandler.class);
+ private final Comparator<GearUseFeaturesMeasurementSeineDto> GEAR_USE_FEATURES_MEASUREMENT_SEINE_DTO_COMPARATOR;
+
// Compute valid state of tab from the error table
protected final TableModelListener computeTabValidStateListener;
@@ -95,6 +99,7 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
};
measurementsTableModelModified = evt -> onMeasurementsTableModelModified((Boolean) evt.getNewValue());
+ GEAR_USE_FEATURES_MEASUREMENT_SEINE_DTO_COMPARATOR = Comparator.comparing(m -> StringUtils.leftPad(m.getGearCaracteristic().getCode(), 6, "0"));
}
@Override
@@ -169,11 +174,11 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
ObserveMainUI mainUI = ObserveSwingApplicationContext.get().getMainUI();
int response = UIHelper.askUser(mainUI,
- t("observe.title.delete"),
- t("observe.common.GearUseFeatures.delete"),
- JOptionPane.WARNING_MESSAGE,
- new Object[]{t("observe.choice.confirm.delete"), t("observe.choice.cancel")},
- 1);
+ t("observe.title.delete"),
+ t("observe.common.GearUseFeatures.delete"),
+ JOptionPane.WARNING_MESSAGE,
+ new Object[]{t("observe.choice.confirm.delete"), t("observe.choice.cancel")},
+ 1);
if (response != 0) {
@@ -205,6 +210,7 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
measurementSeineDto.setGearCaracteristic(input);
return measurementSeineDto;
})
+ .sorted(GEAR_USE_FEATURES_MEASUREMENT_SEINE_DTO_COMPARATOR)
.collect(Collectors.toList());
}
@@ -295,14 +301,14 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
JTable table = getUi().getTable();
UIHelper.setI18nTableHeaderRenderer(table,
- n("observe.common.GearUseFeaturesSeineDto.table.gear"),
- n("observe.common.GearUseFeaturesSeineDto.table.gear.tip"),
- n("observe.common.GearUseFeaturesSeineDto.table.number"),
- n("observe.common.GearUseFeaturesSeineDto.table.number.tip"),
- n("observe.common.GearUseFeaturesSeineDto.table.usedInTrip"),
- n("observe.common.GearUseFeaturesSeineDto.table.usedInTrip.tip"),
- n("observe.common.GearUseFeaturesSeineDto.table.comment"),
- n("observe.common.GearUseFeaturesSeineDto.table.comment.tip"));
+ n("observe.common.GearUseFeaturesSeineDto.table.gear"),
+ n("observe.common.GearUseFeaturesSeineDto.table.gear.tip"),
+ n("observe.common.GearUseFeaturesSeineDto.table.number"),
+ n("observe.common.GearUseFeaturesSeineDto.table.number.tip"),
+ n("observe.common.GearUseFeaturesSeineDto.table.usedInTrip"),
+ n("observe.common.GearUseFeaturesSeineDto.table.usedInTrip.tip"),
+ n("observe.common.GearUseFeaturesSeineDto.table.comment"),
+ n("observe.common.GearUseFeaturesSeineDto.table.comment.tip"));
UIHelper.setTableColumnRenderer(table, 0, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, GearReference.class));
UIHelper.setTableColumnRenderer(table, 1, UIHelper.newEmptyNumberTableCellRenderer(renderer));
@@ -315,10 +321,10 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
JTable table = getUi().getMeasurementsTable();
UIHelper.setI18nTableHeaderRenderer(table,
- n("observe.common.GearUseFeaturesSeineDto.table.gearCaracteristic"),
- n("observe.common.GearUseFeaturesSeineDto.table.gearCaracteristic.tip"),
- n("observe.common.GearUseFeaturesSeineDto.table.value"),
- n("observe.common.GearUseFeaturesSeineDto.table.value.tip"));
+ n("observe.common.GearUseFeaturesSeineDto.table.gearCaracteristic"),
+ n("observe.common.GearUseFeaturesSeineDto.table.gearCaracteristic.tip"),
+ n("observe.common.GearUseFeaturesSeineDto.table.value"),
+ n("observe.common.GearUseFeaturesSeineDto.table.value.tip"));
UIHelper.setTableColumnRenderer(table, 0, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, GearCaracteristicReference.class));
UIHelper.setTableColumnRenderer(table, 1, new GearUseFeatureMeasurementCellRenderer(0, renderer));
@@ -333,12 +339,12 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
UIHelper.setTableColumnEditor(table, 1, new GearUseFeatureMeasurementCellEditor(0));
initInlineTable(getUi().getMeasurementsScrollPane(),
- table,
- getModel().getMeasurementsTableModel(),
- measurementsTableModelModified,
- getUi().getMeasurementsTablePopup(),
- getUi().getAddMeasurement(),
- getUi().getDeleteSelectedMeasurement());
+ table,
+ getModel().getMeasurementsTableModel(),
+ measurementsTableModelModified,
+ getUi().getMeasurementsTablePopup(),
+ getUi().getAddMeasurement(),
+ getUi().getDeleteSelectedMeasurement());
}
@@ -405,9 +411,9 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
// mode lecture
addMessage(getUi(),
- NuitonValidatorScope.INFO,
- getTypeI18nKey(TripSeineDto.class),
- t("observe.common.TripSeineDto.message.not.open"));
+ NuitonValidatorScope.INFO,
+ getTypeI18nKey(TripSeineDto.class),
+ t("observe.common.TripSeineDto.message.not.open"));
return ContentMode.READ;
}
@@ -475,6 +481,9 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei
protected void loadEditBean(String beanId) {
Form<TripSeineGearUseDto> form = getTripSeineGearUseService().loadForm(beanId);
loadReferentialReferenceSetsInModel(form);
+ for (GearUseFeaturesSeineDto gearUseFeaturesSeineDto : form.getObject().getGearUseFeaturesSeine()) {
+ gearUseFeaturesSeineDto.getGearUseFeaturesMeasurement().sort(GEAR_USE_FEATURES_MEASUREMENT_SEINE_DTO_COMPARATOR);
+ }
getModel().setForm(form);
TripSeineGearUseHelper.copyTripSeineGearUseDto(form.getObject(), getBean());
}
=====================================
dto/src/main/models/Observe.model
=====================================
--- a/dto/src/main/models/Observe.model
+++ b/dto/src/main/models/Observe.model
@@ -190,7 +190,7 @@ lineType {*:1} fr.ird.observe.dto.referential.longline.LineTypeReference
data.longline.GearUseFeaturesLongline > data.Commentable | references=number,usedInTrip
number + {*:1} Integer
usedInTrip + {*:1} Boolean
-gearUseFeaturesMeasurement + {*} data.longline.GearUseFeaturesMeasurementLongline | ordered unique
+gearUseFeaturesMeasurement + {*} data.longline.GearUseFeaturesMeasurementLongline | ordered
gear {*:1} fr.ird.observe.dto.referential.GearReference
data.longline.GearUseFeaturesMeasurementLongline > data.Data
@@ -349,7 +349,7 @@ data.longline.TripLonglineActivity > data.Data
timeStamp + {*:1} Date
data.longline.TripLonglineGearUse > data.Data | form=data.longline.GearUseFeaturesLongline
-gearUseFeaturesLongline + {*} data.longline.GearUseFeaturesLongline | ordered unique
+gearUseFeaturesLongline + {*} data.longline.GearUseFeaturesLongline | ordered
data.longline.WeightMeasure > data.Data | references=weightMeasureTypeLabel,weight
weight + {*:1} Float
@@ -671,7 +671,7 @@ gearCaracteristic {*:1} fr.ird.observe.dto.referential.GearCaracteristicReferenc
data.seine.GearUseFeaturesSeine > data.Commentable | references=number,usedInTrip
number + {*:1} Integer
usedInTrip + {*:1} Boolean
-gearUseFeaturesMeasurement + {*} data.seine.GearUseFeaturesMeasurementSeine | unique
+gearUseFeaturesMeasurement + {*} data.seine.GearUseFeaturesMeasurementSeine | ordered
gear {*:1} fr.ird.observe.dto.referential.GearReference
data.seine.NonTargetCatch > data.Commentable | references=speciesLabel,speciesFateLabel
@@ -838,4 +838,4 @@ route {*} data.seine.RouteStub | ordered unique
program {*:1} fr.ird.observe.dto.referential.ProgramReference
data.seine.TripSeineGearUse > data.Data | form=data.seine.GearUseFeaturesSeine
-gearUseFeaturesSeine + {*} data.seine.GearUseFeaturesSeine | ordered unique
+gearUseFeaturesSeine + {*} data.seine.GearUseFeaturesSeine | ordered
=====================================
persistence/src/main/java/fr/ird/observe/binder/data/longline/GearUseFeaturesLonglineEntityDtoBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/data/longline/GearUseFeaturesLonglineEntityDtoBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/data/longline/GearUseFeaturesLonglineEntityDtoBinder.java
@@ -58,7 +58,7 @@ public class GearUseFeaturesLonglineEntityDtoBinder extends DataEntityDtoBinderS
dto.setNumber(entity.getNumber());
dto.setUsedInTrip(entity.getUsedInTrip());
dto.setGear(toReferentialReference(referentialLocale, entity.getGear()));
- dto.setGearUseFeaturesMeasurement(toLinkedHashSetData(referentialLocale, entity.getGearUseFeaturesMeasurement()));
+ dto.setGearUseFeaturesMeasurement(toListData(referentialLocale, entity.getGearUseFeaturesMeasurement()));
}
}
=====================================
persistence/src/main/java/fr/ird/observe/binder/data/longline/TripLonglineGearUseEntityDtoBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/data/longline/TripLonglineGearUseEntityDtoBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/data/longline/TripLonglineGearUseEntityDtoBinder.java
@@ -40,19 +40,13 @@ public class TripLonglineGearUseEntityDtoBinder extends DataEntityDtoBinderSuppo
@Override
public void copyToEntity(ReferentialLocale referentialLocale, TripLonglineGearUseDto dto, TripLongline entity) {
-
copyDtoDataFieldsToEntity(dto, entity);
-
entity.setGearUseFeaturesLongline(toEntitySet(referentialLocale, dto.getGearUseFeaturesLongline(), entity.getGearUseFeaturesLongline()));
-
}
@Override
public void copyToDto(ReferentialLocale referentialLocale, TripLongline entity, TripLonglineGearUseDto dto) {
-
copyEntityDataFieldsToDto(entity, dto);
-
- dto.setGearUseFeaturesLongline(toLinkedHashSetData(referentialLocale, entity.getGearUseFeaturesLongline()));
-
+ dto.setGearUseFeaturesLongline(toListData(referentialLocale, entity.getGearUseFeaturesLongline()));
}
}
=====================================
persistence/src/main/java/fr/ird/observe/binder/data/seine/GearUseFeaturesSeineEntityDtoBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/data/seine/GearUseFeaturesSeineEntityDtoBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/data/seine/GearUseFeaturesSeineEntityDtoBinder.java
@@ -40,26 +40,20 @@ public class GearUseFeaturesSeineEntityDtoBinder extends DataEntityDtoBinderSupp
@Override
public void copyToEntity(ReferentialLocale referentialLocale, GearUseFeaturesSeineDto dto, GearUseFeaturesSeine entity) {
-
copyDtoDataFieldsToEntity(dto, entity);
-
entity.setNumber(dto.getNumber());
entity.setUsedInTrip(dto.getUsedInTrip());
entity.setGear(toEntity(dto.getGear()));
entity.setGearUseFeaturesMeasurement(toEntityCollection(referentialLocale, dto.getGearUseFeaturesMeasurement(), entity.getGearUseFeaturesMeasurement()));
-
}
@Override
public void copyToDto(ReferentialLocale referentialLocale, GearUseFeaturesSeine entity, GearUseFeaturesSeineDto dto) {
-
copyEntityDataFieldsToDto(entity, dto);
-
dto.setNumber(entity.getNumber());
dto.setUsedInTrip(entity.getUsedInTrip());
dto.setGear(toReferentialReference(referentialLocale, entity.getGear()));
- dto.setGearUseFeaturesMeasurement(toLinkedHashSetData(referentialLocale, entity.getGearUseFeaturesMeasurement()));
-
+ dto.setGearUseFeaturesMeasurement(toListData(referentialLocale, entity.getGearUseFeaturesMeasurement()));
}
}
=====================================
persistence/src/main/java/fr/ird/observe/binder/data/seine/TripSeineGearUseEntityDtoBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/data/seine/TripSeineGearUseEntityDtoBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/data/seine/TripSeineGearUseEntityDtoBinder.java
@@ -40,20 +40,14 @@ public class TripSeineGearUseEntityDtoBinder extends DataEntityDtoBinderSupport<
@Override
public void copyToEntity(ReferentialLocale referentialLocale, TripSeineGearUseDto dto, TripSeine entity) {
-
copyDtoDataFieldsToEntity(dto, entity);
-
entity.setGearUseFeaturesSeine(toEntityCollection(referentialLocale, dto.getGearUseFeaturesSeine(), entity.getGearUseFeaturesSeine()));
-
}
@Override
public void copyToDto(ReferentialLocale referentialLocale, TripSeine entity, TripSeineGearUseDto dto) {
-
copyEntityDataFieldsToDto(entity, dto);
-
- dto.setGearUseFeaturesSeine(toLinkedHashSetData(referentialLocale, entity.getGearUseFeaturesSeine()));
-
+ dto.setGearUseFeaturesSeine(toListData(referentialLocale, entity.getGearUseFeaturesSeine()));
}
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/815494d9a365c1f027b118b473c…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/815494d9a365c1f027b118b473c…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop-7.x] [GEAR] Page des caractéristiques d'équipements -> afficher l'unité attendue - Closes #955
by Tony CHEMIT 13 Jun '18
by Tony CHEMIT 13 Jun '18
13 Jun '18
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
74f5c64d by Tony CHEMIT at 2018-06-13T12:54:08Z
[GEAR] Page des caractéristiques d'équipements -> afficher l'unité attendue - Closes #955
- - - - -
9 changed files:
- dto/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicDtoReferenceBinder.java
- dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java
- + dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GearCaracteristicDtoDecorator.java
- + dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GeatCaracteristicReferenceDecorator.java
- dto/src/main/models/Observe.model
- dto/src/main/resources/i18n/dto_en_GB.properties
- dto/src/main/resources/i18n/dto_es_ES.properties
- dto/src/main/resources/i18n/dto_fr_FR.properties
- persistence/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicEntityReferenceBinder.java
Changes:
=====================================
dto/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicDtoReferenceBinder.java
=====================================
--- a/dto/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicDtoReferenceBinder.java
+++ b/dto/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicDtoReferenceBinder.java
@@ -10,12 +10,12 @@ package fr.ird.observe.binder.referential.common;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -43,7 +43,8 @@ public class GearCaracteristicDtoReferenceBinder extends ReferentialDtoReference
return new GearCaracteristicReference(dto, dto.getCode(),
dto.getLabel(referentialLocale),
- dto.getGearCaracteristicType().getId());
+ dto.getGearCaracteristicType().getId(),
+ dto.getUnit());
}
}
=====================================
dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java
=====================================
--- a/dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java
+++ b/dto/src/main/java/fr/ird/observe/dto/decoration/DecoratorService.java
@@ -89,6 +89,8 @@ import fr.ird.observe.dto.data.seine.TransmittingBuoyDto;
import fr.ird.observe.dto.data.seine.TransmittingBuoyReference;
import fr.ird.observe.dto.data.seine.TripSeineReference;
import fr.ird.observe.dto.decoration.decorators.DataReferenceDecorator;
+import fr.ird.observe.dto.decoration.decorators.GearCaracteristicDtoDecorator;
+import fr.ird.observe.dto.decoration.decorators.GeatCaracteristicReferenceDecorator;
import fr.ird.observe.dto.decoration.decorators.LengthLengthParameterDecorator;
import fr.ird.observe.dto.decoration.decorators.LengthWeightParameterDecorator;
import fr.ird.observe.dto.decoration.decorators.NonTargetCatchDecorator;
@@ -541,7 +543,8 @@ public class DecoratorService extends DecoratorProvider {
@Override
public void initGearCaracteristicDto() {
- registerDefaultReferentialAndReferentialReferenceDecorator(GearCaracteristicDto.class, GearCaracteristicReference.class, libelle);
+ registerDecorator(new GearCaracteristicDtoDecorator(libelle));
+ registerDecorator(null, new GeatCaracteristicReferenceDecorator());
}
@Override
=====================================
dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GearCaracteristicDtoDecorator.java
=====================================
--- /dev/null
+++ b/dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GearCaracteristicDtoDecorator.java
@@ -0,0 +1,26 @@
+package fr.ird.observe.dto.decoration.decorators;
+
+import fr.ird.observe.dto.referential.GearCaracteristicDto;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * Created by tchemit on 13/06/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public class GearCaracteristicDtoDecorator extends ObserveDecorator<GearCaracteristicDto> {
+
+ public GearCaracteristicDtoDecorator(String libelle) {
+ super(GearCaracteristicDto.class, "${code}$s##${" + libelle + "}$s##${unit}$s", " ");
+ }
+
+ @Override
+ protected Comparable<?> getDefaultNullValue(String token) {
+ Comparable<?> defaultNullValue = super.getDefaultNullValue(token);
+ if (defaultNullValue == null && token.equals(GearCaracteristicDto.PROPERTY_UNIT)) {
+ return t("observe.common.no.unit");
+ }
+ return defaultNullValue;
+ }
+}
=====================================
dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GeatCaracteristicReferenceDecorator.java
=====================================
--- /dev/null
+++ b/dto/src/main/java/fr/ird/observe/dto/decoration/decorators/GeatCaracteristicReferenceDecorator.java
@@ -0,0 +1,26 @@
+package fr.ird.observe.dto.decoration.decorators;
+
+import fr.ird.observe.dto.referential.GearCaracteristicDto;
+import fr.ird.observe.dto.referential.GearCaracteristicReference;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * Created by tchemit on 13/06/2018.
+ *
+ * @author Tony Chemit - dev(a)tchemit.fr
+ */
+public class GeatCaracteristicReferenceDecorator extends ReferentialReferenceDecorator<GearCaracteristicReference> {
+ public GeatCaracteristicReferenceDecorator( ) {
+ super(GearCaracteristicReference.class, "${code}$s##${label}$s##${unit}$s");
+ }
+
+ @Override
+ protected Comparable<?> getDefaultNullValue(String token) {
+ Comparable<?> defaultNullValue = super.getDefaultNullValue(token);
+ if (defaultNullValue == null && token.equals(GearCaracteristicDto.PROPERTY_UNIT)) {
+ return t("observe.common.no.unit");
+ }
+ return defaultNullValue;
+ }
+}
=====================================
dto/src/main/models/Observe.model
=====================================
--- a/dto/src/main/models/Observe.model
+++ b/dto/src/main/models/Observe.model
@@ -368,7 +368,7 @@ endDate + {*:1} Date
referential.Gear > referential.I18nReferential
gearCaracteristic {*:*} fr.ird.observe.dto.referential.GearCaracteristicReference | ordered
-referential.GearCaracteristic > referential.I18nReferential | references=code,label,gearCaracteristicTypeId
+referential.GearCaracteristic > referential.I18nReferential | references=code,label,gearCaracteristicTypeId,unit
unit + {*:1} String
gearCaracteristicType {*:1} fr.ird.observe.dto.referential.GearCaracteristicTypeReference
=====================================
dto/src/main/resources/i18n/dto_en_GB.properties
=====================================
--- a/dto/src/main/resources/i18n/dto_en_GB.properties
+++ b/dto/src/main/resources/i18n/dto_en_GB.properties
@@ -243,6 +243,7 @@ observe.common.haulingIdentifier=Hauling identifier
observe.common.homeId=Home id
observe.common.inconnu=Unknown
observe.common.lengthWeightFormula=Length weight formula
+observe.common.no.unit=No unit
observe.common.nocode=Nocode
observe.common.none=None
observe.common.program=Program
=====================================
dto/src/main/resources/i18n/dto_es_ES.properties
=====================================
--- a/dto/src/main/resources/i18n/dto_es_ES.properties
+++ b/dto/src/main/resources/i18n/dto_es_ES.properties
@@ -241,6 +241,7 @@ observe.common.haulingIdentifier=Arrastre
observe.common.homeId=Identificador
observe.common.inconnu=desconocido
observe.common.lengthWeightFormula=Relación de peso
+observe.common.no.unit=No unit \#TODO
observe.common.nocode=codigo ausente
observe.common.none=Ninguno
observe.common.program=Programa
=====================================
dto/src/main/resources/i18n/dto_fr_FR.properties
=====================================
--- a/dto/src/main/resources/i18n/dto_fr_FR.properties
+++ b/dto/src/main/resources/i18n/dto_fr_FR.properties
@@ -243,6 +243,7 @@ observe.common.haulingIdentifier=Virage
observe.common.homeId=Identifiant
observe.common.inconnu=inconnu
observe.common.lengthWeightFormula=Relation Poids
+observe.common.no.unit=Pas d'unité
observe.common.nocode=code absent
observe.common.none=Aucun
observe.common.program=Programme
=====================================
persistence/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicEntityReferenceBinder.java
=====================================
--- a/persistence/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicEntityReferenceBinder.java
+++ b/persistence/src/main/java/fr/ird/observe/binder/referential/common/GearCaracteristicEntityReferenceBinder.java
@@ -10,12 +10,12 @@ package fr.ird.observe.binder.referential.common;
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -44,7 +44,8 @@ public class GearCaracteristicEntityReferenceBinder extends ReferentialEntityRef
return new GearCaracteristicReference(dto, dto.getCode(),
dto.getLabel(referentialLocale),
- dto.getGearCaracteristicType().getTopiaId());
+ dto.getGearCaracteristicType().getTopiaId(),
+ dto.getUnit());
}
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/74f5c64dd7579f56e4d19a645bc…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/74f5c64dd7579f56e4d19a645bc…
You're receiving this email because of your account on gitlab.com.
1
0