# HG changeset patch # User Tom Gottfried # Date 1481901619 -3600 # Node ID 75692dc7077f04f10a9c8744518b0c92a523df1d # Parent f094aca05cf205f69f9f2b8138e595f93f19ba8e Make transformed coordinates available for validation. diff -r f094aca05cf2 -r 75692dc7077f src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java --- a/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java Fri Dec 16 16:18:37 2016 +0100 +++ b/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java Fri Dec 16 16:20:19 2016 +0100 @@ -842,6 +842,16 @@ } } + ortFactory.transformCoordinates(ort); + if (hasKoord && !hasGem) { + ortFactory.findVerwaltungseinheit(ort); + } + if (ortFactory.hasErrors()) { + // Add to warnings because Probe object might be imported + currentWarnings.addAll(ortFactory.getErrors()); + return null; + } + Violation violation = ortValidator.validate(ort); for (Entry> warn : violation.getWarnings().entrySet()) { @@ -862,17 +872,6 @@ return null; } - ortFactory.transformCoordinates(ort); - if (hasKoord && !hasGem) { - logger.debug("find Verwaltungseinheit"); - ortFactory.findVerwaltungseinheit(ort); - } - if (ortFactory.hasErrors()) { - // Add to warnings because Probe object might be imported - currentWarnings.addAll(ortFactory.getErrors()); - return null; - } - repository.create(ort, "stamm"); return ort; } diff -r f094aca05cf2 -r 75692dc7077f src/main/java/de/intevation/lada/rest/stamm/OrtService.java --- a/src/main/java/de/intevation/lada/rest/stamm/OrtService.java Fri Dec 16 16:18:37 2016 +0100 +++ b/src/main/java/de/intevation/lada/rest/stamm/OrtService.java Fri Dec 16 16:20:19 2016 +0100 @@ -271,14 +271,6 @@ return new Response(false, 699, ort); } - Violation violation = validator.validate(ort); - if (violation.hasErrors()) { - Response response = new Response(false, 604, ort); - response.setErrors(violation.getErrors()); - response.setWarnings(violation.getWarnings()); - return response; - } - ortFactory.transformCoordinates(ort); if (ortFactory.hasErrors()) { Violation factoryErrs = new Violation(); @@ -289,6 +281,15 @@ response.setErrors(factoryErrs.getErrors()); return response; } + + Violation violation = validator.validate(ort); + if (violation.hasErrors()) { + Response response = new Response(false, 604, ort); + response.setErrors(violation.getErrors()); + response.setWarnings(violation.getWarnings()); + return response; + } + Response response = repository.create(ort, "stamm"); if(violation.hasWarnings()) { response.setWarnings(violation.getWarnings()); @@ -341,14 +342,6 @@ return new Response(false, 699, ort); } - Violation violation = validator.validate(ort); - if (violation.hasErrors()) { - Response response = new Response(false, 604, ort); - response.setErrors(violation.getErrors()); - response.setWarnings(violation.getWarnings()); - return response; - } - ortFactory.transformCoordinates(ort); if (ortFactory.hasErrors()) { Violation factoryErrs = new Violation(); @@ -359,6 +352,15 @@ response.setErrors(factoryErrs.getErrors()); return response; } + + Violation violation = validator.validate(ort); + if (violation.hasErrors()) { + Response response = new Response(false, 604, ort); + response.setErrors(violation.getErrors()); + response.setWarnings(violation.getWarnings()); + return response; + } + Response response = repository.update(ort, "stamm"); if(violation.hasWarnings()) { response.setWarnings(violation.getWarnings());