Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe
Commits:
-
6cf0382c
by tchemit at 2020-03-29T14:35:25+02:00
-
f2e8235b
by tchemit at 2020-03-29T14:35:27+02:00
-
1312c7a5
by tchemit at 2020-03-29T18:38:05+02:00
18 changed files:
- client-core/src/main/java/fr/ird/observe/client/ui/ObserveMainUI.jcss
- client-core/src/main/java/fr/ird/observe/client/ui/ObserveMainUIHandler.java
- client-core/src/main/java/fr/ird/observe/client/ui/admin/AdminUILauncher.java
- client-core/src/main/java/fr/ird/observe/client/ui/storage/RemoteUILauncher.java
- client-core/src/main/java/fr/ird/observe/client/ui/util/UIHelper.java
- client-core/src/main/java/fr/ird/observe/client/validation/ObserveSwingValidator.java
- dto/src/main/java/fr/ird/observe/validation/validators/AbstractSpeciesFieldDtoValidator.java
- dto/src/main/java/fr/ird/observe/validation/validators/ActivitySeineObservedSystemValidator.java
- dto/src/main/java/fr/ird/observe/validation/validators/ActivitySimpleSpeedDtoValidator.java
- dto/src/main/java/fr/ird/observe/validation/validators/ActivitySpeedDtoValidator.java
- dto/src/main/java/fr/ird/observe/validation/validators/NonTargetCatchObservedSystemValidator.java
- dto/src/main/java/fr/ird/observe/validation/validators/SetLonglineUniqueHomeIdDtoValidator.java
- dto/src/main/java/fr/ird/observe/validation/validators/SetLonglineUniqueNumberDtoValidator.java
- persistence/src/main/resources/db/migration/7.4/03_rename_referential-H2.sql
- pom.xml
- test/src/main/resources/db/7.5/dataForTestLongline.sql.gz
- test/src/main/resources/db/7.5/dataForTestSeine.sql.gz
- test/src/main/resources/db/7.5/referentiel.sql.gz
Changes:
| ... | ... | @@ -34,7 +34,6 @@ JSplitPane { |
| 34 | 34 |
|
| 35 | 35 |
#mainFrame {
|
| 36 | 36 |
defaultCloseOperation: "do_nothing_on_close";
|
| 37 |
- iconImage: {SwingUtil.createImageIcon("logo.png").getImage()};
|
|
| 38 | 37 |
}
|
| 39 | 38 |
|
| 40 | 39 |
#menu {
|
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 |
package fr.ird.observe.client.ui;
|
| 23 | 23 |
|
| 24 | 24 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 25 |
+import fr.ird.observe.client.ui.util.UIHelper;
|
|
| 25 | 26 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 26 | 27 |
|
| 27 | 28 |
import javax.swing.JSplitPane;
|
| ... | ... | @@ -48,6 +49,7 @@ public class ObserveMainUIHandler implements UIHandler<ObserveMainUI> { |
| 48 | 49 |
|
| 49 | 50 |
@Override
|
| 50 | 51 |
public void afterInit(ObserveMainUI ui) {
|
| 52 |
+ UIHelper.addApplicationIcon(ui);
|
|
| 51 | 53 |
ui.getInitializer().initialize();
|
| 52 | 54 |
}
|
| 53 | 55 |
|
| ... | ... | @@ -144,7 +144,7 @@ public class AdminUILauncher extends WizardUILancher<AdminStep, AdminUIModel, Ad |
| 144 | 144 |
|
| 145 | 145 |
JDialog dialog = new JDialog();
|
| 146 | 146 |
dialog.setSize(1024, 780);
|
| 147 |
- |
|
| 147 |
+ UIHelper.addApplicationIcon(dialog);
|
|
| 148 | 148 |
if (icon != null) {
|
| 149 | 149 |
dialog.setIconImage(icon.getImage());
|
| 150 | 150 |
}
|
| ... | ... | @@ -24,8 +24,8 @@ package fr.ird.observe.client.ui.storage; |
| 24 | 24 |
import fr.ird.observe.client.constants.DbMode;
|
| 25 | 25 |
import fr.ird.observe.client.ui.storage.tabs.SecurityModel;
|
| 26 | 26 |
import fr.ird.observe.client.ui.util.UIHelper;
|
| 27 |
-import org.apache.logging.log4j.Logger;
|
|
| 28 | 27 |
import org.apache.logging.log4j.LogManager;
|
| 28 |
+import org.apache.logging.log4j.Logger;
|
|
| 29 | 29 |
import org.nuiton.jaxx.runtime.JAXXContext;
|
| 30 | 30 |
|
| 31 | 31 |
import java.awt.Window;
|
| ... | ... | @@ -88,6 +88,7 @@ public abstract class RemoteUILauncher extends StorageUILauncher { |
| 88 | 88 |
|
| 89 | 89 |
model.setSteps(steps.toArray(new StorageStep[0]));
|
| 90 | 90 |
ui.setSize(800, 600);
|
| 91 |
+ UIHelper.addApplicationIcon(ui);
|
|
| 91 | 92 |
}
|
| 92 | 93 |
|
| 93 | 94 |
@Override
|
| ... | ... | @@ -65,6 +65,7 @@ import java.awt.Color; |
| 65 | 65 |
import java.awt.Component;
|
| 66 | 66 |
import java.awt.Container;
|
| 67 | 67 |
import java.awt.Toolkit;
|
| 68 |
+import java.awt.Window;
|
|
| 68 | 69 |
import java.awt.datatransfer.Clipboard;
|
| 69 | 70 |
import java.awt.datatransfer.StringSelection;
|
| 70 | 71 |
import java.awt.event.ComponentAdapter;
|
| ... | ... | @@ -108,6 +109,11 @@ public class UIHelper extends SwingUtil { |
| 108 | 109 |
/** Logger */
|
| 109 | 110 |
static private final Logger log = LogManager.getLogger(UIHelper.class);
|
| 110 | 111 |
|
| 112 |
+ |
|
| 113 |
+ public static void addApplicationIcon(Window window) {
|
|
| 114 |
+ window.setIconImage(createImageIcon("logo-small.png").getImage());
|
|
| 115 |
+ }
|
|
| 116 |
+ |
|
| 111 | 117 |
public static void displayInfo(String text) {
|
| 112 | 118 |
|
| 113 | 119 |
ObserveMainUI ui = ObserveSwingApplicationContext.get().getMainUI();
|
| ... | ... | @@ -24,8 +24,8 @@ package fr.ird.observe.client.validation; |
| 24 | 24 |
import com.opensymphony.xwork2.ActionContext;
|
| 25 | 25 |
import com.opensymphony.xwork2.util.ValueStack;
|
| 26 | 26 |
import fr.ird.observe.client.ObserveSwingApplicationContext;
|
| 27 |
-import org.apache.logging.log4j.Logger;
|
|
| 28 | 27 |
import org.apache.logging.log4j.LogManager;
|
| 28 |
+import org.apache.logging.log4j.Logger;
|
|
| 29 | 29 |
import org.nuiton.jaxx.validator.swing.SwingValidator;
|
| 30 | 30 |
import org.nuiton.validator.NuitonValidatorFactory;
|
| 31 | 31 |
import org.nuiton.validator.NuitonValidatorProvider;
|
| ... | ... | @@ -46,7 +46,6 @@ import java.util.Objects; |
| 46 | 46 |
*/
|
| 47 | 47 |
public class ObserveSwingValidator<B> extends SwingValidator<B> {
|
| 48 | 48 |
|
| 49 |
- /** Logger */
|
|
| 50 | 49 |
private static final Logger log = LogManager.getLogger(ObserveSwingValidator.class);
|
| 51 | 50 |
|
| 52 | 51 |
/** un etat pour initialiser la stack une unique fois la stack */
|
| ... | ... | @@ -108,9 +107,7 @@ public class ObserveSwingValidator<B> extends SwingValidator<B> { |
| 108 | 107 |
if (dataContext == null) {
|
| 109 | 108 |
|
| 110 | 109 |
// aucun context de validation enregistré
|
| 111 |
- if (log.isDebugEnabled()) {
|
|
| 112 |
- log.debug("No validation context registred, try in application context...");
|
|
| 113 |
- }
|
|
| 110 |
+ log.debug("No validation context registred, try in application context...");
|
|
| 114 | 111 |
ObserveSwingApplicationContext rootContext = ObserveSwingApplicationContext.get();
|
| 115 | 112 |
Objects.requireNonNull(rootContext, "Pas de context applicatif trouve.");
|
| 116 | 113 |
dataContext = rootContext.getValidationContext();
|
| ... | ... | @@ -123,8 +120,9 @@ public class ObserveSwingValidator<B> extends SwingValidator<B> { |
| 123 | 120 |
}
|
| 124 | 121 |
|
| 125 | 122 |
public static void reloadDataContext(ClientValidationContext validationContext, boolean strict) {
|
| 123 |
+ ClientValidationContext oldValidationContext = null;
|
|
| 126 | 124 |
if (validationContext != ObserveSwingValidator.validationContext) {
|
| 127 |
- |
|
| 125 |
+ oldValidationContext = ObserveSwingValidator.validationContext;
|
|
| 128 | 126 |
// keep this validation context
|
| 129 | 127 |
ObserveSwingValidator.validationContext = validationContext;
|
| 130 | 128 |
setInit(false);
|
| ... | ... | @@ -135,8 +133,7 @@ public class ObserveSwingValidator<B> extends SwingValidator<B> { |
| 135 | 133 |
|
| 136 | 134 |
if (strict) {
|
| 137 | 135 |
throw new IllegalStateException(
|
| 138 |
- "pas de context xworks enregistré... utiliser la methode " +
|
|
| 139 |
- ActionContext.class.getName() + "#setContext(context)");
|
|
| 136 |
+ String.format("pas de context xworks enregistré... utiliser la methode %s#setContext(context)", ActionContext.class.getName()));
|
|
| 140 | 137 |
}
|
| 141 | 138 |
|
| 142 | 139 |
valueStack = XWork2ValidatorUtil.getSharedValueStack();
|
| ... | ... | @@ -147,12 +144,14 @@ public class ObserveSwingValidator<B> extends SwingValidator<B> { |
| 147 | 144 |
valueStack = context.getValueStack();
|
| 148 | 145 |
}
|
| 149 | 146 |
|
| 150 |
- if (log.isDebugEnabled()) {
|
|
| 151 |
- log.debug("Enregistrement du context de validation [" + validationContext + "] dans la valueStack de " +
|
|
| 152 |
- "validation (" + valueStack + ')');
|
|
| 153 |
- }
|
|
| 147 |
+ log.debug(String.format("Enregistrement du context de validation [%s] dans la valueStack de validation (%s)", validationContext, valueStack));
|
|
| 154 | 148 |
|
| 155 |
- valueStack.push(validationContext);
|
|
| 149 |
+ if (oldValidationContext != null&& valueStack.getRoot().contains(oldValidationContext)) {
|
|
| 150 |
+ valueStack.getRoot().remove(oldValidationContext);
|
|
| 151 |
+ }
|
|
| 152 |
+ if (!valueStack.getRoot().contains(validationContext)) {
|
|
| 153 |
+ valueStack.push(validationContext);
|
|
| 154 |
+ }
|
|
| 156 | 155 |
}
|
| 157 | 156 |
|
| 158 | 157 |
public static ClientValidationContext getValidationContext() {
|
| ... | ... | @@ -72,6 +72,7 @@ public abstract class AbstractSpeciesFieldDtoValidator extends FieldValidatorSup |
| 72 | 72 |
/** le ratio a appliquer sur les bornes définies dans le référentiel */
|
| 73 | 73 |
private Float ratio;
|
| 74 | 74 |
private String speciesField = "species";
|
| 75 |
+ private Bound bound;
|
|
| 75 | 76 |
|
| 76 | 77 |
private String getSpeciesField() {
|
| 77 | 78 |
return speciesField;
|
| ... | ... | @@ -101,6 +102,10 @@ public abstract class AbstractSpeciesFieldDtoValidator extends FieldValidatorSup |
| 101 | 102 |
|
| 102 | 103 |
protected abstract Float getBoundMax(SpeciesDto referentiel);
|
| 103 | 104 |
|
| 105 |
+ public Bound getBound() {
|
|
| 106 |
+ return bound;
|
|
| 107 |
+ }
|
|
| 108 |
+ |
|
| 104 | 109 |
private boolean shouldValidate(Object object) throws ValidationException {
|
| 105 | 110 |
|
| 106 | 111 |
Boolean enable = (Boolean) getFieldValue("validationLengthWeightEnable", object);
|
| ... | ... | @@ -170,7 +175,6 @@ public abstract class AbstractSpeciesFieldDtoValidator extends FieldValidatorSup |
| 170 | 175 |
log.debug("data to validate : " + data);
|
| 171 | 176 |
}
|
| 172 | 177 |
|
| 173 |
- //noinspection unchecked
|
|
| 174 | 178 |
SpeciesReference speciesRef = (SpeciesReference) getFieldValue(speciesFieldName, object);
|
| 175 | 179 |
|
| 176 | 180 |
if (speciesRef == null) {
|
| ... | ... | @@ -185,7 +189,7 @@ public abstract class AbstractSpeciesFieldDtoValidator extends FieldValidatorSup |
| 185 | 189 |
|
| 186 | 190 |
SpeciesDto speciesDto = (SpeciesDto) stack.findValue("getSpecies(\"" + speciesRef.getId() + "\")");
|
| 187 | 191 |
|
| 188 |
- Bound bound = getBound(speciesDto);
|
|
| 192 |
+ bound = getBound(speciesDto);
|
|
| 189 | 193 |
|
| 190 | 194 |
if (log.isDebugEnabled()) {
|
| 191 | 195 |
log.debug("Species Bound to validate : " + bound);
|
| ... | ... | @@ -209,13 +213,7 @@ public abstract class AbstractSpeciesFieldDtoValidator extends FieldValidatorSup |
| 209 | 213 |
|
| 210 | 214 |
if (!valid) {
|
| 211 | 215 |
|
| 212 |
- stack.push(bound);
|
|
| 213 |
- |
|
| 214 |
- try {
|
|
| 215 |
- addFieldError(fieldName, object);
|
|
| 216 |
- } finally {
|
|
| 217 |
- stack.pop();
|
|
| 218 |
- }
|
|
| 216 |
+ ValidatorUtil.addFieldError(this, stack, fieldName, object);
|
|
| 219 | 217 |
}
|
| 220 | 218 |
}
|
| 221 | 219 |
|
| ... | ... | @@ -45,6 +45,12 @@ import java.util.Set; |
| 45 | 45 |
*/
|
| 46 | 46 |
public class ActivitySeineObservedSystemValidator extends FieldValidatorSupport {
|
| 47 | 47 |
|
| 48 |
+ private Set<String> observedSystemLabels;
|
|
| 49 |
+ |
|
| 50 |
+ public Set<String> getObservedSystemLabels() {
|
|
| 51 |
+ return observedSystemLabels;
|
|
| 52 |
+ }
|
|
| 53 |
+ |
|
| 48 | 54 |
@Override
|
| 49 | 55 |
public void validate(Object object) throws ValidationException {
|
| 50 | 56 |
|
| ... | ... | @@ -89,8 +95,9 @@ public class ActivitySeineObservedSystemValidator extends FieldValidatorSupport |
| 89 | 95 |
}
|
| 90 | 96 |
if (!labels.isEmpty()) {
|
| 91 | 97 |
// there is some missing system observed
|
| 92 |
- stack.set("observedSystemLabels", labels);
|
|
| 93 |
- addFieldError(getFieldName(), object);
|
|
| 98 |
+ this.observedSystemLabels = labels;
|
|
| 99 |
+ |
|
| 100 |
+ ValidatorUtil.addFieldError(this, stack, getFieldName(), object);
|
|
| 94 | 101 |
}
|
| 95 | 102 |
}
|
| 96 | 103 |
}
|
| ... | ... | @@ -99,4 +106,6 @@ public class ActivitySeineObservedSystemValidator extends FieldValidatorSupport |
| 99 | 106 |
public String getValidatorType() {
|
| 100 | 107 |
return "activitySeine_observedSystem";
|
| 101 | 108 |
}
|
| 109 |
+ |
|
| 110 |
+ |
|
| 102 | 111 |
}
|
| ... | ... | @@ -73,6 +73,7 @@ import static io.ultreia.java4all.i18n.I18n.n; |
| 73 | 73 |
* @author Tony Chemit - dev@tchemit.fr
|
| 74 | 74 |
* @since 1.0
|
| 75 | 75 |
*/
|
| 76 |
+@SuppressWarnings("unused")
|
|
| 76 | 77 |
public class ActivitySimpleSpeedDtoValidator extends FieldValidatorSupport {
|
| 77 | 78 |
|
| 78 | 79 |
/** Logger. */
|
| ... | ... | @@ -81,6 +82,7 @@ public class ActivitySimpleSpeedDtoValidator extends FieldValidatorSupport { |
| 81 | 82 |
private boolean enable;
|
| 82 | 83 |
|
| 83 | 84 |
private Float speed;
|
| 85 |
+ private Float computedSpeed;
|
|
| 84 | 86 |
|
| 85 | 87 |
/**
|
| 86 | 88 |
* Construit un point à partir de l'entité donnée.
|
| ... | ... | @@ -122,6 +124,10 @@ public class ActivitySimpleSpeedDtoValidator extends FieldValidatorSupport { |
| 122 | 124 |
this.enable = enable;
|
| 123 | 125 |
}
|
| 124 | 126 |
|
| 127 |
+ public Float getComputedSpeed() {
|
|
| 128 |
+ return computedSpeed;
|
|
| 129 |
+ }
|
|
| 130 |
+ |
|
| 125 | 131 |
@Override
|
| 126 | 132 |
public void validate(Object object) throws ValidationException {
|
| 127 | 133 |
|
| ... | ... | @@ -224,13 +230,13 @@ public class ActivitySimpleSpeedDtoValidator extends FieldValidatorSupport { |
| 224 | 230 |
|
| 225 | 231 |
if (!b) {
|
| 226 | 232 |
|
| 227 |
- stack.set("foundSpeed", computedSpeed);
|
|
| 233 |
+ this.computedSpeed = computedSpeed;
|
|
| 228 | 234 |
|
| 229 | 235 |
if (getDefaultMessage().isEmpty()) {
|
| 230 |
- setDefaultMessage(n("observe.validation.activity.speed.bound") + "##${foundSpeed}##${speed}");
|
|
| 236 |
+ setDefaultMessage(n("observe.validation.activity.speed.bound") + "##${computedSpeed}##${speed}");
|
|
| 231 | 237 |
}
|
| 232 | 238 |
// vitesse trop grande
|
| 233 |
- addFieldError(getFieldName(), object);
|
|
| 239 |
+ ValidatorUtil.addFieldError(this, stack, getFieldName(), object);
|
|
| 234 | 240 |
}
|
| 235 | 241 |
}
|
| 236 | 242 |
|
| ... | ... | @@ -69,17 +69,14 @@ import static io.ultreia.java4all.i18n.I18n.n; |
| 69 | 69 |
* @author Tony Chemit - dev@tchemit.fr
|
| 70 | 70 |
* @since 1.0
|
| 71 | 71 |
*/
|
| 72 |
+@SuppressWarnings("unused")
|
|
| 72 | 73 |
public class ActivitySpeedDtoValidator extends FieldValidatorSupport {
|
| 73 | 74 |
|
| 74 | 75 |
private static final Logger LOG = LogManager.getLogger(ActivitySimpleSpeedDtoValidator.class);
|
| 75 | 76 |
|
| 76 | 77 |
private CollectionFieldExpressionValidator delegate;
|
| 77 |
- |
|
| 78 | 78 |
private boolean enable;
|
| 79 |
- |
|
| 80 | 79 |
private Float speed;
|
| 81 |
- private String invalidActivity;
|
|
| 82 |
- |
|
| 83 | 80 |
public Float getSpeed() {
|
| 84 | 81 |
return speed;
|
| 85 | 82 |
}
|
| ... | ... | @@ -96,10 +93,6 @@ public class ActivitySpeedDtoValidator extends FieldValidatorSupport { |
| 96 | 93 |
this.enable = enable;
|
| 97 | 94 |
}
|
| 98 | 95 |
|
| 99 |
- public String getInvalidActivity() {
|
|
| 100 |
- return invalidActivity;
|
|
| 101 |
- }
|
|
| 102 |
- |
|
| 103 | 96 |
private String decorate(ActivitySeineStubDto activitySeine) {
|
| 104 | 97 |
DecoratorService decoratorService = (DecoratorService) stack.findValue("decoratorService");
|
| 105 | 98 |
return decoratorService.getDecoratorByType(ActivitySeineStubDto.class).toString(activitySeine);
|
| ... | ... | @@ -114,6 +107,17 @@ public class ActivitySpeedDtoValidator extends FieldValidatorSupport { |
| 114 | 107 |
if (delegate == null) {
|
| 115 | 108 |
delegate = new CollectionFieldExpressionValidator() {
|
| 116 | 109 |
|
| 110 |
+ |
|
| 111 |
+ private String invalidActivity;
|
|
| 112 |
+ private Float computedSpeed;
|
|
| 113 |
+ |
|
| 114 |
+ @Override
|
|
| 115 |
+ public void validateWhenNotSkip(Object object) throws ValidationException {
|
|
| 116 |
+ invalidActivity = null;
|
|
| 117 |
+ computedSpeed = null;
|
|
| 118 |
+ super.validateWhenNotSkip(object);
|
|
| 119 |
+ }
|
|
| 120 |
+ |
|
| 117 | 121 |
@Override
|
| 118 | 122 |
protected boolean validateOneEntry(Object object) {
|
| 119 | 123 |
|
| ... | ... | @@ -151,38 +155,33 @@ public class ActivitySpeedDtoValidator extends FieldValidatorSupport { |
| 151 | 155 |
boolean valid = computedSpeed <= speed;
|
| 152 | 156 |
|
| 153 | 157 |
if (!valid) {
|
| 154 |
- stack.set("foundSpeed", computedSpeed);
|
|
| 155 |
- |
|
| 156 |
- invalidActivity = decorate(currentActivity);
|
|
| 158 |
+ this.computedSpeed = computedSpeed;
|
|
| 159 |
+ this.invalidActivity = decorate(currentActivity);
|
|
| 157 | 160 |
|
| 158 | 161 |
LOG.debug(String.format("Speed from %s to %s is %s which is more thant authorized one %s", decorate(previousActivity), invalidActivity, computedSpeed, speed));
|
| 159 | 162 |
}
|
| 160 | 163 |
return valid;
|
| 161 | 164 |
}
|
| 162 | 165 |
|
| 163 |
- @Override
|
|
| 164 |
- public String getMessage(Object object) {
|
|
| 165 |
- boolean pop = false;
|
|
| 166 |
- if (!stack.getRoot().contains(ActivitySpeedDtoValidator.this)) {
|
|
| 167 |
- stack.push(ActivitySpeedDtoValidator.this);
|
|
| 168 |
- pop = true;
|
|
| 169 |
- }
|
|
| 170 |
- try {
|
|
| 171 |
- return super.getMessage(object);
|
|
| 172 |
- } finally {
|
|
| 173 |
- if (pop) {
|
|
| 174 |
- stack.pop();
|
|
| 175 |
- }
|
|
| 176 |
- }
|
|
| 177 |
- }
|
|
| 178 |
- |
|
| 179 | 166 |
@Override
|
| 180 | 167 |
protected void addFieldError(String propertyName, Object object) {
|
| 181 | 168 |
if (getDefaultMessage().isEmpty()) {
|
| 182 |
- setDefaultMessage(n("observe.validation.activity.speed.bound.inter") + "##${speed}##${invalidActivity}##${foundSpeed}");
|
|
| 169 |
+ setDefaultMessage(n("observe.validation.activity.speed.bound.inter") + "##${speed}##${invalidActivity}##${computedSpeed}");
|
|
| 183 | 170 |
}
|
| 184 |
- super.addFieldError(propertyName, object);
|
|
| 171 |
+ ValidatorUtil.addFieldError(this, stack, propertyName, object);
|
|
| 172 |
+ }
|
|
| 173 |
+ |
|
| 174 |
+ public String getInvalidActivity() {
|
|
| 175 |
+ return invalidActivity;
|
|
| 185 | 176 |
}
|
| 177 |
+ |
|
| 178 |
+ public float getComputedSpeed() {
|
|
| 179 |
+ return computedSpeed;
|
|
| 180 |
+ }
|
|
| 181 |
+ public float getSpeed() {
|
|
| 182 |
+ return ActivitySpeedDtoValidator.this.getSpeed();
|
|
| 183 |
+ }
|
|
| 184 |
+ |
|
| 186 | 185 |
};
|
| 187 | 186 |
delegate.setCollectionFieldName(RouteDto.PROPERTY_ACTIVITY_SEINE);
|
| 188 | 187 |
delegate.setMode(CollectionFieldExpressionValidator.Mode.ALL);
|
| ... | ... | @@ -226,8 +225,6 @@ public class ActivitySpeedDtoValidator extends FieldValidatorSupport { |
| 226 | 225 |
throw new ValidationException("le parametre speed est obligatoire");
|
| 227 | 226 |
}
|
| 228 | 227 |
|
| 229 |
- invalidActivity = null;
|
|
| 230 |
- |
|
| 231 | 228 |
getDelegate((RouteDto) object).validate(object);
|
| 232 | 229 |
}
|
| 233 | 230 |
|
| ... | ... | @@ -34,16 +34,24 @@ import fr.ird.observe.dto.referential.seine.ObservedSystemReference; |
| 34 | 34 |
import fr.ird.observe.validation.SeineBycatchObservedSystemConfig;
|
| 35 | 35 |
|
| 36 | 36 |
import java.util.Collection;
|
| 37 |
-import java.util.LinkedList;
|
|
| 37 |
+import java.util.LinkedHashSet;
|
|
| 38 | 38 |
import java.util.List;
|
| 39 |
+import java.util.Set;
|
|
| 39 | 40 |
|
| 40 | 41 |
/**
|
| 41 | 42 |
* Created by tchemit on 03/05/2018.
|
| 42 | 43 |
*
|
| 43 | 44 |
* @author Tony Chemit - dev@tchemit.fr
|
| 44 | 45 |
*/
|
| 46 |
+@SuppressWarnings("unused")
|
|
| 45 | 47 |
public class NonTargetCatchObservedSystemValidator extends FieldValidatorSupport {
|
| 46 | 48 |
|
| 49 |
+ private Set<String> observedSystemLabels;
|
|
| 50 |
+ |
|
| 51 |
+ public Set<String> getObservedSystemLabels() {
|
|
| 52 |
+ return observedSystemLabels;
|
|
| 53 |
+ }
|
|
| 54 |
+ |
|
| 47 | 55 |
@Override
|
| 48 | 56 |
public void validate(Object object) throws ValidationException {
|
| 49 | 57 |
|
| ... | ... | @@ -72,16 +80,16 @@ public class NonTargetCatchObservedSystemValidator extends FieldValidatorSupport |
| 72 | 80 |
DecoratorService decoratorService = (DecoratorService) stack.findValue("decoratorService");
|
| 73 | 81 |
ImmutableMap<String, ObservedSystemReference> map = Maps.uniqueIndex(observedSystems, ObservedSystemReference::getId);
|
| 74 | 82 |
ReferentialReferenceDecorator<ObservedSystemReference> decorator = decoratorService.getReferentialReferenceDecorator(ObservedSystemReference.class);
|
| 75 |
- List<String> labels = new LinkedList<>();
|
|
| 83 |
+ Set<String> labels = new LinkedHashSet<>();
|
|
| 76 | 84 |
for (String observedSystemId : requiredObservedSystemBySpeciesId) {
|
| 77 | 85 |
ObservedSystemReference ref = map.get(observedSystemId);
|
| 78 | 86 |
log.debug("Required observed system id: " + observedSystemId);
|
| 79 | 87 |
log.debug("Required observed system: " + ref);
|
| 80 | 88 |
labels.add(decorator.toString(ref));
|
| 81 | 89 |
}
|
| 82 |
- stack.set("observedSystemLabels", labels);
|
|
| 90 |
+ this.observedSystemLabels = labels;
|
|
| 83 | 91 |
|
| 84 |
- addFieldError(getFieldName(), object);
|
|
| 92 |
+ ValidatorUtil.addFieldError(this, stack, getFieldName(), object);
|
|
| 85 | 93 |
}
|
| 86 | 94 |
}
|
| 87 | 95 |
}
|
| ... | ... | @@ -38,8 +38,15 @@ import java.util.Optional; |
| 38 | 38 |
* @author Tony Chemit - dev@tchemit.fr
|
| 39 | 39 |
* @since 3.9
|
| 40 | 40 |
*/
|
| 41 |
+@SuppressWarnings("unused")
|
|
| 41 | 42 |
public class SetLonglineUniqueHomeIdDtoValidator extends FieldValidatorSupport {
|
| 42 | 43 |
|
| 44 |
+ private String duplicatedActivity;
|
|
| 45 |
+ |
|
| 46 |
+ public String getDuplicatedActivity() {
|
|
| 47 |
+ return duplicatedActivity;
|
|
| 48 |
+ }
|
|
| 49 |
+ |
|
| 43 | 50 |
@Override
|
| 44 | 51 |
public void validate(Object object) {
|
| 45 | 52 |
|
| ... | ... | @@ -57,14 +64,14 @@ public class SetLonglineUniqueHomeIdDtoValidator extends FieldValidatorSupport { |
| 57 | 64 |
|
| 58 | 65 |
if (sameHomeIdSetLonglineOptional.isPresent()) {
|
| 59 | 66 |
|
| 60 |
- ActivityLonglineReference activityLonglineRef = sameHomeIdSetLonglineOptional.get().getActivityLongline();
|
|
| 67 |
+ ActivityLonglineReference activity = sameHomeIdSetLonglineOptional.get().getActivityLongline();
|
|
| 61 | 68 |
|
| 62 | 69 |
DecoratorService decoratorService = (DecoratorService) stack.findValue("decoratorService");
|
| 63 | 70 |
DataReferenceDecorator<ActivityLonglineReference> decorator = decoratorService.getDataReferenceDecorator(ActivityLonglineReference.class);
|
| 64 | 71 |
|
| 65 |
- stack.set("duplicatedActivity", decorator.toString(activityLonglineRef));
|
|
| 72 |
+ duplicatedActivity = decorator.toString(activity);
|
|
| 66 | 73 |
|
| 67 |
- addFieldError(getFieldName(), object);
|
|
| 74 |
+ ValidatorUtil.addFieldError(this, stack, getFieldName(), object);
|
|
| 68 | 75 |
|
| 69 | 76 |
}
|
| 70 | 77 |
}
|
| ... | ... | @@ -38,8 +38,14 @@ import java.util.Optional; |
| 38 | 38 |
* @author Tony Chemit - dev@tchemit.fr
|
| 39 | 39 |
* @since 3.9
|
| 40 | 40 |
*/
|
| 41 |
+@SuppressWarnings("unused")
|
|
| 41 | 42 |
public class SetLonglineUniqueNumberDtoValidator extends FieldValidatorSupport {
|
| 42 | 43 |
|
| 44 |
+ private String duplicatedActivity;
|
|
| 45 |
+ |
|
| 46 |
+ public String getDuplicatedActivity() {
|
|
| 47 |
+ return duplicatedActivity;
|
|
| 48 |
+ }
|
|
| 43 | 49 |
@Override
|
| 44 | 50 |
public void validate(Object object) {
|
| 45 | 51 |
|
| ... | ... | @@ -55,15 +61,13 @@ public class SetLonglineUniqueNumberDtoValidator extends FieldValidatorSupport { |
| 55 | 61 |
|
| 56 | 62 |
if (sameNumberSetLonglineOptional.isPresent()) {
|
| 57 | 63 |
|
| 58 |
- ActivityLonglineReference activityLonglineRef = sameNumberSetLonglineOptional.get().getActivityLongline();
|
|
| 64 |
+ ActivityLonglineReference activity = sameNumberSetLonglineOptional.get().getActivityLongline();
|
|
| 59 | 65 |
|
| 60 | 66 |
DecoratorService decoratorService = (DecoratorService) stack.findValue("decoratorService");
|
| 61 | 67 |
DataReferenceDecorator<ActivityLonglineReference> decorator = decoratorService.getDataReferenceDecorator(ActivityLonglineReference.class);
|
| 62 | 68 |
|
| 63 |
- stack.set("duplicatedActivity", decorator.toString(activityLonglineRef));
|
|
| 64 |
- |
|
| 65 |
- addFieldError(getFieldName(), object);
|
|
| 66 |
- |
|
| 69 |
+ duplicatedActivity = decorator.toString(activity);
|
|
| 70 |
+ ValidatorUtil.addFieldError(this, stack, getFieldName(), object);
|
|
| 67 | 71 |
}
|
| 68 | 72 |
|
| 69 | 73 |
}
|
| ... | ... | @@ -43,5 +43,5 @@ CREATE INDEX idx_observe_longline_catch_stomachFullness ON observe_longline.catc |
| 43 | 43 |
DROP TABLE observe_longline.Healthness;
|
| 44 | 44 |
DROP TABLE observe_longline.StomacFullness;
|
| 45 | 45 |
|
| 46 |
-UPDATE observe_common.LASTUPDATEDATE SET TYPE = REPLACE(TYPE, 'referentiel.longline.Healthness', 'referential.longline.HealthStatus');
|
|
| 47 |
-UPDATE observe_common.LASTUPDATEDATE SET TYPE = REPLACE(TYPE, 'referentiel.longline.StomacFullness', 'referential.longline.StomachFullness');
|
|
| \ No newline at end of file | ||
| 46 |
+UPDATE observe_common.LASTUPDATEDATE SET TYPE = REPLACE(TYPE, 'referentiel.longline.Healthness', 'referentiel.longline.HealthStatus');
|
|
| 47 |
+UPDATE observe_common.LASTUPDATEDATE SET TYPE = REPLACE(TYPE, 'referentiel.longline.StomacFullness', 'referentiel.longline.StomachFullness');
|
|
| \ No newline at end of file |
| ... | ... | @@ -155,7 +155,7 @@ |
| 155 | 155 |
<maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
|
| 156 | 156 |
<buildDate>${maven.build.timestamp}</buildDate>
|
| 157 | 157 |
|
| 158 |
- <observeToolkitVersion>3.7.26</observeToolkitVersion>
|
|
| 158 |
+ <observeToolkitVersion>3.7.27</observeToolkitVersion>
|
|
| 159 | 159 |
<!--<lib.version.java4all.http>1.0.13</lib.version.java4all.http>-->
|
| 160 | 160 |
<lib.version.nuiton.validation>3.1</lib.version.nuiton.validation>
|
| 161 | 161 |
<!--<lib.version.java4all.config>1.0.3</lib.version.java4all.config>-->
|
No preview for this file type
No preview for this file type
No preview for this file type