Mercurial > dive4elements > river
changeset 6347:75c483450c96
Backend: Store official lines from config if they are any.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 14 Jun 2013 18:25:12 +0200 |
parents | b966c67a476d |
children | 39aaa4e358d2 |
files | backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java |
diffstat | 2 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java Fri Jun 14 18:15:49 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java Fri Jun 14 18:25:12 2013 +0200 @@ -32,6 +32,14 @@ this.wstColumn = wstColumn; } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public OfficialLine getPeer(River river) { if (peer == null) { // XXX: This is a bit odd. We do not have not enough infos here
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java Fri Jun 14 18:15:49 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java Fri Jun 14 18:25:12 2013 +0200 @@ -1257,12 +1257,25 @@ } public void storeOfficialLines() { - if (!Config.INSTANCE.skipOfficialLines()) { - log.info("store official lines wsts"); - River river = getPeer(); - for (ImportWst wst: officialLines) { - log.debug("name: " + wst.getDescription()); - wst.storeDependencies(river); + if (Config.INSTANCE.skipOfficialLines() || officialLines.isEmpty()) { + return; + } + + log.info("store official lines wsts"); + River river = getPeer(); + for (ImportWst wst: officialLines) { + log.debug("name: " + wst.getDescription()); + wst.storeDependencies(river); + + // Store the official lines after the columns are store. + for (ImportWstColumn wc: wst.getColumns()) { + ImportOfficialWstColumn owc = (ImportOfficialWstColumn)wc; + ImportOfficialLine ioc = owc.getOfficialLine(); + if (ioc != null) { + if (ioc.getPeer(river) == null) { + log.warn("Cannot store official line: " + ioc.getName()); + } + } } } }