[Dive4elements-commits] [PATCH 1 of 3] issue1354: TimeIntervals in Waterlevels from csv files
Wald Commits
scm-commit at wald.intevation.org
Thu Jun 13 09:02:59 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1371033403 -7200
# Node ID 550cb41d37d9ab5d0a1f43529b15355d2272f3ab
# Parent bc09f8fff6944ffaae6ebd20a8d0a2e1a6a64f3b
issue1354: TimeIntervals in Waterlevels from csv files.
diff -r bc09f8fff694 -r 550cb41d37d9 backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelParser.java Wed Jun 12 18:21:48 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelParser.java Wed Jun 12 12:36:43 2013 +0200
@@ -20,6 +20,7 @@
import org.apache.log4j.Logger;
+import org.dive4elements.river.importer.ImportTimeInterval;
import org.dive4elements.river.importer.ImportUnit;
import org.dive4elements.river.importer.ImportRange;
@@ -91,6 +92,22 @@
column = current.getColumn(0);
column.setName(currentDescription);
column.setDescription(currentDescription);
+
+ // Try to extract and set the TimeInterval.
+ Matcher m = WaterlevelDifferencesParser.YEARS_IN_COLUMN.matcher(currentDescription);
+
+ if (m.matches()) {
+ int startYear = Integer.parseInt(m.group(1));
+ int endYear = Integer.parseInt(m.group(2));
+ ImportTimeInterval time = new ImportTimeInterval(
+ getStartDateFromYear(startYear),
+ getEndDateFromYear(endYear)
+ );
+ column.setTimeInterval(time);
+ } else {
+ log.debug("No time interval in column header found: " + currentDescription);
+ }
+
current.setKind(7);
}
More information about the Dive4elements-commits
mailing list