[Lada-commits] [PATCH] According to database schema, ort.ort_typ is allowed to be NULL
Wald Commits
scm-commit at wald.intevation.org
Thu Feb 2 15:41:10 CET 2017
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1486046465 -3600
# Node ID 15700d7c00eba15474a420de2d4b0b897a798c88
# Parent efa50b39c7cc29deb5f5e7782b1fdd96db798c47
According to database schema, ort.ort_typ is allowed to be NULL.
diff -r efa50b39c7cc -r 15700d7c00eb src/main/java/de/intevation/lada/validation/rules/ort/OrtTypExists.java
--- a/src/main/java/de/intevation/lada/validation/rules/ort/OrtTypExists.java Thu Feb 02 15:01:12 2017 +0100
+++ b/src/main/java/de/intevation/lada/validation/rules/ort/OrtTypExists.java Thu Feb 02 15:41:05 2017 +0100
@@ -37,17 +37,19 @@
public Violation execute(Object object) {
Ort ort = (Ort)object;
- QueryBuilder<OrtTyp> builder =
- new QueryBuilder<OrtTyp>(
- repository.entityManager("stamm"),
- OrtTyp.class);
- builder.and("id", ort.getOrtTyp());
- List<OrtTyp> ots = repository.filterPlain(
- builder.getQuery(), "stamm");
- if (ots == null || ots.isEmpty()) {
- Violation violation = new Violation();
- violation.addError("ortTyp", 612);
- return violation;
+ if (ort.getOrtTyp() != null) {
+ QueryBuilder<OrtTyp> builder =
+ new QueryBuilder<OrtTyp>(
+ repository.entityManager("stamm"),
+ OrtTyp.class);
+ builder.and("id", ort.getOrtTyp());
+ List<OrtTyp> ots = repository.filterPlain(
+ builder.getQuery(), "stamm");
+ if (ots == null || ots.isEmpty()) {
+ Violation violation = new Violation();
+ violation.addError("ortTyp", 612);
+ return violation;
+ }
}
return null;
More information about the Lada-commits
mailing list