comparison 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
comparison
equal deleted inserted replaced
8198:fdec8ab16fa7 8199:42ac86ec19c7
35 "sl.id AS sl_id, " + 35 "sl.id AS sl_id, " +
36 "sl.kind AS sl_kind, " + 36 "sl.kind AS sl_kind, " +
37 "sl.description AS sl_description, " + 37 "sl.description AS sl_description, " +
38 "ti.start_time AS ti_start_time, " + 38 "ti.start_time AS ti_start_time, " +
39 "ti.stop_time AS ti_stop_time, " + 39 "ti.stop_time AS ti_stop_time, " +
40 "sqti.start_time AS sq_start_time, " +
41 "sqti.stop_time AS sq_stop_time, " +
42 "sqti.id AS sq_ti_id, " +
40 "slv.value AS slv_value, " + 43 "slv.value AS slv_value, " +
41 "gf.name AS gf_name, " + 44 "gf.name AS gf_name, " +
42 "ms.id AS ms_id, " + 45 "ms.id AS ms_id, " +
43 "ms.station AS ms_station, " + 46 "ms.station AS ms_station, " +
44 "ms.measurement_type AS ms_type " + 47 "ms.measurement_type AS ms_type " +
45 "FROM sediment_load_values slv " + 48 "FROM sediment_load_values slv " +
46 "JOIN sediment_load sl ON slv.sediment_load_id = sl.id " + 49 "JOIN sediment_load sl ON slv.sediment_load_id = sl.id " +
47 "JOIN time_intervals ti ON sl.time_interval_id = ti.id " + 50 "JOIN time_intervals ti ON sl.time_interval_id = ti.id " +
51 "JOIN time_intervals sqti ON sl.sq_time_interval_id = sqti.id " +
48 "JOIN grain_fraction gf ON sl.grain_fraction_id = gf.id " + 52 "JOIN grain_fraction gf ON sl.grain_fraction_id = gf.id " +
49 "JOIN measurement_station ms ON slv.measurement_station_id = ms.id " + 53 "JOIN measurement_station ms ON slv.measurement_station_id = ms.id " +
50 "JOIN rivers r ON ms.river_id = r.id " + 54 "JOIN rivers r ON ms.river_id = r.id " +
51 "WHERE r.name = :river " + 55 "WHERE r.name = :river " +
52 "ORDER BY sl.id"; 56 "ORDER BY sl.id";
105 .addScalar("sl_id", StandardBasicTypes.INTEGER) 109 .addScalar("sl_id", StandardBasicTypes.INTEGER)
106 .addScalar("sl_kind", StandardBasicTypes.INTEGER) 110 .addScalar("sl_kind", StandardBasicTypes.INTEGER)
107 .addScalar("sl_description", StandardBasicTypes.STRING) 111 .addScalar("sl_description", StandardBasicTypes.STRING)
108 .addScalar("ti_start_time", StandardBasicTypes.TIMESTAMP) 112 .addScalar("ti_start_time", StandardBasicTypes.TIMESTAMP)
109 .addScalar("ti_stop_time", StandardBasicTypes.TIMESTAMP) 113 .addScalar("ti_stop_time", StandardBasicTypes.TIMESTAMP)
114 .addScalar("sq_start_time", StandardBasicTypes.TIMESTAMP)
115 .addScalar("sq_stop_time", StandardBasicTypes.TIMESTAMP)
116 .addScalar("sq_ti_id", StandardBasicTypes.INTEGER)
110 .addScalar("slv_value", StandardBasicTypes.DOUBLE) 117 .addScalar("slv_value", StandardBasicTypes.DOUBLE)
111 .addScalar("gf_name", StandardBasicTypes.STRING) 118 .addScalar("gf_name", StandardBasicTypes.STRING)
112 .addScalar("ms_id", StandardBasicTypes.INTEGER) 119 .addScalar("ms_id", StandardBasicTypes.INTEGER)
113 .addScalar("ms_station", StandardBasicTypes.DOUBLE) 120 .addScalar("ms_station", StandardBasicTypes.DOUBLE)
114 .addScalar("ms_type", StandardBasicTypes.STRING); 121 .addScalar("ms_type", StandardBasicTypes.STRING);
128 Integer sl_id = (Integer)row[0]; 135 Integer sl_id = (Integer)row[0];
129 Integer sl_kind = (Integer)row[1]; 136 Integer sl_kind = (Integer)row[1];
130 String sl_description = (String)row[2]; 137 String sl_description = (String)row[2];
131 Timestamp ti_start_time = (Timestamp)row[3]; 138 Timestamp ti_start_time = (Timestamp)row[3];
132 Timestamp ti_stop_time = (Timestamp)row[4]; 139 Timestamp ti_stop_time = (Timestamp)row[4];
133 Double slv_value = (Double)row[5]; 140 Timestamp sq_start_time = (Timestamp)row[5];
134 String gf_name = (String)row[6]; 141 Timestamp sq_stop_time = (Timestamp)row[6];
135 Integer ms_id = (Integer)row[7]; 142 Integer sq_id = (Integer)row[7];
136 Double ms_station = (Double)row[8]; 143 Double slv_value = (Double)row[8];
137 String ms_type = (String)row[9]; 144 String gf_name = (String)row[9];
145 Integer ms_id = (Integer)row[10];
146 Double ms_station = (Double)row[11];
147 String ms_type = (String)row[12];
138 148
139 if (load == null || load.getId() != sl_id) { 149 if (load == null || load.getId() != sl_id) {
140 load = new SedimentLoadData.Load( 150 load = new SedimentLoadData.Load(
141 sl_id, sl_kind, sl_description, 151 sl_id, sl_kind, sl_description,
142 ti_start_time, ti_stop_time); 152 ti_start_time, ti_stop_time, sq_id,
153 sq_start_time, sq_stop_time);
143 154
144 // Grain fractions only change when a new sediment load starts. 155 // Grain fractions only change when a new sediment load starts.
145 grainFractionIndex = 156 grainFractionIndex =
146 SedimentLoadData.grainFractionIndex(gf_name); 157 SedimentLoadData.grainFractionIndex(gf_name);
147 158

http://dive4elements.wald.intevation.org