Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java @ 1228:22d2123e1d2a
Validate new Ort imported via LAF.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 09 Dec 2016 16:55:32 +0100 |
parents | 59b0e54426d4 |
children | 1965e26ef8b5 |
comparison
equal
deleted
inserted
replaced
1227:a0968660a4c5 | 1228:22d2123e1d2a |
---|---|
76 @Inject | 76 @Inject |
77 @ValidationConfig(type="Messung") | 77 @ValidationConfig(type="Messung") |
78 private Validator messungValidator; | 78 private Validator messungValidator; |
79 | 79 |
80 @Inject | 80 @Inject |
81 @ValidationConfig(type="Ort") | |
82 private Validator ortValidator; | |
83 | |
84 @Inject | |
81 @IdentifierConfig(type="Probe") | 85 @IdentifierConfig(type="Probe") |
82 private Identifier probeIdentifier; | 86 private Identifier probeIdentifier; |
83 | 87 |
84 @Inject | 88 @Inject |
85 @IdentifierConfig(type="Messung") | 89 @IdentifierConfig(type="Messung") |
835 "stamm"); | 839 "stamm"); |
836 if (zusatz != null) { | 840 if (zusatz != null) { |
837 ort.setOzId(zusatz.getOzsId()); | 841 ort.setOzId(zusatz.getOzsId()); |
838 } | 842 } |
839 } | 843 } |
844 | |
845 Violation violation = ortValidator.validate(ort); | |
846 for (Entry<String, List<Integer>> warn : | |
847 violation.getWarnings().entrySet()) { | |
848 for (Integer code : warn.getValue()) { | |
849 currentWarnings.add( | |
850 new ReportItem("validation", warn.getKey(), code)); | |
851 } | |
852 } | |
853 if (violation.hasErrors()) { | |
854 for (Entry<String, List<Integer>> err : | |
855 violation.getErrors().entrySet()) { | |
856 for (Integer code : err.getValue()) { | |
857 currentErrors.add( | |
858 new ReportItem("validation", err.getKey(), code)); | |
859 } | |
860 } | |
861 return null; | |
862 } | |
863 | |
840 ortFactory.transformCoordinates(ort); | 864 ortFactory.transformCoordinates(ort); |
841 if (hasKoord && !hasGem) { | 865 if (hasKoord && !hasGem) { |
842 logger.debug("find Verwaltungseinheit"); | 866 logger.debug("find Verwaltungseinheit"); |
843 ortFactory.findVerwaltungseinheit(ort); | 867 ortFactory.findVerwaltungseinheit(ort); |
844 } | 868 } |