comparison src/main/java/de/intevation/lada/validation/rules/ort/OrtTypExists.java @ 1277:15700d7c00eb

According to database schema, ort.ort_typ is allowed to be NULL.
author Tom Gottfried <tom@intevation.de>
date Thu, 02 Feb 2017 15:41:05 +0100
parents efa50b39c7cc
children
comparison
equal deleted inserted replaced
1276:efa50b39c7cc 1277:15700d7c00eb
35 35
36 @Override 36 @Override
37 public Violation execute(Object object) { 37 public Violation execute(Object object) {
38 Ort ort = (Ort)object; 38 Ort ort = (Ort)object;
39 39
40 QueryBuilder<OrtTyp> builder = 40 if (ort.getOrtTyp() != null) {
41 new QueryBuilder<OrtTyp>( 41 QueryBuilder<OrtTyp> builder =
42 repository.entityManager("stamm"), 42 new QueryBuilder<OrtTyp>(
43 OrtTyp.class); 43 repository.entityManager("stamm"),
44 builder.and("id", ort.getOrtTyp()); 44 OrtTyp.class);
45 List<OrtTyp> ots = repository.filterPlain( 45 builder.and("id", ort.getOrtTyp());
46 builder.getQuery(), "stamm"); 46 List<OrtTyp> ots = repository.filterPlain(
47 if (ots == null || ots.isEmpty()) { 47 builder.getQuery(), "stamm");
48 Violation violation = new Violation(); 48 if (ots == null || ots.isEmpty()) {
49 violation.addError("ortTyp", 612); 49 Violation violation = new Violation();
50 return violation; 50 violation.addError("ortTyp", 612);
51 return violation;
52 }
51 } 53 }
52 54
53 return null; 55 return null;
54 } 56 }
55 57
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)