[PATCH 02 of 17] Parse and import model_uuid for rivers

Wald Commits scm-commit at wald.intevation.org
Thu Feb 27 16:47:48 CET 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1393508790 -3600
# Node ID 24408bce2fdb43db9a0ba5924ac4f40076689c9e
# Parent  6ff574778491240ebdac8c21822e97e7776e35ea
Parse and import model_uuid for rivers.

diff -r 6ff574778491 -r 24408bce2fdb backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Thu Feb 27 14:45:22 2014 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Thu Feb 27 14:46:30 2014 +0100
@@ -131,6 +131,8 @@
 
     protected String name;
 
+    protected String modelUuid;
+
     protected Long officialNumber;
 
     protected File wstFile;
@@ -295,12 +297,14 @@
 
     public ImportRiver(
         String               name,
+        String               modelUuid,
         File                 wstFile,
         File                 bbInfoFile,
         AnnotationClassifier annotationClassifier
     ) {
         this();
         this.name                 = name;
+        this.modelUuid            = modelUuid;
         this.wstFile              = wstFile;
         this.bbInfoFile           = bbInfoFile;
         this.annotationClassifier = annotationClassifier;
@@ -314,6 +318,14 @@
         this.name = name;
     }
 
+    public String getModelUuid() {
+        return modelUuid;
+    }
+
+    public void setModelUuid(String modelUuid) {
+        this.modelUuid = modelUuid;
+    }
+
     public Long getOfficialNumber() {
         return this.officialNumber;
     }
@@ -1582,7 +1594,7 @@
             List<River> rivers = query.list();
             if (rivers.isEmpty()) {
                 log.info("Store new river '" + name + "'");
-                peer = new River(name, u);
+                peer = new River(name, u, modelUuid);
                 if (!Config.INSTANCE.skipBWASTR()) {
                     peer.setOfficialNumber(officialNumber);
                 }
diff -r 6ff574778491 -r 24408bce2fdb backend/src/main/java/org/dive4elements/river/importer/parsers/InfoGewParser.java
--- 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));


More information about the Dive4elements-commits mailing list