diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java @ 8199:42ac86ec19c7

(issue1448) Add sq time intervals to sediment load data model.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 05 Sep 2014 12:22:42 +0200
parents 8d447516b7dd
children 3bb00338228c
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Fri Sep 05 12:19:13 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Fri Sep 05 12:22:42 2014 +0200
@@ -37,6 +37,9 @@
           "sl.description AS sl_description, " +
           "ti.start_time AS ti_start_time, " +
           "ti.stop_time AS ti_stop_time, " +
+          "sqti.start_time AS sq_start_time, " +
+          "sqti.stop_time AS sq_stop_time, " +
+          "sqti.id AS sq_ti_id, " +
           "slv.value AS slv_value, " +
           "gf.name AS gf_name, " +
           "ms.id AS ms_id, " +
@@ -45,6 +48,7 @@
         "FROM sediment_load_values slv " +
           "JOIN sediment_load sl ON slv.sediment_load_id = sl.id " +
           "JOIN time_intervals ti ON sl.time_interval_id = ti.id " +
+          "JOIN time_intervals sqti ON sl.sq_time_interval_id = sqti.id " +
           "JOIN grain_fraction gf ON sl.grain_fraction_id = gf.id " +
           "JOIN measurement_station ms ON slv.measurement_station_id = ms.id " +
           "JOIN rivers r ON ms.river_id = r.id " +
@@ -107,6 +111,9 @@
             .addScalar("sl_description", StandardBasicTypes.STRING)
             .addScalar("ti_start_time",  StandardBasicTypes.TIMESTAMP)
             .addScalar("ti_stop_time",   StandardBasicTypes.TIMESTAMP)
+            .addScalar("sq_start_time",  StandardBasicTypes.TIMESTAMP)
+            .addScalar("sq_stop_time",   StandardBasicTypes.TIMESTAMP)
+            .addScalar("sq_ti_id",       StandardBasicTypes.INTEGER)
             .addScalar("slv_value",      StandardBasicTypes.DOUBLE)
             .addScalar("gf_name",        StandardBasicTypes.STRING)
             .addScalar("ms_id",          StandardBasicTypes.INTEGER)
@@ -130,16 +137,20 @@
             String    sl_description   = (String)row[2];
             Timestamp ti_start_time    = (Timestamp)row[3];
             Timestamp ti_stop_time     = (Timestamp)row[4];
-            Double    slv_value        = (Double)row[5];
-            String    gf_name          = (String)row[6];
-            Integer   ms_id            = (Integer)row[7];
-            Double    ms_station       = (Double)row[8];
-            String    ms_type          = (String)row[9];
+            Timestamp sq_start_time    = (Timestamp)row[5];
+            Timestamp sq_stop_time     = (Timestamp)row[6];
+            Integer   sq_id            = (Integer)row[7];
+            Double    slv_value        = (Double)row[8];
+            String    gf_name          = (String)row[9];
+            Integer   ms_id            = (Integer)row[10];
+            Double    ms_station       = (Double)row[11];
+            String    ms_type          = (String)row[12];
 
             if (load == null || load.getId() != sl_id) {
                 load = new SedimentLoadData.Load(
                     sl_id, sl_kind, sl_description,
-                    ti_start_time, ti_stop_time);
+                    ti_start_time, ti_stop_time, sq_id,
+                    sq_start_time, sq_stop_time);
 
                 // Grain fractions only change when a new sediment load starts.
                 grainFractionIndex =

http://dive4elements.wald.intevation.org