[Lada-commits] [PATCH 1 of 2] Added validation rule for probe objects

Wald Commits scm-commit at wald.intevation.org
Wed Mar 18 15:43:48 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1426689822 -3600
# Node ID 3d38d1fe9e884113cfbbc453931858e24ff54026
# Parent  a60f2004d7867be4a689e671d5fddf679c22fad0
Added validation rule for probe objects.

diff -r a60f2004d786 -r 3d38d1fe9e88 src/main/java/de/intevation/lada/validation/rules/probe/HasTestdatensatz.java
--- /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;
+
+ at 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;
+    }
+}


More information about the Lada-commits mailing list