changeset 8684:2e11fc7f5d35

(issue1796) Use seddb name of a river when accessing the seddb
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 13 Apr 2015 11:26:44 +0200
parents cfafe5764509
children 5b755d21c425
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/SQOverview.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedOverview.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadOverview.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/QualityMeasurementFactory.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/MeasurementFactory.java
diffstat 5 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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) {
--- 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) {
--- 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) {
--- 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);
--- 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);
     }

http://dive4elements.wald.intevation.org