Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
b30b6807
by Tony CHEMIT at 2018-10-01T13:23:36Z
-
2be32d42
by Tony CHEMIT at 2018-10-01T13:24:53Z
-
d097f87a
by Tony CHEMIT at 2018-10-01T13:28:26Z
-
d09a03ea
by Tony CHEMIT at 2018-10-01T13:31:29Z
-
6490f483
by Tony CHEMIT at 2018-10-01T13:37:43Z
-
3ef955bb
by Tony CHEMIT at 2018-10-01T14:13:46Z
26 changed files:
- client-configuration/pom.xml
- client/pom.xml
- client/src/main/java/fr/ird/observe/client/ui/admin/validate/ValidateModel.java
- client/src/main/java/fr/ird/observe/client/ui/content/ContentUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/CatchLonglineUIHandler.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/SetLonglineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TdrUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/content/data/seine/GearUseFeaturesSeineUIHandler.java
- client/src/main/java/fr/ird/observe/client/ui/tree/navigation/NavigationTree.java
- client/src/main/resources/i18n/client_en_GB.properties
- client/src/main/resources/i18n/client_es_ES.properties
- client/src/main/resources/i18n/client_fr_FR.properties
- dto/pom.xml
- observe/pom.xml
- persistence/pom.xml
- pom.xml
- server-configuration/pom.xml
- server/pom.xml
- services-client/pom.xml
- services-local/pom.xml
- services/pom.xml
- services/src/main/java/fr/ird/observe/services/validation/validators/ActivitySimpleSpeedDtoValidator.java
- test/pom.xml
- validation/pom.xml
- validation/src/main/resources/fr/ird/observe/dto/data/seine/RouteDto-update-error-validation.xml
Changes:
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>fr.ird.observe</groupId>
|
| 28 | 28 |
<artifactId>ird-observe</artifactId>
|
| 29 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 29 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<artifactId>client-configuration</artifactId>
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>fr.ird.observe</groupId>
|
| 28 | 28 |
<artifactId>ird-observe</artifactId>
|
| 29 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 29 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<artifactId>client</artifactId>
|
| ... | ... | @@ -41,8 +41,8 @@ import fr.ird.observe.services.service.actions.validate.ValidationResultDto; |
| 41 | 41 |
import fr.ird.observe.services.service.actions.validate.ValidationResultDtoMessage;
|
| 42 | 42 |
import fr.ird.observe.services.validation.ValidatorDto;
|
| 43 | 43 |
import org.apache.commons.lang3.mutable.MutableInt;
|
| 44 |
-import org.apache.logging.log4j.Logger;
|
|
| 45 | 44 |
import org.apache.logging.log4j.LogManager;
|
| 45 |
+import org.apache.logging.log4j.Logger;
|
|
| 46 | 46 |
import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
|
| 47 | 47 |
import org.nuiton.validator.NuitonValidatorScope;
|
| 48 | 48 |
|
| ... | ... | @@ -75,7 +75,7 @@ public class ValidateModel extends AdminActionModel { |
| 75 | 75 |
static final String PROPERTY_VALIDATION_RESULT = "validationResult";
|
| 76 | 76 |
|
| 77 | 77 |
/** le pattern du fichier de rapport après validation */
|
| 78 |
- private static final String REPORT_PATTERN = "report-%1$tF--%1$tk-%1$tM-%1$tS.txt";
|
|
| 78 |
+ private static final String REPORT_PATTERN = "report-%1$tF--%1$tk-%1$tM-%1$tS.html";
|
|
| 79 | 79 |
|
| 80 | 80 |
/** Logger */
|
| 81 | 81 |
private static final Logger log = LogManager.getLogger(ValidateModel.class);
|
| ... | ... | @@ -791,11 +791,11 @@ public abstract class ContentUIHandler<E extends IdDto, U extends ContentUI<E, U |
| 791 | 791 |
SwingValidatorUtil.setValidatorChanged(ui, false);
|
| 792 | 792 |
}
|
| 793 | 793 |
|
| 794 |
- protected void closeSafeUI() {
|
|
| 794 |
+ public void closeSafeUI() {
|
|
| 795 | 795 |
|
| 796 | 796 |
removeAllMessages(ui);
|
| 797 | 797 |
ContentUIModel<E> model = getModel();
|
| 798 |
- |
|
| 798 |
+ getUi().getErrorTableModel().clearValidators();
|
|
| 799 | 799 |
boolean create = model.isCreatingMode();
|
| 800 | 800 |
if (create && model.isEditable()) {
|
| 801 | 801 |
// remove node
|
| ... | ... | @@ -62,8 +62,8 @@ import fr.ird.observe.dto.referential.longline.HealthnessReference; |
| 62 | 62 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 63 | 63 |
import fr.ird.observe.spi.DtoModelHelper;
|
| 64 | 64 |
import org.apache.commons.lang3.BooleanUtils;
|
| 65 |
-import org.apache.logging.log4j.Logger;
|
|
| 66 | 65 |
import org.apache.logging.log4j.LogManager;
|
| 66 |
+import org.apache.logging.log4j.Logger;
|
|
| 67 | 67 |
import org.nuiton.jaxx.runtime.context.JAXXContextEntryDef;
|
| 68 | 68 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 69 | 69 |
import org.nuiton.jaxx.validator.swing.SwingValidator;
|
| ... | ... | @@ -72,7 +72,10 @@ import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel; |
| 72 | 72 |
import org.nuiton.util.DateUtil;
|
| 73 | 73 |
import org.nuiton.validator.NuitonValidatorScope;
|
| 74 | 74 |
|
| 75 |
-import javax.swing.*;
|
|
| 75 |
+import javax.swing.JComponent;
|
|
| 76 |
+import javax.swing.JOptionPane;
|
|
| 77 |
+import javax.swing.JTable;
|
|
| 78 |
+import javax.swing.SwingUtilities;
|
|
| 76 | 79 |
import javax.swing.event.TableModelListener;
|
| 77 | 80 |
import javax.swing.table.DefaultTableCellRenderer;
|
| 78 | 81 |
import java.awt.Component;
|
| ... | ... | @@ -709,7 +712,7 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat |
| 709 | 712 |
}
|
| 710 | 713 |
|
| 711 | 714 |
@Override
|
| 712 |
- protected void closeSafeUI() {
|
|
| 715 |
+ public void closeSafeUI() {
|
|
| 713 | 716 |
|
| 714 | 717 |
if (log.isInfoEnabled()) {
|
| 715 | 718 |
log.info("CloseUI: " + getModel());
|
| ... | ... | @@ -49,8 +49,8 @@ import fr.ird.observe.dto.referential.GearReference; |
| 49 | 49 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 50 | 50 |
import fr.ird.observe.services.service.referential.ReferentialService;
|
| 51 | 51 |
import org.apache.commons.lang3.StringUtils;
|
| 52 |
-import org.apache.logging.log4j.Logger;
|
|
| 53 | 52 |
import org.apache.logging.log4j.LogManager;
|
| 53 |
+import org.apache.logging.log4j.Logger;
|
|
| 54 | 54 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 55 | 55 |
import org.nuiton.jaxx.runtime.swing.JTables;
|
| 56 | 56 |
import org.nuiton.jaxx.validator.swing.SwingValidatorMessage;
|
| ... | ... | @@ -417,7 +417,7 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip |
| 417 | 417 |
}
|
| 418 | 418 |
|
| 419 | 419 |
@Override
|
| 420 |
- protected void closeSafeUI() {
|
|
| 420 |
+ public void closeSafeUI() {
|
|
| 421 | 421 |
|
| 422 | 422 |
if (log.isInfoEnabled()) {
|
| 423 | 423 |
log.info("CloseUI: " + getModel());
|
| ... | ... | @@ -258,7 +258,7 @@ public class SetLonglineUIHandler extends ContentUIHandler<SetLonglineDto, SetLo |
| 258 | 258 |
}
|
| 259 | 259 |
|
| 260 | 260 |
@Override
|
| 261 |
- protected void closeSafeUI() {
|
|
| 261 |
+ public void closeSafeUI() {
|
|
| 262 | 262 |
|
| 263 | 263 |
if (log.isInfoEnabled()) {
|
| 264 | 264 |
log.info("CloseUI: " + getModel());
|
| ... | ... | @@ -41,8 +41,8 @@ import fr.ird.observe.dto.referential.SpeciesDto; |
| 41 | 41 |
import fr.ird.observe.dto.referential.SpeciesReference;
|
| 42 | 42 |
import fr.ird.observe.dto.referential.longline.SensorBrandReference;
|
| 43 | 43 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 44 |
-import org.apache.logging.log4j.Logger;
|
|
| 45 | 44 |
import org.apache.logging.log4j.LogManager;
|
| 45 |
+import org.apache.logging.log4j.Logger;
|
|
| 46 | 46 |
import org.nuiton.jaxx.runtime.context.JAXXContextEntryDef;
|
| 47 | 47 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 48 | 48 |
import org.nuiton.jaxx.validator.swing.SwingValidatorMessage;
|
| ... | ... | @@ -233,7 +233,7 @@ public class TdrUIHandler extends ContentTableUIHandler<SetLonglineTdrDto, TdrDt |
| 233 | 233 |
}
|
| 234 | 234 |
|
| 235 | 235 |
@Override
|
| 236 |
- protected void closeSafeUI() {
|
|
| 236 |
+ public void closeSafeUI() {
|
|
| 237 | 237 |
if (log.isInfoEnabled()) {
|
| 238 | 238 |
log.info("CloseUI: " + getModel());
|
| 239 | 239 |
}
|
| ... | ... | @@ -49,8 +49,8 @@ import fr.ird.observe.dto.referential.GearReference; |
| 49 | 49 |
import fr.ird.observe.dto.result.SaveResultDto;
|
| 50 | 50 |
import fr.ird.observe.services.service.referential.ReferentialService;
|
| 51 | 51 |
import org.apache.commons.lang3.StringUtils;
|
| 52 |
-import org.apache.logging.log4j.Logger;
|
|
| 53 | 52 |
import org.apache.logging.log4j.LogManager;
|
| 53 |
+import org.apache.logging.log4j.Logger;
|
|
| 54 | 54 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 55 | 55 |
import org.nuiton.jaxx.runtime.swing.JTables;
|
| 56 | 56 |
import org.nuiton.jaxx.validator.swing.SwingValidatorMessage;
|
| ... | ... | @@ -417,7 +417,7 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei |
| 417 | 417 |
}
|
| 418 | 418 |
|
| 419 | 419 |
@Override
|
| 420 |
- protected void closeSafeUI() {
|
|
| 420 |
+ public void closeSafeUI() {
|
|
| 421 | 421 |
|
| 422 | 422 |
if (log.isInfoEnabled()) {
|
| 423 | 423 |
log.info("CloseUI: " + getModel());
|
| ... | ... | @@ -25,6 +25,7 @@ package fr.ird.observe.client.ui.tree.navigation; |
| 25 | 25 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 26 | 26 |
import fr.ird.observe.client.db.ClientDataContext;
|
| 27 | 27 |
import fr.ird.observe.client.db.ObserveSwingDataSource;
|
| 28 |
+import fr.ird.observe.client.ui.content.ContentUI;
|
|
| 28 | 29 |
import fr.ird.observe.client.ui.tree.navigation.nodes.NavigationTreeNodeSupport;
|
| 29 | 30 |
import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport;
|
| 30 | 31 |
import fr.ird.observe.client.ui.tree.navigation.nodes.RootNavigationTreeNode;
|
| ... | ... | @@ -96,14 +97,42 @@ public class NavigationTree extends JXTree { |
| 96 | 97 |
public NavigationTree() {
|
| 97 | 98 |
super(new NavigationTreeModel());
|
| 98 | 99 |
setSelectionModel(new DefaultTreeSelectionModel() {
|
| 100 |
+// @Override
|
|
| 101 |
+// public void setSelectionPath(TreePath path) {
|
|
| 102 |
+// boolean canChange = skipCheckPreviousContent || (!Objects.equals(path, getSelectionPath()) && ObserveSwingApplicationContext.get().getContentUIManager().closeSelectedContentUI());
|
|
| 103 |
+// if (!canChange) {
|
|
| 104 |
+// // cancel the change of node
|
|
| 105 |
+// log.warn(String.format("Do not change selection path: %s against: %s", path, getSelectionPath()));
|
|
| 106 |
+// return;
|
|
| 107 |
+// }
|
|
| 108 |
+// if (skipCheckPreviousContent) {
|
|
| 109 |
+// ContentUI selectedContentUI = ObserveSwingApplicationContext.get().getContentUIManager().getSelectedContentUI();
|
|
| 110 |
+// if (selectedContentUI != null) {
|
|
| 111 |
+// selectedContentUI.getHandler().closeSafeUI();
|
|
| 112 |
+// }
|
|
| 113 |
+// }
|
|
| 114 |
+// super.setSelectionPath(path);
|
|
| 115 |
+// }
|
|
| 116 |
+ |
|
| 99 | 117 |
@Override
|
| 100 |
- public void setSelectionPath(TreePath path) {
|
|
| 118 |
+ public void setSelectionPaths(TreePath[] pPaths) {
|
|
| 119 |
+ if (pPaths.length > 1) {
|
|
| 120 |
+ return;
|
|
| 121 |
+ }
|
|
| 122 |
+ TreePath path = pPaths[0];
|
|
| 101 | 123 |
boolean canChange = skipCheckPreviousContent || (!Objects.equals(path, getSelectionPath()) && ObserveSwingApplicationContext.get().getContentUIManager().closeSelectedContentUI());
|
| 102 | 124 |
if (!canChange) {
|
| 103 | 125 |
// cancel the change of node
|
| 126 |
+ log.warn(String.format("Do not change selection path: %s against: %s", path, getSelectionPath()));
|
|
| 104 | 127 |
return;
|
| 105 | 128 |
}
|
| 106 |
- super.setSelectionPath(path);
|
|
| 129 |
+ if (skipCheckPreviousContent) {
|
|
| 130 |
+ ContentUI selectedContentUI = ObserveSwingApplicationContext.get().getContentUIManager().getSelectedContentUI();
|
|
| 131 |
+ if (selectedContentUI != null) {
|
|
| 132 |
+ selectedContentUI.getHandler().closeSafeUI();
|
|
| 133 |
+ }
|
|
| 134 |
+ }
|
|
| 135 |
+ super.setSelectionPaths(pPaths);
|
|
| 107 | 136 |
}
|
| 108 | 137 |
});
|
| 109 | 138 |
setLargeModel(true);
|
| ... | ... | @@ -1508,7 +1508,7 @@ observe.ui.tree.seine.nonTargetCatch=Non target catch |
| 1508 | 1508 |
observe.ui.tree.seine.nonTargetCatchRelease=Non target released catches
|
| 1509 | 1509 |
observe.ui.tree.seine.nonTargetSample=Non target samples
|
| 1510 | 1510 |
observe.ui.tree.seine.objectObservedSpecies=Object observed species
|
| 1511 |
-observe.ui.tree.seine.objectOperation=Object operations
|
|
| 1511 |
+observe.ui.tree.seine.objectOperation=Beacon
|
|
| 1512 | 1512 |
observe.ui.tree.seine.objectSchoolEstimate=Object school estimates
|
| 1513 | 1513 |
observe.ui.tree.seine.routes=Routes
|
| 1514 | 1514 |
observe.ui.tree.seine.schoolEstimate=School estimates
|
| ... | ... | @@ -1508,7 +1508,7 @@ observe.ui.tree.seine.nonTargetCatch=Fauna accesoria conservada o descartada |
| 1508 | 1508 |
observe.ui.tree.seine.nonTargetCatchRelease=Faunes accessoires libérées \#TODO
|
| 1509 | 1509 |
observe.ui.tree.seine.nonTargetSample=Muestreos de fauna accesoria
|
| 1510 | 1510 |
observe.ui.tree.seine.objectObservedSpecies=Fauna observada
|
| 1511 |
-observe.ui.tree.seine.objectOperation=Operaciones sobre el objeto
|
|
| 1511 |
+observe.ui.tree.seine.objectOperation=Baliza
|
|
| 1512 | 1512 |
observe.ui.tree.seine.objectSchoolEstimate=Estimaciones banco de objetos
|
| 1513 | 1513 |
observe.ui.tree.seine.routes=Rutas
|
| 1514 | 1514 |
observe.ui.tree.seine.schoolEstimate=Estimaciones banco
|
| ... | ... | @@ -1508,7 +1508,7 @@ observe.ui.tree.seine.nonTargetCatch=Espèces accessoires conservées ou rejeté |
| 1508 | 1508 |
observe.ui.tree.seine.nonTargetCatchRelease=Espèces accessoires libérées
|
| 1509 | 1509 |
observe.ui.tree.seine.nonTargetSample=Échantillons espèces accessoires
|
| 1510 | 1510 |
observe.ui.tree.seine.objectObservedSpecies=Faune observée
|
| 1511 |
-observe.ui.tree.seine.objectOperation=Opérations sur l'objet
|
|
| 1511 |
+observe.ui.tree.seine.objectOperation=Balise
|
|
| 1512 | 1512 |
observe.ui.tree.seine.objectSchoolEstimate=Estimations banc objet
|
| 1513 | 1513 |
observe.ui.tree.seine.routes=Routes
|
| 1514 | 1514 |
observe.ui.tree.seine.schoolEstimate=Estimation banc
|
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 |
<parent>
|
| 28 | 28 |
<groupId>fr.ird.observe</groupId>
|
| 29 | 29 |
<artifactId>ird-observe</artifactId>
|
| 30 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 30 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 31 | 31 |
</parent>
|
| 32 | 32 |
|
| 33 | 33 |
<artifactId>dto</artifactId>
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>fr.ird.observe</groupId>
|
| 28 | 28 |
<artifactId>ird-observe</artifactId>
|
| 29 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 29 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<artifactId>observe</artifactId>
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>fr.ird.observe</groupId>
|
| 28 | 28 |
<artifactId>ird-observe</artifactId>
|
| 29 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 29 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<artifactId>persistence</artifactId>
|
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 |
|
| 32 | 32 |
<groupId>fr.ird.observe</groupId>
|
| 33 | 33 |
<artifactId>ird-observe</artifactId>
|
| 34 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 34 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 35 | 35 |
<packaging>pom</packaging>
|
| 36 | 36 |
|
| 37 | 37 |
<name>ObServe :: Pom</name>
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>fr.ird.observe</groupId>
|
| 28 | 28 |
<artifactId>ird-observe</artifactId>
|
| 29 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 29 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<artifactId>server-configuration</artifactId>
|
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 |
<parent>
|
| 28 | 28 |
<groupId>fr.ird.observe</groupId>
|
| 29 | 29 |
<artifactId>ird-observe</artifactId>
|
| 30 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 30 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 31 | 31 |
</parent>
|
| 32 | 32 |
|
| 33 | 33 |
<artifactId>server</artifactId>
|
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 |
<parent>
|
| 28 | 28 |
<groupId>fr.ird.observe</groupId>
|
| 29 | 29 |
<artifactId>ird-observe</artifactId>
|
| 30 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 30 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 31 | 31 |
</parent>
|
| 32 | 32 |
|
| 33 | 33 |
<artifactId>services-client</artifactId>
|
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 |
<parent>
|
| 28 | 28 |
<groupId>fr.ird.observe</groupId>
|
| 29 | 29 |
<artifactId>ird-observe</artifactId>
|
| 30 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 30 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 31 | 31 |
</parent>
|
| 32 | 32 |
|
| 33 | 33 |
<artifactId>services-local</artifactId>
|
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 |
<parent>
|
| 28 | 28 |
<groupId>fr.ird.observe</groupId>
|
| 29 | 29 |
<artifactId>ird-observe</artifactId>
|
| 30 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 30 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 31 | 31 |
</parent>
|
| 32 | 32 |
|
| 33 | 33 |
<artifactId>services</artifactId>
|
| ... | ... | @@ -29,9 +29,12 @@ import fr.ird.observe.dto.data.seine.ActivitySeineDto; |
| 29 | 29 |
import fr.ird.observe.dto.data.seine.ActivitySeineStubDto;
|
| 30 | 30 |
import fr.ird.observe.dto.data.seine.RouteDto;
|
| 31 | 31 |
import fr.ird.observe.dto.decoration.DecoratorService;
|
| 32 |
-import org.apache.logging.log4j.Logger;
|
|
| 33 | 32 |
import org.apache.logging.log4j.LogManager;
|
| 33 |
+import org.apache.logging.log4j.Logger;
|
|
| 34 | 34 |
|
| 35 |
+import java.util.Comparator;
|
|
| 36 |
+import java.util.LinkedList;
|
|
| 37 |
+import java.util.List;
|
|
| 35 | 38 |
import java.util.Objects;
|
| 36 | 39 |
|
| 37 | 40 |
/**
|
| ... | ... | @@ -146,8 +149,24 @@ public class ActivitySimpleSpeedDtoValidator extends FieldValidatorSupport { |
| 146 | 149 |
|
| 147 | 150 |
Objects.requireNonNull(route, " could not find currentRoute in valueStack");
|
| 148 | 151 |
|
| 149 |
- ActivitySeineStubDto previousActivity = route.getPreviousActivity(activity.getId());
|
|
| 150 |
- |
|
| 152 |
+ ActivitySeineStubDto previousActivity;
|
|
| 153 |
+ |
|
| 154 |
+ if (activity.isNotPersisted()) {
|
|
| 155 |
+ // since there is no id, can't use the later method, must find out by our self previous activity
|
|
| 156 |
+ List<ActivitySeineStubDto> activitySeine = new LinkedList<>(route.getActivitySeine());
|
|
| 157 |
+ ActivitySeineStubDto activityStub = new ActivitySeineStubDto();
|
|
| 158 |
+ activityStub.setTime(activity.getTime());
|
|
| 159 |
+ activitySeine.add(activityStub);
|
|
| 160 |
+ activitySeine.sort(Comparator.comparing(ActivitySeineStubDto::getTimeSecond));
|
|
| 161 |
+ int index = activitySeine.indexOf(activityStub);
|
|
| 162 |
+ if (index > 0) {
|
|
| 163 |
+ previousActivity = activitySeine.get(index - 1);
|
|
| 164 |
+ } else {
|
|
| 165 |
+ previousActivity = null;
|
|
| 166 |
+ }
|
|
| 167 |
+ } else {
|
|
| 168 |
+ previousActivity = route.getPreviousActivity(activity.getId());
|
|
| 169 |
+ }
|
|
| 151 | 170 |
if (previousActivity == null) {
|
| 152 | 171 |
|
| 153 | 172 |
// pas d'activity avant, rien à valider
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>fr.ird.observe</groupId>
|
| 28 | 28 |
<artifactId>ird-observe</artifactId>
|
| 29 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 29 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<artifactId>test</artifactId>
|
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 |
<parent>
|
| 27 | 27 |
<groupId>fr.ird.observe</groupId>
|
| 28 | 28 |
<artifactId>ird-observe</artifactId>
|
| 29 |
- <version>7.0-RC-23-SNAPSHOT</version>
|
|
| 29 |
+ <version>7.0.0-SNAPSHOT</version>
|
|
| 30 | 30 |
</parent>
|
| 31 | 31 |
|
| 32 | 32 |
<artifactId>validation</artifactId>
|
| ... | ... | @@ -66,21 +66,6 @@ |
| 66 | 66 |
<message>observe.validation.route.invalid.time##${index}</message>
|
| 67 | 67 |
</field-validator>
|
| 68 | 68 |
|
| 69 |
- <!-- coherence seaSurfaceTemperature des activitys (moins de 12 de delta) -->
|
|
| 70 |
- <field-validator type="collectionFieldExpression">
|
|
| 71 |
- <param name="mode">ALL</param>
|
|
| 72 |
- <param name="useSensitiveContext">true</param>
|
|
| 73 |
- <param name="expression"><![CDATA[
|
|
| 74 |
- previous == null || previous.seaSurfaceTemperature == null || current.seaSurfaceTemperature == null
|
|
| 75 |
- || (previous.seaSurfaceTemperature > current.seaSurfaceTemperature ?
|
|
| 76 |
- previous.seaSurfaceTemperature - current.seaSurfaceTemperature <= 12.0
|
|
| 77 |
- : current.seaSurfaceTemperature - previous.seaSurfaceTemperature <= 12.0
|
|
| 78 |
- )
|
|
| 79 |
- ]]>
|
|
| 80 |
- </param>
|
|
| 81 |
- <message>observe.validation.route.invalid.seaSurfaceTemperature##${index}</message>
|
|
| 82 |
- </field-validator>
|
|
| 83 |
- |
|
| 84 | 69 |
<!-- coherence quadrant des activitys -->
|
| 85 | 70 |
<field-validator type="collectionFieldExpression">
|
| 86 | 71 |
<param name="mode">ALL</param>
|