[PATCH 2 of 2] Corrected station parsing for infrastructure import
Wald Commits
scm-commit at wald.intevation.org
Fri May 4 14:05:49 CEST 2018
# HG changeset patch
# User mschaefer
# Date 1525435521 -7200
# Node ID ddebd4c2fe933495eb2f1b1b0a6e949e930b9c8b
# Parent df5c5614e9a7264e1135fde96959f36f6081c7e6
Corrected station parsing for infrastructure import
diff -r df5c5614e9a7 -r ddebd4c2fe93 backend/src/main/java/org/dive4elements/river/importer/common/AbstractKmLineImport.java
--- 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
diff -r df5c5614e9a7 -r ddebd4c2fe93 backend/src/main/java/org/dive4elements/river/importer/common/AbstractParser.java
--- 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);
diff -r df5c5614e9a7 -r ddebd4c2fe93 backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/InfrastructureParser.java
--- 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;
More information about the Dive4Elements-commits
mailing list