changeset 5402:1564ca2cb224

Add getBuildings method that filters by kind
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 25 Mar 2013 15:00:25 +0100 (2013-03-25)
parents ff11b178f152
children e1cd77ddcbc4
files flys-backend/src/main/java/de/intevation/flys/model/Building.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/Building.java	Mon Mar 25 12:19:40 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Building.java	Mon Mar 25 15:00:25 2013 +0100
@@ -79,6 +79,16 @@
         this.geom = geom;
     }
 
+    public static List<Building> getBuildings(int riverId, int kindId) {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from Building where river.id =:river_id and kind_id=:kind_id");
+        query.setParameter("kind_id", kindId);
+        query.setParameter("river_id", riverId);
+
+        return query.list();
+    }
 
     public static List<Building> getBuildings(int riverId, String name) {
         Session session = SessionHolder.HOLDER.get();

http://dive4elements.wald.intevation.org