changeset 570:3d38d1fe9e88 2.0-alpha1

Added validation rule for probe objects.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 18 Mar 2015 15:43:42 +0100
parents a60f2004d786
children 20e87ff455c0
files src/main/java/de/intevation/lada/validation/rules/probe/HasTestdatensatz.java
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/validation/rules/probe/HasTestdatensatz.java	Wed Mar 18 15:43:42 2015 +0100
@@ -0,0 +1,22 @@
+package de.intevation.lada.validation.rules.probe;
+
+import de.intevation.lada.model.land.LProbe;
+import de.intevation.lada.validation.Violation;
+import de.intevation.lada.validation.annotation.ValidationRule;
+import de.intevation.lada.validation.rules.Rule;
+
+@ValidationRule("Probe")
+public class HasTestdatensatz implements Rule {
+
+    @Override
+    public Violation execute(Object object) {
+        LProbe probe = (LProbe)object;
+        if (probe.getTest() == null ||
+            probe.getTest().equals("")) {
+            Violation violation = new Violation();
+            violation.addError("test", 631);
+            return violation;
+        }
+        return null;
+    }
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)