[PATCH 2 of 2] Merge

Wald Commits scm-commit at wald.intevation.org
Tue Nov 12 09:25:32 CET 2019


# HG changeset patch
# User dnt_bjoernsen <d.tironi at bjoernsen.de>
# Date 1573547047 -3600
#      Tue Nov 12 09:24:07 2019 +0100
# Node ID df668014016e4f717f1a0cc07a9e865cc7981497
# Parent  6c1ebf2220f54e469d45475637e33b3f2dc2336e
# Parent  eb32f75c65c3c24dd9f33f15f35dbe9e963aa18b
Merge

diff -r 6c1ebf2220f5 -r df668014016e 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 17:37:53 2019 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/ChannelFinder.java	Tue Nov 12 09:24:07 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 6c1ebf2220f5 -r df668014016e backend/doc/schema/oracle_migrations/update_nachtrag_20.sql
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/doc/schema/oracle_migrations/update_nachtrag_20.sql	Tue Nov 12 09:24:07 2019 +0100
@@ -0,0 +1,16 @@
+--Neues Feld infrastructure.group_id
+
+SET AUTOCOMMIT ON;
+
+ALTER TABLE infrastructure ADD (group_id NUMBER(38,0));
+
+UPDATE infrastructure SET group_id=annotation_type_id;
+
+ALTER TABLE infrastructure MODIFY (group_id NOT NULL);
+
+ALTER TABLE infrastructure ADD CONSTRAINT cInfrastructureGroupAnnoType
+      FOREIGN KEY (group_id) REFERENCES annotation_types;
+
+COMMENT ON COLUMN infrastructure.group_id IS 'Reference to the infrastructure type group';
+
+COMMIT;
diff -r 6c1ebf2220f5 -r df668014016e 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 17:37:53 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/SInfoImporter.java	Tue Nov 12 09:24:07 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 6c1ebf2220f5 -r df668014016e 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 17:37:53 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/DepthEvolutionParser.java	Tue Nov 12 09:24:07 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 6c1ebf2220f5 -r df668014016e 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 17:37:53 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/InfrastructureParser.java	Tue Nov 12 09:24:07 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 6c1ebf2220f5 -r df668014016e 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 17:37:53 2019 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/sinfo/parsers/TkhParser.java	Tue Nov 12 09:24:07 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