Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/validation/rules/messung/Date.java @ 677:de47b7193bdb
Fixed validation rules.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 22 May 2015 15:15:14 +0200 |
parents | 4da01934e46f |
children | 3ec358698b4d |
comparison
equal
deleted
inserted
replaced
676:ab539e3f186d | 677:de47b7193bdb |
---|---|
1 package de.intevation.lada.validation.rules.messung; | 1 package de.intevation.lada.validation.rules.messung; |
2 | 2 |
3 import java.util.HashMap; | 3 import java.util.HashMap; |
4 import java.util.List; | |
5 import java.util.Map; | 4 import java.util.Map; |
6 | 5 |
7 import javax.inject.Inject; | 6 import javax.inject.Inject; |
8 | 7 |
9 import de.intevation.lada.model.land.LMessung; | 8 import de.intevation.lada.model.land.LMessung; |
26 @Override | 25 @Override |
27 public Violation execute(Object object) { | 26 public Violation execute(Object object) { |
28 LMessung messung = (LMessung)object; | 27 LMessung messung = (LMessung)object; |
29 Integer probeId = messung.getProbeId(); | 28 Integer probeId = messung.getProbeId(); |
30 Response response = repository.getById(LProbe.class, probeId, "land"); | 29 Response response = repository.getById(LProbe.class, probeId, "land"); |
31 @SuppressWarnings("unchecked") | 30 LProbe probe = (LProbe) response.getData(); |
32 List<LProbe> list = (List<LProbe>) response.getData(); | 31 if (probe == null) { |
33 if (list.isEmpty()) { | |
34 Map<String, Integer> errors = new HashMap<String, Integer>(); | 32 Map<String, Integer> errors = new HashMap<String, Integer>(); |
35 errors.put("lprobe", 604); | 33 errors.put("lprobe", 604); |
36 } | 34 } |
37 LProbe probe = list.get(0); | |
38 if (probe.getProbeentnahmeEnde() == null || | 35 if (probe.getProbeentnahmeEnde() == null || |
39 probe.getProbeentnahmeEnde().after(messung.getMesszeitpunkt())) { | 36 probe.getProbeentnahmeEnde().after(messung.getMesszeitpunkt())) { |
40 Violation violation = new Violation(); | 37 Violation violation = new Violation(); |
41 violation.addWarning("messzeitpunkt", 661); | 38 violation.addWarning("messzeitpunkt", 632); |
42 return violation; | 39 return violation; |
43 } | 40 } |
44 return null; | 41 return null; |
45 } | 42 } |
46 } | 43 } |