[Lada-commits] [PATCH] Added validation rule for probe.probeart

Wald Commits scm-commit at wald.intevation.org
Fri Apr 17 13:23:58 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1429269895 -7200
# Node ID 2e26f06b6e4ba55c4cb5a07c975126444abc3fe4
# Parent  8086664d16294d83907a0fe12cd72cf61d9ca6c4
Added validation rule for probe.probeart.

diff -r 8086664d1629 -r 2e26f06b6e4b src/main/java/de/intevation/lada/validation/rules/probe/HasProbeart.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/validation/rules/probe/HasProbeart.java	Fri Apr 17 13:24:55 2015 +0200
@@ -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 HasProbeart implements Rule {
+
+    @Override
+    public Violation execute(Object object) {
+        LProbe probe = (LProbe)object;
+        if (probe.getProbenartId() == null ||
+            probe.getProbenartId().equals("")) {
+            Violation violation = new Violation();
+            violation.addError("probenartId", 631);
+            return violation;
+        }
+        return null;
+    }
+}


More information about the Lada-commits mailing list