Mercurial > lada > lada-server
changeset 1178:047a27138af6
Fixed validation workflow in laf importer.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 16 Nov 2016 15:59:24 +0100 |
parents | 312aaa5d069d |
children | 612107caf961 |
files | src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java |
diffstat | 1 files changed, 8 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java Wed Nov 16 15:58:30 2016 +0100 +++ b/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java Wed Nov 16 15:59:24 2016 +0100 @@ -153,18 +153,8 @@ Probe old = (Probe)probeIdentifier.getExisting(); // Matching probe was found in the db. Update it! if(i == Identified.UPDATE) { - Violation violation = probeValidator.validate(probe); - 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)); - } - } - } - else { - merger.merge(old, probe); - newProbe = old; - } + merger.merge(old, probe); + newProbe = old; } // Probe was found but some data does not match else if(i == Identified.REJECT){ @@ -185,14 +175,7 @@ // It is a brand new probe! else if(i == Identified.NEW){ Violation violation = probeValidator.validate(probe); - 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)); - } - } - } - else { + if (!violation.hasErrors()) { Response created = repository.create(probe, "land"); newProbe = ((Probe)created.getData()); } @@ -257,6 +240,11 @@ } } Violation violation = probeValidator.validate(newProbe); + for (Entry<String, List<Integer>> err : violation.getErrors().entrySet()) { + for (Integer code : err.getValue()) { + currentErrors.add(new ReportItem("validation", err.getKey(), code)); + } + } for (Entry<String, List<Integer>> warn : violation.getWarnings().entrySet()) { for (Integer code : warn.getValue()) { currentWarnings.add(new ReportItem("validation", warn.getKey(), code));