[PATCH 2 of 6] (issue1353) Add method to model to gauge by number and river name
Wald Commits
scm-commit at wald.intevation.org
Thu Aug 15 16:51:14 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1376575074 -7200
# Node ID a895eb07a7dc8c8b47a7386b1c28388d22862650
# Parent 9da2298ae38081336bfb890841272099ee06f9a1
(issue1353) Add method to model to gauge by number and river name
diff -r 9da2298ae380 -r a895eb07a7dc backend/src/main/java/org/dive4elements/river/model/Gauge.java
--- 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) {
More information about the Dive4elements-commits
mailing list