changeset 5498:d459a885c51f

Schema change: make sq_relation_value.qmax NOT NULL and more informative messages in parser
author Tom Gottfried <tom.gottfried@intevation.de>
date Thu, 28 Mar 2013 14:02:52 +0100
parents 5d99cd6e146a
children 43bf4976dd24
files flys-backend/doc/schema/oracle-minfo.sql flys-backend/doc/schema/postgresql-minfo.sql flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java
diffstat 3 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle-minfo.sql	Thu Mar 28 13:19:13 2013 +0100
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Thu Mar 28 14:02:52 2013 +0100
@@ -322,7 +322,7 @@
     parameter                VARCHAR(1) NOT NULL,
     a                        NUMBER(38,20) NOT NULL,
     b                        NUMBER(38,20) NOT NULL,
-    qmax                     NUMBER(38,20),
+    qmax                     NUMBER(38,20) NOT NULL,
     rsq                      NUMBER(38,3),
     ntot                     NUMBER(38,0),
     noutl                    NUMBER(38,0),
--- a/flys-backend/doc/schema/postgresql-minfo.sql	Thu Mar 28 13:19:13 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-minfo.sql	Thu Mar 28 14:02:52 2013 +0100
@@ -322,7 +322,7 @@
     parameter              VARCHAR(1) NOT NULL,
     a                      NUMERIC NOT NULL,
     b                      NUMERIC NOT NULL,
-    qmax                   NUMERIC,
+    qmax                   NUMERIC NOT NULL,
     rsq                    NUMERIC,
     ntot                   int,
     noutl                  int,
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java	Thu Mar 28 13:19:13 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java	Thu Mar 28 14:02:52 2013 +0100
@@ -119,10 +119,18 @@
         Integer nOutlier = parseInteger(cols[11], line);
         Double cFer = parseDouble(cols[12], line);
         Double cDuan = parseDouble(cols[13], line);
-        if (km == null || a == null || b == null || cols[1].length() == 0) {
-            log.error("Incomplete SQ-relation row (missing km, a, b or parameter): "
-                + line);
-            return;
+        if (km == null || a == null || b == null || 
+	    qMax == null || cols[1].length() == 0) {
+	    if (km == null) {
+		log.error("No km for measurement station: Can not reference measurement station: "
+		    + line);
+	    }
+	    if ( a == null || b == null || 
+		qMax == null || cols[1].length() == 0) {
+		log.error("Incomplete SQ-relation row (missing a, b, Qmax or parameter): "
+		    + line);
+	    }
+	    return;
         }
         current.addValue(new ImportSQRelationValue(
             cols[1],
@@ -143,7 +151,7 @@
             result = Double.valueOf(value.replace(",", "."));
         }
         catch (NumberFormatException nfe) {
-            log.warn("parsing " + value + " in sq relation row: " + line);
+            log.warn("Unparseable " + value + " in sq relation row: " + line);
         }
         return result;
     }
@@ -154,7 +162,7 @@
             result = Integer.valueOf(value);
         }
         catch (NumberFormatException nfe) {
-            log.warn("parsing " + value + " in sq relation row: " + line);
+            log.warn("Unparseable " + value + " in sq relation row: " + line);
         }
         return result;
     }

http://dive4elements.wald.intevation.org