diff backend/src/main/java/org/dive4elements/river/importer/ImporterSession.java @ 8692:67e53dbe05d2

(issue1750) Consistently attach parameters of suspended respectively bedload material to measurement station of respective type.
author Tom Gottfried <tom@intevation.de>
date Fri, 17 Apr 2015 15:04:16 +0200
parents 17db08570637
children 32a91eac0bc2
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImporterSession.java	Fri Apr 17 14:55:42 2015 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImporterSession.java	Fri Apr 17 15:04:16 2015 +0200
@@ -206,6 +206,28 @@
         return range;
     }
 
+    public MeasurementStation getMeasurementStation(
+        River river,
+        double station,
+        String measurementType
+    ) {
+        List<MeasurementStation> stations = getMeasurementStations(
+            river, station);
+
+        if (stations != null) {
+            /* Assume there is only one MeasurementStation per type at
+               any station. Should be enforced in database schema. */
+            for (MeasurementStation m: stations) {
+                if (m.getMeasurementType().equals(measurementType)) {
+                    return m;
+                }
+                continue;
+            }
+        }
+
+        return null;
+    }
+
     public List<MeasurementStation> getMeasurementStations(
         River river,
         double station

http://dive4elements.wald.intevation.org