Mercurial > dive4elements > river
changeset 756:ca13926b8871
River: Make search for gauges independent of from/to order.
flys-backend/trunk@2011 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 26 May 2011 15:00:04 +0000 |
parents | a29fd0916803 |
children | c19d4c643526 |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/River.java |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Tue May 24 11:12:59 2011 +0000 +++ b/flys-backend/ChangeLog Thu May 26 15:00:04 2011 +0000 @@ -1,3 +1,8 @@ +2011-05-24 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/model/River.java: + Make search for gauges independent of from/to order. + 2011-05-24 Sascha L. Teichmann <sascha.teichmann@intevation.de> * doc/schema/postgresql.sql: Added a new view to select qs of a WST.
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java Tue May 24 11:12:59 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java Thu May 26 15:00:04 2011 +0000 @@ -104,6 +104,8 @@ public List<Gauge> determineGauges(double a, double b) { Session session = SessionHolder.HOLDER.get(); + if (a > b) { double t = a; a = b; b = t; } + Query query = session.createQuery( "from Gauge where river=:river " + "and not (range.a > :b or range.b < :a) order by a"); @@ -127,7 +129,7 @@ public Gauge determineGauge(double a, double b) { List<Gauge> gauges = determineGauges(a, b); - return gauges != null && gauges.size() > 0 ? gauges.get(0) : null; + return gauges.isEmpty() ? null : gauges.get(0); } /**