Mercurial > dive4elements > river
changeset 6287:8d9e9b1ded7d
Waterl.Diff.Parser issue1354: Extract years from name, to later set timeintervals.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 12 Jun 2013 11:20:36 +0200 |
parents | b47ab6a21425 |
children | f40d236098c1 |
files | backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java Wed Jun 12 11:18:47 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java Wed Jun 12 11:20:36 2013 +0200 @@ -40,6 +40,9 @@ public static final Pattern META_UNIT = Pattern.compile("^Einheit: \\[(.*)\\].*"); + public static final Pattern YEARS_IN_COLUMN = + Pattern.compile(".*(\\d{4})-(\\d{4})$"); + /** List of parsed differences as ImportWst s. */ private List<ImportWst> differences; @@ -163,6 +166,16 @@ log.debug("Create new column '" + name + "'"); current.getColumn(i).setName(name); current.getColumn(i).setDescription(name); + + Matcher m = YEARS_IN_COLUMN.matcher(name); + + if (m.matches()) { + String startYear = m.group(1); + String endYear = m.group(2); + // TODO create and set ImportTimeInterval + } else { + log.debug("No time interval in column header found: " + name); + } } }