[Lada-commits] [PATCH 13 of 13] Fixed validation rules for messung objects
Wald Commits
scm-commit at wald.intevation.org
Fri May 29 11:48:23 CEST 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1432892884 -7200
# Node ID 0015e96a64540a38cea57fa8fe62f131afb1d0dd
# Parent 9a9241275ee6280df584c8cf2ab2491efe260547
Fixed validation rules for messung objects.
diff -r 9a9241275ee6 -r 0015e96a6454 src/main/java/de/intevation/lada/validation/rules/messung/HasPflichtmessgroessen.java
--- 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;
}
diff -r 9a9241275ee6 -r 0015e96a6454 src/main/java/de/intevation/lada/validation/rules/messung/UniqueNebenprobenNr.java
--- 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();
More information about the Lada-commits
mailing list