changeset 540:7925f5eda6c4

Validate the object is a probe.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 24 Feb 2015 14:57:24 +0100
parents deb3fec601ed
children 2cff9c6c4a9e
files src/main/java/de/intevation/lada/validation/ProbeValidator.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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) {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)