changeset 682:0015e96a6454

Fixed validation rules for messung objects.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 29 May 2015 11:48:04 +0200
parents 9a9241275ee6
children 1e54d59280e6
files src/main/java/de/intevation/lada/validation/rules/messung/HasPflichtmessgroessen.java src/main/java/de/intevation/lada/validation/rules/messung/UniqueNebenprobenNr.java
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/validation/rules/messung/HasPflichtmessgroessen.java	Fri May 29 11:47:29 2015 +0200
+++ b/src/main/java/de/intevation/lada/validation/rules/messung/HasPflichtmessgroessen.java	Fri May 29 11:48:04 2015 +0200
@@ -43,17 +43,16 @@
             repository.filter(wertBuilder.getQuery(), "land");
         List<LMesswert> messwerte = (List<LMesswert>)wertResponse.getData();
         Violation violation = new Violation();
-        boolean hit = false;
+        boolean missing = false;
         for (PflichtMessgroesse p : pflicht) {
-            hit = false;
             for (LMesswert wert : messwerte) {
-                if (p.getMessgroesseId().equals(wert.getMessgroesseId())) {
-                    hit = true;
+                if (!p.getMessgroesseId().equals(wert.getMessgroesseId())) {
+                    missing = true;
                 }
             }
-            if (!hit) {
-                violation.addWarning("pflichtmessgroesse", 631);
-            }
+        }
+        if (missing) {
+            violation.addWarning("pflichtmessgroesse", 631);
         }
         return violation.hasWarnings() ? violation : null;
     }
--- a/src/main/java/de/intevation/lada/validation/rules/messung/UniqueNebenprobenNr.java	Fri May 29 11:47:29 2015 +0200
+++ b/src/main/java/de/intevation/lada/validation/rules/messung/UniqueNebenprobenNr.java	Fri May 29 11:48:04 2015 +0200
@@ -34,7 +34,8 @@
         if (!((List<LMessung>)response.getData()).isEmpty()) {
             LMessung found = ((List<LMessung>)response.getData()).get(0);
             // The messung found in the db equals the new messung. (Update)
-            if (messung.getId() != null && messung.getId() == found.getId()) {
+            if (messung.getId() != null &&
+                messung.getId().equals(found.getId())) {
                 return null;
             }
             Violation violation = new Violation();
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)