[PATCH 3 of 3] (issue1796) Use seddb name of a river when accessing the seddb

Wald Commits scm-commit at wald.intevation.org
Mon Apr 13 11:27:37 CEST 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1428917204 -7200
# Node ID 2e11fc7f5d35df35aad9402b693fa80afe845d3e
# Parent  cfafe5764509f0c1757e20df98f81b4dc6df6115
(issue1796) Use seddb name of a river when accessing the seddb

diff -r cfafe5764509 -r 2e11fc7f5d35 artifacts/src/main/java/org/dive4elements/river/artifacts/model/SQOverview.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/SQOverview.java	Mon Apr 13 11:24:32 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/SQOverview.java	Mon Apr 13 11:26:44 2015 +0200
@@ -27,6 +27,7 @@
 import org.w3c.dom.Element;
 
 import org.dive4elements.river.utils.KMIndex;
+import org.dive4elements.river.artifacts.model.RiverFactory;
 
 public class SQOverview
 implements   Serializable
@@ -117,7 +118,7 @@
 
     public SQOverview(String riverName) {
         this();
-        this.riverName = riverName;
+        this.riverName = RiverFactory.getRiver(riverName).nameForSeddb();
     }
 
     private static final boolean epsilonEquals(double a, double b) {
diff -r cfafe5764509 -r 2e11fc7f5d35 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedOverview.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedOverview.java	Mon Apr 13 11:24:32 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedOverview.java	Mon Apr 13 11:26:44 2015 +0200
@@ -22,6 +22,7 @@
 import org.w3c.dom.Element;
 
 import org.dive4elements.river.utils.KMIndex;
+import org.dive4elements.river.artifacts.model.RiverFactory;
 
 public class BedOverview
 implements Serializable
@@ -109,7 +110,7 @@
 
     public BedOverview(String riverName) {
         this();
-        this.riverName = riverName;
+        this.riverName = RiverFactory.getRiver(riverName).nameForSeddb();
     }
 
     private static final boolean epsilonEquals(double a, double b) {
diff -r cfafe5764509 -r 2e11fc7f5d35 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadOverview.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadOverview.java	Mon Apr 13 11:24:32 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadOverview.java	Mon Apr 13 11:26:44 2015 +0200
@@ -22,6 +22,7 @@
 import org.w3c.dom.Element;
 
 import org.dive4elements.river.utils.KMIndex;
+import org.dive4elements.river.artifacts.model.RiverFactory;
 
 public class BedloadOverview implements Serializable {
 
@@ -108,7 +109,7 @@
 
     public BedloadOverview(String riverName) {
         this();
-        this.riverName = riverName;
+        this.riverName = RiverFactory.getRiver(riverName).nameForSeddb();
     }
 
     private static final boolean epsilonEquals(double a, double b) {
diff -r cfafe5764509 -r 2e11fc7f5d35 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/QualityMeasurementFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/QualityMeasurementFactory.java	Mon Apr 13 11:24:32 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/QualityMeasurementFactory.java	Mon Apr 13 11:26:44 2015 +0200
@@ -19,6 +19,7 @@
 import org.hibernate.type.StandardBasicTypes;
 
 import org.dive4elements.river.backend.SedDBSessionHolder;
+import org.dive4elements.river.artifacts.model.RiverFactory;
 
 
 public class QualityMeasurementFactory {
@@ -166,8 +167,9 @@
             query.addScalar("depth1", StandardBasicTypes.DOUBLE);
             query.addScalar("depth2", StandardBasicTypes.DOUBLE);
         }
+        String seddbRiver = RiverFactory.getRiver(river).nameForSeddb();
 
-        query.setString("name", river);
+        query.setString("name", seddbRiver);
         query.setDouble("from", from);
         query.setDouble("to", to);
         query.setDate("start", start);
diff -r cfafe5764509 -r 2e11fc7f5d35 artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/MeasurementFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/MeasurementFactory.java	Mon Apr 13 11:24:32 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/MeasurementFactory.java	Mon Apr 13 11:26:44 2015 +0200
@@ -32,6 +32,7 @@
 import org.dive4elements.river.artifacts.model.DateRange;
 
 import org.dive4elements.river.backend.SedDBSessionHolder;
+import org.dive4elements.river.artifacts.model.RiverFactory;
 
 import au.com.bytecode.opencsv.CSVWriter;
 
@@ -258,11 +259,13 @@
         SQ.Factory sqFactory
     ) {
         Session session = SedDBSessionHolder.HOLDER.get();
+        String seddbRiver = RiverFactory.getRiver(river).nameForSeddb();
+
         List<Measurement> totals = loadTotals(
-            session, river, location, dateRange);
+            session, seddbRiver, location, dateRange);
 
         List<Measurement> accumulated = loadFractions(
-            session, river, location, dateRange);
+            session, seddbRiver, location, dateRange);
 
         return new Measurements(totals, accumulated, sqFactory);
     }


More information about the Dive4Elements-commits mailing list