Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/DepthEvolutionParser.java @ 9032:1f63e9d3b0ec
New columns for bed_height, tkh and depth_evolution, a few syntactic corrections for Oracle
author | mschaefer |
---|---|
date | Fri, 27 Apr 2018 17:35:12 +0200 |
parents | ae76f618d990 |
children | ac41551a8e4d |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/DepthEvolutionParser.java Fri Apr 27 11:34:04 2018 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/DepthEvolutionParser.java Fri Apr 27 17:35:12 2018 +0200 @@ -50,6 +50,36 @@ private static final Pattern META_OLD_WSP = Pattern.compile("^#\\sHistorische Wasserspiegellage:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE); + private enum GroupDirectory { + NONE(DepthEvolution.Group.NONE, ""), // + AKTUELL(DepthEvolution.Group.AKTUELL, "Bezug_aktueller_GLW"), // + ETAPPE(DepthEvolution.Group.ETAPPE, "GLW-Etappen"); + + private final DepthEvolution.Group group; + private final String dirname; + + GroupDirectory(final DepthEvolution.Group group, final String dirname) { + this.group = group; + this.dirname = dirname; + } + + public DepthEvolution.Group getGroup() { + return this.group; + } + + public String getDirName() { + return this.dirname; + } + + public static GroupDirectory forDirName(final String dirname) { + for (final GroupDirectory gd : GroupDirectory.values()) { + if (dirname.equalsIgnoreCase(gd.getDirName())) + return gd; + } + return NONE; + } + } + /***** CONSTRUCTORS *****/ @@ -178,7 +208,9 @@ @Override protected DepthEvolutionSeriesImport createSeriesImport(final String filename) { - return new DepthEvolutionSeriesImport(filename); + final DepthEvolutionSeriesImport series = new DepthEvolutionSeriesImport(filename); + series.setGroup(GroupDirectory.forDirName(this.importPath.getParentFile().getName()).getGroup()); + return series; } @Override