changeset 6345:0f7e9a4f1c5a

Backend: Joined official lines with there importer model.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 14 Jun 2013 18:12:22 +0200
parents bc28de00e423
children b966c67a476d
files backend/src/main/java/org/dive4elements/river/importer/ImportOfficialWstColumn.java backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 :
--- 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);
+                    }
                 }
             }
 

http://dive4elements.wald.intevation.org