[Lada-commits] [PATCH 3 of 3] Added new validation rules for messwert objects

Wald Commits scm-commit at wald.intevation.org
Tue May 5 14:09:19 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1430827815 -7200
# Node ID 53816b76753a7ec4dfafb8dee0fb559426ecf3ba
# Parent  9f22f717719d54c2e37694eba9bdd1d181cb525a
Added new validation rules for messwert objects.

diff -r 9f22f717719d -r 53816b76753a src/main/java/de/intevation/lada/validation/rules/Messwert/HasMessunsicherheit.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/validation/rules/Messwert/HasMessunsicherheit.java	Tue May 05 14:10:15 2015 +0200
@@ -0,0 +1,27 @@
+package de.intevation.lada.validation.rules.Messwert;
+
+import de.intevation.lada.model.land.LMesswert;
+import de.intevation.lada.validation.Violation;
+import de.intevation.lada.validation.annotation.ValidationRule;
+import de.intevation.lada.validation.rules.Rule;
+
+ at ValidationRule("Messwert")
+public class HasMessunsicherheit implements Rule {
+
+    @Override
+    public Violation execute(Object object) {
+        LMesswert messwert = (LMesswert)object;
+        Float unsicherheit = messwert.getMessfehler();
+        Float nachweisgrenze = messwert.getNwgZuMesswert();
+        Float wert = messwert.getMesswert();
+        if (unsicherheit != null && unsicherheit > 0f) {
+            return null;
+        }
+        else if (nachweisgrenze != null && wert < nachweisgrenze) {
+            return null;
+        }
+        Violation violation = new Violation();
+        violation.addWarning("messwewrt", 631);
+        return violation;
+    }
+}


More information about the Lada-commits mailing list