[Dive4elements-commits] [PATCH 1 of 3] Backend: Joined official lines with there importer model

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


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1371226342 -7200
# Node ID 0f7e9a4f1c5af8d8a4b4d1bfcc5fff3b719c66d8
# Parent  bc28de00e4234b9440265831a149d8196593a982
Backend: Joined official lines with there importer model.

diff -r bc28de00e423 -r 0f7e9a4f1c5a backend/src/main/java/org/dive4elements/river/importer/ImportOfficialWstColumn.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportOfficialWstColumn.java	Fri Jun 14 17:56:52 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportOfficialWstColumn.java	Fri Jun 14 18:12:22 2013 +0200
@@ -19,6 +19,8 @@
             }
         };
 
+    protected ImportOfficialLine officialLine;
+
     public ImportOfficialWstColumn() {
         super();
     }
@@ -31,5 +33,13 @@
     ) {
         super(wst, name, description, position);
     }
+
+    public ImportOfficialLine getOfficialLine() {
+        return officialLine;
+    }
+
+    public void setOfficialLine(ImportOfficialLine officialLine) {
+        this.officialLine = officialLine;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r bc28de00e423 -r 0f7e9a4f1c5a backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Jun 14 17:56:52 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Jun 14 18:12:22 2013 +0200
@@ -46,6 +46,7 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -816,7 +817,15 @@
                     log.warn("config file for offical lines contains no entries");
                 }
                 else {
-                    // TODO: Join against main values.
+                    // Join as much as possible.
+                    Iterator<ImportWstColumn> wi = iw.getColumns().iterator();
+                    Iterator<String> si = olcp.getMainValueNames().iterator();
+                    while (wi.hasNext() && si.hasNext()) {
+                        ImportOfficialWstColumn wc = (ImportOfficialWstColumn)wi.next();
+                        String name = si.next();
+                        ImportOfficialLine iol = new ImportOfficialLine(name, wc);
+                        wc.setOfficialLine(iol);
+                    }
                 }
             }
 


More information about the Dive4elements-commits mailing list