Mercurial > dive4elements > river
changeset 767:5572d051347e
River: Added method to find gauge by its name.
flys-backend/trunk@2197 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 22 Jun 2011 08:56:09 +0000 (2011-06-22) |
parents | aa9e3da95c31 |
children | 87ac543c7ab9 |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/River.java |
diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Sun Jun 19 17:43:38 2011 +0000 +++ b/flys-backend/ChangeLog Wed Jun 22 08:56:09 2011 +0000 @@ -1,3 +1,8 @@ +2011-06-22 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/model/River.java: + Added method to find gauge by its name. + 2011-06-19 Sascha L. Teichmann <sascha.teichmann@intevation.de> * doc/annotation-types.xml: Fixed some rules.
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java Sun Jun 19 17:43:38 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java Wed Jun 22 08:56:09 2011 +0000 @@ -116,6 +116,16 @@ return query.list(); } + public Gauge determineGaugeByName(String name) { + Session session = SessionHolder.HOLDER.get(); + Query query = session.createQuery( + "from Gauge where river=:river and name=:name"); + query.setParameter("river", this); + query.setParameter("name", name); + List<Gauge> gauges = query.list(); + return gauges.isEmpty() ? null : gauges.get(0); + } + public Gauge determineGaugeByPosition(double p) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery(