comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFactory.java @ 3897:bce2dd4310a6

MINFO: Updated data fields to fit the needs of bedheight difference calculation. flys-artifacts/trunk@5560 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 21 Sep 2012 14:18:16 +0000
parents 633fbb61a0cc
children 58bdf95df5e4
comparison
equal deleted inserted replaced
3896:82109cea32d2 3897:bce2dd4310a6
20 /** Private logger to use here. */ 20 /** Private logger to use here. */
21 private static Logger log = Logger.getLogger(BedHeightFactory.class); 21 private static Logger log = Logger.getLogger(BedHeightFactory.class);
22 22
23 /** Query to get km and ws for wst_id and column_pos. */ 23 /** Query to get km and ws for wst_id and column_pos. */
24 public static final String SQL_SELECT_SINGLE = 24 public static final String SQL_SELECT_SINGLE =
25 "SELECT height, station, data_gap, sounding_width, year " + 25 "SELECT bhsv.height, bhsv.station, bhsv.data_gap, bhsv.sounding_width, bhs.year " +
26 " FROM bed_height_single_values " + 26 " FROM bed_height_single bhs" +
27 " WHERE id = :height_id"; 27 " JOIN bed_height_single_values bhsv on bhsv.bed_height_single_id = bhs.id" +
28 " WHERE bhs.id = :height_id";
28 29
29 /** Query to get name for wst_id and column_pos. */ 30 /** Query to get name for wst_id and column_pos. */
30 public static final String SQL_SELECT_EPOCH = 31 public static final String SQL_SELECT_EPOCH =
31 "SELECT b.height, b.station, ti.start_time, ti.stop_time" + 32 "SELECT bv.height, bv.station, ti.start_time, ti.stop_time" +
32 " FROM bed_height_epoch_values b" + 33 " FROM bed_height_epoch b" +
33 " JOIN time_interval ti ON b.time_interval_id = ti.id" + 34 " JOIN bed_height_epoch_values bv ON b.id = bv.bed_height_epoch_id" +
34 " WHERE id = :height_id"; 35 " JOIN time_intervals ti ON b.time_interval_id = ti.id" +
36 " WHERE b.id = :height_id";
35 37
36 /** Query to get name (description) for wst_id. */ 38 /** Query to get name (description) for wst_id. */
37 public static final String SQL_SELECT_DESCR_SINGLE = 39 public static final String SQL_SELECT_DESCR_SINGLE =
38 "SELECT description FROM bed_height_single "+ 40 "SELECT description FROM bed_height_single "+
39 "WHERE id = :height_id"; 41 "WHERE id = :height_id";
136 .addScalar("sounding_width", StandardBasicTypes.DOUBLE) 138 .addScalar("sounding_width", StandardBasicTypes.DOUBLE)
137 .addScalar("year", StandardBasicTypes.INTEGER); 139 .addScalar("year", StandardBasicTypes.INTEGER);
138 sqlQuery.setInteger("height_id", height_id); 140 sqlQuery.setInteger("height_id", height_id);
139 List<Object []> results = sqlQuery.list(); 141 List<Object []> results = sqlQuery.list();
140 142
141 for (int i = 0; i <= results.size(); i++) { 143 for (int i = 0; i < results.size(); i++) {
142 Object[] row = results.get(i); 144 Object[] row = results.get(i);
145 log.debug("got station: " + (Double)row[1]);
143 height.add( 146 height.add(
144 (Double) row[0], 147 (Double) row[0],
145 (Double) row[1], 148 (Double) row[1],
146 (Double) row[2], 149 (Double) row[2],
147 (Double) row[3], 150 (Double) row[3],
158 .addScalar("start_time", StandardBasicTypes.DATE) 161 .addScalar("start_time", StandardBasicTypes.DATE)
159 .addScalar("stop_time", StandardBasicTypes.DATE); 162 .addScalar("stop_time", StandardBasicTypes.DATE);
160 sqlQuery.setInteger("height_id", height_id); 163 sqlQuery.setInteger("height_id", height_id);
161 List<Object []> results = sqlQuery.list(); 164 List<Object []> results = sqlQuery.list();
162 165
163 for (int i = 0; i <= results.size(); i++) { 166 for (int i = 0; i < results.size(); i++) {
164 Object[] row = results.get(i); 167 Object[] row = results.get(i);
165 height.add( 168 height.add(
166 (Double) row[0], 169 (Double) row[0],
167 (Double) row[1], 170 (Double) row[1],
168 0,
169 0,
170 (Date) row[2], 171 (Date) row[2],
171 (Date)row[3]); 172 (Date)row[3]);
172 } 173 }
173 return height; 174 return height;
174 } 175 }

http://dive4elements.wald.intevation.org