[Lada-commits] [PATCH 8 of 8] Validate new Ort imported via LAF
Wald Commits
scm-commit at wald.intevation.org
Fri Dec 9 16:58:44 CET 2016
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1481298932 -3600
# Node ID 22d2123e1d2ac620451b12d7fc0a5bd3201cf4c8
# Parent a0968660a4c55d2817ca738875602aa8f717aa4b
Validate new Ort imported via LAF.
diff -r a0968660a4c5 -r 22d2123e1d2a src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java
--- a/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java Fri Dec 09 16:34:44 2016 +0100
+++ b/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java Fri Dec 09 16:55:32 2016 +0100
@@ -78,6 +78,10 @@
private Validator messungValidator;
@Inject
+ @ValidationConfig(type="Ort")
+ private Validator ortValidator;
+
+ @Inject
@IdentifierConfig(type="Probe")
private Identifier probeIdentifier;
@@ -837,6 +841,26 @@
ort.setOzId(zusatz.getOzsId());
}
}
+
+ Violation violation = ortValidator.validate(ort);
+ for (Entry<String, List<Integer>> warn :
+ violation.getWarnings().entrySet()) {
+ for (Integer code : warn.getValue()) {
+ currentWarnings.add(
+ new ReportItem("validation", warn.getKey(), code));
+ }
+ }
+ if (violation.hasErrors()) {
+ for (Entry<String, List<Integer>> err :
+ violation.getErrors().entrySet()) {
+ for (Integer code : err.getValue()) {
+ currentErrors.add(
+ new ReportItem("validation", err.getKey(), code));
+ }
+ }
+ return null;
+ }
+
ortFactory.transformCoordinates(ort);
if (hasKoord && !hasGem) {
logger.debug("find Verwaltungseinheit");
More information about the Lada-commits
mailing list