[Dive4elements-commits] [PATCH 4 of 9] Add crosssection track accessors that filter by kind and by kind and name

Wald Commits scm-commit at wald.intevation.org
Wed Mar 27 15:40:10 CET 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1364394388 -3600
# Node ID c8e74e5e828c50bff99f389508fd4fe6db63c76b
# Parent  f2bcf0fb1efdac9533043a539095ee91458eb591
Add crosssection track accessors that filter by kind and by kind and name

diff -r f2bcf0fb1efd -r c8e74e5e828c flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java	Wed Mar 27 11:29:59 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java	Wed Mar 27 15:26:28 2013 +0100
@@ -134,6 +134,41 @@
         return query.list();
     }
 
+    public static List<CrossSectionTrack> getCrossSectionTrack(
+        String river,
+        int kind_id
+    ) {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from CrossSectionTrack as cst " +
+            "    where river.name =:river" +
+            "      and kind_id=:kind_id");
+        query.setParameter("river", river);
+        query.setParameter("kind_id", kind_id);
+
+        return query.list();
+    }
+
+    public static List<CrossSectionTrack> getCrossSectionTrack(
+        String river,
+        String name,
+        int kind_id
+    ) {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from CrossSectionTrack as cst " +
+            "    where river.name =:river" +
+            "      and cst.name=:name" +
+            "      and kind_id=:kind_id");
+        query.setParameter("river", river);
+        query.setParameter("name", name);
+        query.setParameter("kind_id", kind_id);
+
+        return query.list();
+    }
+
 
     /**
      * Returns the nearest CrossSectionTrack of <i>river</i> to a given


More information about the Dive4elements-commits mailing list