# HG changeset patch # User Tom Gottfried # 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> warn : + violation.getWarnings().entrySet()) { + for (Integer code : warn.getValue()) { + currentWarnings.add( + new ReportItem("validation", warn.getKey(), code)); + } + } + if (violation.hasErrors()) { + for (Entry> 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");