changeset 9056:ddebd4c2fe93

Corrected station parsing for infrastructure import
author mschaefer
date Fri, 04 May 2018 14:05:21 +0200
parents df5c5614e9a7
children d3bef221b7d9
files backend/src/main/java/org/dive4elements/river/importer/common/AbstractKmLineImport.java backend/src/main/java/org/dive4elements/river/importer/common/AbstractParser.java backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/InfrastructureParser.java
diffstat 3 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/common/AbstractKmLineImport.java	Fri May 04 14:03:47 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/common/AbstractKmLineImport.java	Fri May 04 14:05:21 2018 +0200
@@ -48,6 +48,9 @@
         return this.storeMode;
     }
 
+    public double getStation() {
+        return this.station;
+    }
 
     /**
      * Gets the station value record from the database if existing, or creates a database record from this object and adds
--- a/backend/src/main/java/org/dive4elements/river/importer/common/AbstractParser.java	Fri May 04 14:03:47 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/common/AbstractParser.java	Fri May 04 14:05:21 2018 +0200
@@ -304,6 +304,27 @@
     }
 
     /**
+     * Logs an info message, appending the relative file path
+     */
+    protected void logInfo(final String message) {
+        getLog().info(message + ";" + this.rootRelativePath);
+    }
+
+    /**
+     * Logs a debug message, appending the relative file path
+     */
+    protected void logDebug(final String message) {
+        getLog().debug(message + ";" + this.rootRelativePath);
+    }
+
+    /**
+     * Logs a trace message, appending the relative file path
+     */
+    protected void logTrace(final String message) {
+        getLog().trace(message + ";" + this.rootRelativePath);
+    }
+
+    /**
      * Creates a new series import object
      */
     protected abstract HEADER createSeriesImport(final String filename);
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/InfrastructureParser.java	Fri May 04 14:03:47 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/InfrastructureParser.java	Fri May 04 14:05:21 2018 +0200
@@ -111,7 +111,7 @@
 
     @Override
     protected KmMode kmMode() {
-        return KmMode.NONE;
+        return KmMode.DUPLICATES;
     }
 
     @Override
@@ -205,9 +205,12 @@
             logError("Invalid height value in line " + this.in.getLineNumber());
             return null;
         }
-        if ((this.bankColIndex >= 0) && this.bankAttributes.containsKey(values[this.bankColIndex].trim().toLowerCase()))
-            return new InfrastructureKmLineImport(km, parseDoubleWithNull(values[this.heightColIndex]).doubleValue(),
+        if ((this.bankColIndex >= 0) && this.bankAttributes.containsKey(values[this.bankColIndex].trim().toLowerCase())) {
+            final InfrastructureKmLineImport kmLine = new InfrastructureKmLineImport(km, parseDoubleWithNull(values[this.heightColIndex]).doubleValue(),
                     this.bankAttributes.get(values[this.bankColIndex].trim().toLowerCase()));
+            logTrace("createKmLineImport(" + km.toString() + ") => " + kmLine.getStation());
+            return kmLine;
+        }
         else {
             logError("Invalid bank value in line " + this.in.getLineNumber());
             return null;

http://dive4elements.wald.intevation.org