changeset 3330:d42249d91f47

Added missing 'name' property and a new function to retrieve CrossSectionTracks. flys-backend/trunk@4654 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 14 Jun 2012 07:56:26 +0000
parents cc8fc6b29649
children b2aac19a8982
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Wed Jun 13 08:12:00 2012 +0000
+++ b/flys-backend/ChangeLog	Thu Jun 14 07:56:26 2012 +0000
@@ -1,3 +1,9 @@
+2012-06-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/CrossSectionTrack.java: Added the
+	  missing 'name' property and added a function that returns all
+	  CrossSectionTracks of a specific river with a specific name.
+
 2012-06-13  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/schema/oracle-minfo.sql,
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java	Wed Jun 13 08:12:00 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java	Thu Jun 14 07:56:26 2012 +0000
@@ -27,6 +27,7 @@
 {
     private Integer    id;
     private River      river;
+    private String     name;
     private LineString geom;
     private BigDecimal km;
     private BigDecimal z;
@@ -59,6 +60,17 @@
     }
 
 
+    @Column(name = "name")
+    public String getName() {
+        return name;
+    }
+
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
     @Column(name = "geom")
     @Type(type = "org.hibernatespatial.GeometryUserType")
     public LineString getGeom() {
@@ -106,6 +118,23 @@
     }
 
 
+    public static List<CrossSectionTrack> getCrossSectionTrack(
+        String river,
+        String name
+    ) {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from CrossSectionTrack as cst " +
+            "    where river.name =:river" +
+            "      and cst.name=:name");
+        query.setParameter("river", river);
+        query.setParameter("name", name);
+
+        return query.list();
+    }
+
+
     /**
      * Returns the nearest CrossSectionTrack of <i>river</i> to a given
      * <i>km</i>.

http://dive4elements.wald.intevation.org