changeset 2381:aa777d1aba38

Added a function Gauge.getGaugeByOfficialNumber() that returns a Gauge based on its official number. flys-backend/trunk@3702 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 18 Jan 2012 09:26:54 +0000
parents e237a08acf6e
children c5791de0c495
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/Gauge.java
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Tue Jan 17 16:56:38 2012 +0000
+++ b/flys-backend/ChangeLog	Wed Jan 18 09:26:54 2012 +0000
@@ -1,3 +1,8 @@
+2012-01-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Gauge.java: Added a function that
+	  returns a Gauge based on its official number.
+
 2012-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/FastCrossSectionLine.java:
--- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Tue Jan 17 16:56:38 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Wed Jan 18 09:26:54 2012 +0000
@@ -213,6 +213,20 @@
 
     public void setMainValues(List<MainValue> mainValues) {
         this.mainValues = mainValues;
-    } 
+    }
+
+
+    public static Gauge getGaugeByOfficialNumber(long number) {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from Gauge where officialNumber=:number");
+
+        query.setParameter("number", number);
+
+        List<Gauge> results = query.list();
+
+        return results.isEmpty() ? null : results.get(0);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org