changeset 649:53816b76753a

Added new validation rules for messwert objects.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 05 May 2015 14:10:15 +0200
parents 9f22f717719d
children 55177afef263
files src/main/java/de/intevation/lada/validation/rules/Messwert/HasMessunsicherheit.java
diffstat 1 files changed, 27 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/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;
+
+@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;
+    }
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)