Mercurial > dive4elements > river
changeset 6838:a895eb07a7dc
(issue1353) Add method to model to gauge by number and river name
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 15 Aug 2013 15:57:54 +0200 |
parents | 9da2298ae380 |
children | fe03337c8011 |
files | backend/src/main/java/org/dive4elements/river/model/Gauge.java |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/Gauge.java Thu Aug 15 15:57:13 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/Gauge.java Thu Aug 15 15:57:54 2013 +0200 @@ -223,7 +223,6 @@ this.mainValues = mainValues; } - public static Gauge getGaugeByOfficialNumber(long number) { Session session = SessionHolder.HOLDER.get(); @@ -237,6 +236,21 @@ return results.isEmpty() ? null : results.get(0); } + public static Gauge getGaugeByOfficialNumber(long number, String river_name) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from Gauge as gau " + + "where gau.officialNumber=:number and gau.river.name=:river_name"); + + query.setParameter("number", number); + query.setParameter("river_name", river_name); + + List<Gauge> results = query.list(); + + return results.isEmpty() ? null : results.get(0); + } + public DischargeTable fetchMasterDischargeTable() { for (DischargeTable dt: dischargeTables) {