diff backend/src/main/java/org/dive4elements/river/importer/parsers/InfoGewParser.java @ 7751:24408bce2fdb

Parse and import model_uuid for rivers.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 27 Feb 2014 14:46:30 +0100
parents 4c3ccf2b0304
children b44c76b6800c
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/InfoGewParser.java	Thu Feb 27 14:45:22 2014 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/InfoGewParser.java	Thu Feb 27 14:46:30 2014 +0100
@@ -44,6 +44,9 @@
     public static final Pattern BB_INFO =
         Pattern.compile("^\\s*B\\+B-Info\\s*:\\s*(.+)");
 
+    public static final Pattern GEW_UUID =
+        Pattern.compile("^\\s*uuid\\s*:\\s*(.+)");
+
     protected ArrayList<ImportRiver> rivers;
 
     protected AnnotationClassifier annotationClassifier;
@@ -81,6 +84,7 @@
             String line = null;
 
             String riverName  = null;
+            String modelUuid  = null;
             File   wstFile    = null;
             File   bbInfoFile = null;
 
@@ -96,11 +100,13 @@
                     if (riverName != null) {
                         rivers.add(new ImportRiver(
                             riverName,
+                            modelUuid,
                             wstFile,
                             bbInfoFile,
                             annotationClassifier));
                     }
                     riverName  = river;
+                    modelUuid  = null;
                     wstFile    = null;
                     bbInfoFile = null;
                 }
@@ -118,6 +124,11 @@
                     }
                     wstFile = wst;
                 }
+                else if ((m = GEW_UUID.matcher(line)).matches()) {
+                    modelUuid = m.group(1);
+                    log.debug("Found model uuid " + modelUuid +
+                        " for river " + riverName);
+                }
                 else if ((m = BB_INFO.matcher(line)).matches()) {
                     //TODO: Make it relative to the wst file.
                     String bbInfo = m.group(1);
@@ -127,6 +138,7 @@
             if (riverName != null) {
                 rivers.add(new ImportRiver(
                     riverName,
+                    modelUuid,
                     wstFile,
                     bbInfoFile,
                     annotationClassifier));

http://dive4elements.wald.intevation.org