comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java @ 8554:3a0522f1a532

Morphological width imported and stored with heights is redundant to table morphologic_width.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 16 Feb 2015 09:00:08 +0100
parents 76113b975829
children 078b07a94023
comparison
equal deleted inserted replaced
8553:17c476e90c07 8554:3a0522f1a532
28 /** Private log to use here. */ 28 /** Private log to use here. */
29 private static Logger log = Logger.getLogger(BedHeightFactory.class); 29 private static Logger log = Logger.getLogger(BedHeightFactory.class);
30 30
31 /** Query to get km and ws for wst_id and column_pos. */ 31 /** Query to get km and ws for wst_id and column_pos. */
32 public static final String SQL_SELECT_SINGLE = 32 public static final String SQL_SELECT_SINGLE =
33 "SELECT bhsv.height, bhsv.station, bhsv.data_gap, bhsv.sounding_width," + 33 "SELECT bhsv.height, bhsv.station, bhsv.data_gap," +
34 " bhs.year, bhsv.width" + 34 " bhsv.sounding_width, bhs.year" +
35 " FROM bed_height_single bhs" + 35 " FROM bed_height_single bhs" +
36 " JOIN bed_height_single_values bhsv on bhsv.bed_height_single_id = bhs.id"; 36 " JOIN bed_height_single_values bhsv on bhsv.bed_height_single_id = bhs.id";
37 37
38 public static final String ID_CLAUSE = 38 public static final String ID_CLAUSE =
39 " WHERE bhs.id = :height_id" + 39 " WHERE bhs.id = :height_id" +
155 sqlQuery = session.createSQLQuery(queryString) 155 sqlQuery = session.createSQLQuery(queryString)
156 .addScalar("height", StandardBasicTypes.DOUBLE) 156 .addScalar("height", StandardBasicTypes.DOUBLE)
157 .addScalar("station", StandardBasicTypes.DOUBLE) 157 .addScalar("station", StandardBasicTypes.DOUBLE)
158 .addScalar("data_gap", StandardBasicTypes.DOUBLE) 158 .addScalar("data_gap", StandardBasicTypes.DOUBLE)
159 .addScalar("sounding_width", StandardBasicTypes.DOUBLE) 159 .addScalar("sounding_width", StandardBasicTypes.DOUBLE)
160 .addScalar("width", StandardBasicTypes.DOUBLE)
161 .addScalar("year", StandardBasicTypes.INTEGER); 160 .addScalar("year", StandardBasicTypes.INTEGER);
162 sqlQuery.setInteger("height_id", height_id); 161 sqlQuery.setInteger("height_id", height_id);
163 if (!Double.isNaN(from) && !Double.isNaN(to)) { 162 if (!Double.isNaN(from) && !Double.isNaN(to)) {
164 sqlQuery.setDouble("fromkm", from); 163 sqlQuery.setDouble("fromkm", from);
165 sqlQuery.setDouble("tokm", to); 164 sqlQuery.setDouble("tokm", to);
170 log.debug("got station: " + (Double)row[1]); 169 log.debug("got station: " + (Double)row[1]);
171 Double row0 = row[0] != null ? (Double)row[0] : Double.NaN; 170 Double row0 = row[0] != null ? (Double)row[0] : Double.NaN;
172 Double row1 = row[1] != null ? (Double)row[1] : Double.NaN; 171 Double row1 = row[1] != null ? (Double)row[1] : Double.NaN;
173 Double row2 = row[2] != null ? (Double)row[2] : Double.NaN; 172 Double row2 = row[2] != null ? (Double)row[2] : Double.NaN;
174 Double row3 = row[3] != null ? (Double)row[3] : Double.NaN; 173 Double row3 = row[3] != null ? (Double)row[3] : Double.NaN;
175 Double row4 = row[4] != null ? (Double)row[4] : Double.NaN; 174 height.add(row0, row1, row2, row3, (Integer) row[4]);
176 height.add(row0, row1, row2, row3, row4, (Integer) row[5]);
177 } 175 }
178 return height; 176 return height;
179 } 177 }
180 return new BedHeightData(); 178 return new BedHeightData();
181 } 179 }

http://dive4elements.wald.intevation.org