[Lada-commits] [PATCH 08 of 10] Validate the object is a probe

Wald Commits scm-commit at wald.intevation.org
Tue Feb 24 14:57:50 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1424786244 -3600
# Node ID 7925f5eda6c43d3b9e75355ebc3e92bca006c495
# Parent  deb3fec601edd39c49b86f5f50366a6da1d743c8
Validate the object is a probe.

diff -r deb3fec601ed -r 7925f5eda6c4 src/main/java/de/intevation/lada/validation/ProbeValidator.java
--- a/src/main/java/de/intevation/lada/validation/ProbeValidator.java	Tue Feb 24 14:56:46 2015 +0100
+++ b/src/main/java/de/intevation/lada/validation/ProbeValidator.java	Tue Feb 24 14:57:24 2015 +0100
@@ -4,8 +4,9 @@
 import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
 
+import de.intevation.lada.model.land.LProbe;
+import de.intevation.lada.validation.annotation.ValidationConfig;
 import de.intevation.lada.validation.annotation.ValidationRule;
-import de.intevation.lada.validation.annotation.ValidationConfig;
 import de.intevation.lada.validation.rules.Rule;
 
 @ValidationConfig(type="Probe")
@@ -19,6 +20,10 @@
     @Override
     public Violation validate(Object object) {
         Violation violations = new Violation();
+        if (!(object instanceof LProbe)) {
+            violations.addError("probe", 602);
+            return violations;
+        }
         for(Rule rule: rules) {
             Violation result = rule.execute(object);
             if (result != null) {


More information about the Lada-commits mailing list