[PATCH] Bundu/Bzws: Error message for missing channel/year, Nachtrag Pos. 20: import of two levels of infrastructure types
Wald Commits
scm-commit at wald.intevation.org
Mon Nov 11 16:30:06 CET 2019
# HG changeset patch
# User mschaefer
# Date 1573486176 -3600
# Mon Nov 11 16:29:36 2019 +0100
# Node ID ac41551a8e4d82d10981ef32c50f02016da3a9b7
# Parent a03c541298190dd202a5b3892b95811afd5f4f99
Bundu/Bzws: Error message for missing channel/year, Nachtrag Pos. 20: import of two levels of infrastructure types
diff -r a03c54129819 -r ac41551a8e4d artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/ChannelFinder.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/ChannelFinder.java Thu Oct 31 15:24:23 2019 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/ChannelFinder.java Mon Nov 11 16:29:36 2019 +0100
@@ -80,7 +80,7 @@
if (channel != null)
return new ChannelFinder(problems, channel);
- problems.addProblem("channelfinder.empty");
+ problems.addProblem("bundu.channelfinder.empty");
return null;
}
diff -r a03c54129819 -r ac41551a8e4d backend/src/main/java/org/dive4elements/river/importer/sinfo/SInfoImporter.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/SInfoImporter.java Thu Oct 31 15:24:23 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/SInfoImporter.java Mon Nov 11 16:29:36 2019 +0100
@@ -50,11 +50,11 @@
INFRASTRUCTURE("Infrastrukturen_BWaStr"), //
CHANNEL("Zu_gewaehrleistende_Fahrrinnenverhaeltnisse"), //
COLLISION_EINZEL("Grundberuehrungen" + File.separator + "Einzeljahre"), //
- TKH_NATUR("Transportkoerperhoehen" + File.separator + "Naturmessungen"), //
- TKH_BERECHNUNG("Transportkoerperhoehen" + File.separator + "Berechnungsergebnisse"), //
+ TKH_NATUR("Transportkoerperhoehen" + File.separator + TkhParser.GroupDirectory.MEASUREMENT.getDirName()), //
+ TKH_BERECHNUNG("Transportkoerperhoehen" + File.separator + TkhParser.GroupDirectory.CALCULATION.getDirName()), //
FLOW_DEPTH("Modellierte_Datensaetze" + File.separator + "Fliesstiefen"), //
- DEPTH_EVOLUTION_AKTUELL("Fliesstiefenentwicklung" + File.separator + "Bezug_aktueller_GlW"), //
- DEPTH_EVOLUTION_ETAPPEN("Fliesstiefenentwicklung" + File.separator + "GlW-Etappen");
+ DEPTH_EVOLUTION_AKTUELL("Fliesstiefenentwicklung" + File.separator + DepthEvolutionParser.GroupDirectory.AKTUELL.getDirName()), //
+ DEPTH_EVOLUTION_ETAPPEN("Fliesstiefenentwicklung" + File.separator + DepthEvolutionParser.GroupDirectory.ETAPPE.getDirName());
private final String dirname;
diff -r a03c54129819 -r ac41551a8e4d backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/DepthEvolutionParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/DepthEvolutionParser.java Thu Oct 31 15:24:23 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/DepthEvolutionParser.java Mon Nov 11 16:29:36 2019 +0100
@@ -50,10 +50,10 @@
private static final Pattern META_OLD_WSP = Pattern.compile("^#\\sHistorische Wasserspiegellage:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE);
- private enum GroupDirectory {
+ public enum GroupDirectory {
NONE(DepthEvolution.Group.NONE, ""), //
- AKTUELL(DepthEvolution.Group.AKTUELL, "Bezug_aktueller_GLW"), //
- ETAPPE(DepthEvolution.Group.ETAPPE, "GLW-Etappen");
+ AKTUELL(DepthEvolution.Group.AKTUELL, "Bezug_aktueller_GlW"), //
+ ETAPPE(DepthEvolution.Group.ETAPPE, "GlW-Etappen");
private final DepthEvolution.Group group;
private final String dirname;
diff -r a03c54129819 -r ac41551a8e4d 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 Thu Oct 31 15:24:23 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/InfrastructureParser.java Mon Nov 11 16:29:36 2019 +0100
@@ -41,7 +41,9 @@
private static final Logger log = Logger.getLogger(InfrastructureParser.class);
- private static final Pattern META_TYPE = Pattern.compile("^#\\sInfrastruktur:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE);
+ private static final Pattern META_GROUP = Pattern.compile("^#\\sInfrastruktur:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE);
+
+ private static final Pattern META_TYPE = Pattern.compile("^#\\sTyp\\/Bezeichnung:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE);
private static final Pattern META_PROVIDER = Pattern.compile("^#\\sDatenherkunft:\\s*([^;]*).*", Pattern.CASE_INSENSITIVE);
@@ -116,7 +118,9 @@
@Override
protected boolean handleMetaOther() {
- if (handleMetaType())
+ if (handleMetaGroup())
+ return true;
+ else if (handleMetaType())
return true;
else if (handleMetaProvider())
return true;
@@ -128,6 +132,25 @@
return false;
}
+ private boolean handleMetaGroup() {
+ final Matcher m = META_GROUP.matcher(this.currentLine);
+ if (m.matches()) {
+ this.metaPatternsMatched.add(META_GROUP);
+ if (this.river.getAnnotationClassifier() != null) {
+ final ImportAnnotationType group = this.river.getAnnotationClassifier().classifyDescription(m.group(1).trim(),
+ this.river.getAnnotationClassifier().getDefaultType());
+ this.seriesHeader.setGroup(group);
+ log.info(String.format("Group name in file: '%s', will be assigned to database name '%s'", m.group(1).trim(), group.getName()));
+ }
+ else {
+ log.error("No annotation types file configured, cannot process group '" + m.group(1).trim() + "'");
+ this.headerParsingState = ParsingState.STOP;
+ }
+ return true;
+ }
+ return false;
+ }
+
private boolean handleMetaType() {
final Matcher m = META_TYPE.matcher(this.currentLine);
if (m.matches()) {
diff -r a03c54129819 -r ac41551a8e4d backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhParser.java Thu Oct 31 15:24:23 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhParser.java Mon Nov 11 16:29:36 2019 +0100
@@ -57,7 +57,7 @@
private static final Pattern COLUMN_TITLE = Pattern.compile("Transportk((.)|(oe))rperh((.)|(oe))he\\s*\\((.+?)\\)\\s*\\[cm\\].*", Pattern.CASE_INSENSITIVE);
- private enum GroupDirectory {
+ public enum GroupDirectory {
NONE(Tkh.Group.NONE, ""), //
CALCULATION(Tkh.Group.CALCULATION, "Berechnungsergebnisse"), //
MEASUREMENT(Tkh.Group.MEASUREMENT, "Naturmessungen");
More information about the Dive4Elements-commits
mailing list