comparison 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
comparison
equal deleted inserted replaced
9031:efd2de78d158 9032:1f63e9d3b0ec
48 48
49 private static final Pattern META_CURR_WSP = Pattern.compile("^#\\sAktuelle Wasserspiegellage:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE); 49 private static final Pattern META_CURR_WSP = Pattern.compile("^#\\sAktuelle Wasserspiegellage:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE);
50 50
51 private static final Pattern META_OLD_WSP = Pattern.compile("^#\\sHistorische Wasserspiegellage:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE); 51 private static final Pattern META_OLD_WSP = Pattern.compile("^#\\sHistorische Wasserspiegellage:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE);
52 52
53 private enum GroupDirectory {
54 NONE(DepthEvolution.Group.NONE, ""), //
55 AKTUELL(DepthEvolution.Group.AKTUELL, "Bezug_aktueller_GLW"), //
56 ETAPPE(DepthEvolution.Group.ETAPPE, "GLW-Etappen");
57
58 private final DepthEvolution.Group group;
59 private final String dirname;
60
61 GroupDirectory(final DepthEvolution.Group group, final String dirname) {
62 this.group = group;
63 this.dirname = dirname;
64 }
65
66 public DepthEvolution.Group getGroup() {
67 return this.group;
68 }
69
70 public String getDirName() {
71 return this.dirname;
72 }
73
74 public static GroupDirectory forDirName(final String dirname) {
75 for (final GroupDirectory gd : GroupDirectory.values()) {
76 if (dirname.equalsIgnoreCase(gd.getDirName()))
77 return gd;
78 }
79 return NONE;
80 }
81 }
82
53 83
54 /***** CONSTRUCTORS *****/ 84 /***** CONSTRUCTORS *****/
55 85
56 public DepthEvolutionParser(final File importPath, final File rootRelativePath, final ImportRiver river) { 86 public DepthEvolutionParser(final File importPath, final File rootRelativePath, final ImportRiver river) {
57 super(importPath, rootRelativePath, river); 87 super(importPath, rootRelativePath, river);
176 return false; 206 return false;
177 } 207 }
178 208
179 @Override 209 @Override
180 protected DepthEvolutionSeriesImport createSeriesImport(final String filename) { 210 protected DepthEvolutionSeriesImport createSeriesImport(final String filename) {
181 return new DepthEvolutionSeriesImport(filename); 211 final DepthEvolutionSeriesImport series = new DepthEvolutionSeriesImport(filename);
212 series.setGroup(GroupDirectory.forDirName(this.importPath.getParentFile().getName()).getGroup());
213 return series;
182 } 214 }
183 215
184 @Override 216 @Override
185 protected DepthEvolutionKmLineImport createKmLineImport(final Double km, final String[] values) { 217 protected DepthEvolutionKmLineImport createKmLineImport(final Double km, final String[] values) {
186 if (parseDoubleWithNull(values[1]) == null) { 218 if (parseDoubleWithNull(values[1]) == null) {

http://dive4elements.wald.intevation.org