changeset 6337:224d7c4b5291

Backend: Create ImportWsts for official lines expicitly. They are going to be somewhat special. Removed some cruft from the WstParser.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 14 Jun 2013 16:11:49 +0200
parents c4fbd85a33ee
children aef238fdd9b6
files backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
diffstat 2 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Jun 14 13:25:23 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Jun 14 16:11:49 2013 +0200
@@ -792,9 +792,10 @@
             }
             log.debug("Found WST file: " + file);
 
-            WstParser wstParser = new WstParser();
+            ImportWst iw = new ImportWst();
+
+            WstParser wstParser = new WstParser(iw);
             wstParser.parse(file);
-            ImportWst iw = wstParser.getWst();
             iw.setKind(3);
             iw.setDescription(folder + "/" + iw.getDescription());
 
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 14 13:25:23 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 14 16:11:49 2013 +0200
@@ -69,6 +69,10 @@
     public WstParser() {
     }
 
+    public WstParser(ImportWst wst) {
+        this.wst = wst;
+    }
+
     public ImportWst getWst() {
         return wst;
     }
@@ -95,13 +99,11 @@
 
         wst = new ImportWst(file.getName());
 
-        LineNumberReader in = null;
+        LineNumberReader in =
+            new LineNumberReader(
+            new InputStreamReader(
+            new FileInputStream(file), ENCODING));
         try {
-            in =
-                new LineNumberReader(
-                new InputStreamReader(
-                new FileInputStream(file), ENCODING));
-
             String input;
             boolean first = true;
             int columnCount = 0;
@@ -109,7 +111,7 @@
             String [] lsBezeichner   = null;
             String [] langBezeichner = null;
             int    [] colNaWidths    = null;
-            String [] quellen        = null;
+            // String [] quellen        = null;
             String [] daten          = null;
 
             BigDecimal [] aktAbfluesse   = null;
@@ -213,7 +215,7 @@
                         if (spezial.length() == 0) {
                             continue;
                         }
-                        quellen = StringUtil.splitQuoted(spezial, '"');
+                        // quellen = StringUtil.splitQuoted(spezial, '"');
                     }
                     else if (spezial.startsWith(COLUMN_DATUM)) {
                         spezial = spezial.substring(COLUMN_DATUM.length()).trim();
@@ -356,9 +358,7 @@
             fixRangesOrder();
         }
         finally {
-            if (in != null) {
-                in.close();
-            }
+            in.close();
         }
     }
 

http://dive4elements.wald.intevation.org