Mercurial > dive4elements > river
changeset 8058:fbe3ba5a480e
Sediment load: Fetch kind of sediment load from database to tell if it is official or not.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 18 Jul 2014 17:43:27 +0200 |
parents | 555dc5a9b282 |
children | bde5f5ec7c72 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java |
diffstat | 2 files changed, 27 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java Fri Jul 18 16:05:21 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java Fri Jul 18 17:43:27 2014 +0200 @@ -102,6 +102,7 @@ public static class Load implements Serializable { private int id; + private int kind; private String description; @@ -111,8 +112,15 @@ public Load() { } - public Load(int id, String description, Date startTime, Date stopTime) { + public Load( + int id, + int kind, + String description, + Date startTime, + Date stopTime + ) { this.id = id; + this.kind = kind; this.description = description; this.startTime = startTime; this.stopTime = stopTime; @@ -122,6 +130,10 @@ return id; } + public int getKind() { + return kind; + } + public String getDescription() { return description; }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java Fri Jul 18 16:05:21 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java Fri Jul 18 17:43:27 2014 +0200 @@ -32,6 +32,7 @@ public static final String SQL_LOAD_RIVER_SEDIMENT_LOADS = "SELECT " + "sl.id AS sl_id, " + + "sl.kind AS sl_kind, " + "sl.description AS sl_description, " + "ti.start_time AS ti_start_time, " + "ti.stop_time AS ti_stoptime, " + @@ -45,8 +46,7 @@ "JOIN time_intervals ti ON sl.time_interval_id = ti.id " + "JOIN grain_fraction gf ON sl.grain_fraction_id = gf.id " + "JOIN measurement_station ms ON slv.measurement_station_id = ms.id " + - "JOIN ranges rng ON ms.range_id = rng.id " + - "JOIN rivers r ON rng.river_id = r.id " + + "JOIN rivers r ON ms.river_id = r.id " + "WHERE r.name = :river " + "ORDER BY sl.id"; @@ -102,6 +102,7 @@ SQLQuery sqlQuery = session.createSQLQuery(SQL_LOAD_RIVER_SEDIMENT_LOADS) .addScalar("sl_id", StandardBasicTypes.INTEGER) + .addScalar("sl_kind", StandardBasicTypes.INTEGER) .addScalar("sl_description", StandardBasicTypes.STRING) .addScalar("ti_start_time", StandardBasicTypes.TIMESTAMP) .addScalar("ti_stop_time", StandardBasicTypes.TIMESTAMP) @@ -123,18 +124,20 @@ Object [] row = (Object [])iter.next(); Integer sl_id = (Integer)row[0]; - String sl_description = (String)row[1]; - Timestamp ti_start_time = (Timestamp)row[2]; - Timestamp ti_stop_time = (Timestamp)row[3]; - Double slv_value = (Double)row[4]; - String gf_name = (String)row[5]; - Integer ms_id = (Integer)row[6]; - Double ms_station = (Double)row[7]; - String ms_type = (String)row[8]; + Integer sl_kind = (Integer)row[1]; + 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]; if (load == null || load.getId() != sl_id) { load = new SedimentLoadData.Load( - sl_id, sl_description, ti_start_time, ti_stop_time); + sl_id, sl_kind, sl_description, + ti_start_time, ti_stop_time); // Grain fractions only change when a new sediment load starts. grainFractionIndex =