comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFactory.java @ 4434:60c728e557f4

Backed out changeset e8a4d2fd25cc
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 07 Nov 2012 12:28:50 +0100
parents 41738deb2b43
children a5e4fae31089
comparison
equal deleted inserted replaced
4432:e8a4d2fd25cc 4434:60c728e557f4
25 private static Logger log = Logger.getLogger(SedimentLoadFactory.class); 25 private static Logger log = Logger.getLogger(SedimentLoadFactory.class);
26 26
27 public static final String LOADS_CACHE_NAME = "sedimentloads"; 27 public static final String LOADS_CACHE_NAME = "sedimentloads";
28 public static final String LOAD_DATA_CACHE_NAME = "sedimentload-data"; 28 public static final String LOAD_DATA_CACHE_NAME = "sedimentload-data";
29 29
30 /** Query to get description and start year, given name and a km range. */ 30 /** Query to get km and ws for wst_id and column_pos. */
31 public static final String SQL_SELECT_SINGLES = 31 public static final String SQL_SELECT_SINGLES =
32 "SELECT DISTINCT " + 32 "SELECT DISTINCT " +
33 " sy.description AS description, " + 33 " sy.description AS description, " +
34 " ti.start_time AS year " + 34 " ti.start_time AS year " +
35 " FROM sediment_yield sy " + 35 " FROM sediment_yield sy " +
38 " JOIN time_intervals ti ON sy.time_interval_id = ti.id " + 38 " JOIN time_intervals ti ON sy.time_interval_id = ti.id " +
39 " WHERE r.name = :name " + 39 " WHERE r.name = :name " +
40 " AND ti.stop_time IS NULL " + 40 " AND ti.stop_time IS NULL " +
41 " AND syv.station BETWEEN :startKm AND :endKm"; 41 " AND syv.station BETWEEN :startKm AND :endKm";
42 42
43 /** Query to get start time, stop time and description. */ 43 /** Query to get name for wst_id and column_pos. */
44 public static final String SQL_SELECT_EPOCHS = 44 public static final String SQL_SELECT_EPOCHS =
45 "SELECT DISTINCT " + 45 "SELECT DISTINCT " +
46 " sy.description AS description, " + 46 " sy.description AS description, " +
47 " ti.start_time AS start, " + 47 " ti.start_time AS start, " +
48 " ti.stop_time AS end " + 48 " ti.stop_time AS end " +
90 " AND syv.station BETWEEN :startKm AND :endKm"; 90 " AND syv.station BETWEEN :startKm AND :endKm";
91 91
92 private SedimentLoadFactory() { 92 private SedimentLoadFactory() {
93 } 93 }
94 94
95 95 /**
96 *
97 */
96 public static SedimentLoad[] getLoads( 98 public static SedimentLoad[] getLoads(
97 String river, 99 String river,
98 String type, 100 String type,
99 double startKm, 101 double startKm,
100 double endKm 102 double endKm
274 sqlQuery.setDate("end", end.getTime()); 276 sqlQuery.setDate("end", end.getTime());
275 sqlQuery.setString("grain", "total"); 277 sqlQuery.setString("grain", "total");
276 List<Object []> results = sqlQuery.list(); 278 List<Object []> results = sqlQuery.list();
277 SedimentLoad load = new SedimentLoad(); 279 SedimentLoad load = new SedimentLoad();
278 Object[] row = results.get(0); 280 Object[] row = results.get(0);
279 // TODO Handle empty result.
280 load = new SedimentLoad( 281 load = new SedimentLoad(
281 (String) row[0], 282 (String) row[0],
282 (Date) row[1], 283 (Date) row[1],
283 null, 284 null,
284 false); 285 false);
371 load.setSuspSandBed(km, v); 372 load.setSuspSandBed(km, v);
372 } 373 }
373 } 374 }
374 } 375 }
375 } 376 }
376 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org