diff backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java @ 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 0f7e9a4f1c5a
children 0baf7abffcc6
line wrap: on
line diff
--- 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());
+                    }
+                }
             }
         }
     }

http://dive4elements.wald.intevation.org