[Dive4elements-commits] [PATCH 3 of 3] Backend: Store official lines from config if they are any

Wald Commits scm-commit at wald.intevation.org
Fri Jun 14 18:25:24 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1371227112 -7200
# Node ID 75c483450c966514d0669243fd87f22a0c7cd0e0
# Parent  b966c67a476d3390306422963c62da1346f2f12a
Backend: Store official lines from config if they are any.

diff -r b966c67a476d -r 75c483450c96 backend/src/main/java/org/dive4elements/river/importer/ImportOfficialLine.java
--- 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
diff -r b966c67a476d -r 75c483450c96 backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java
--- 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());
+                    }
+                }
             }
         }
     }


More information about the Dive4elements-commits mailing list