changeset 7371:6baaa700eada

Add getModelDescription to FlowVelocityModel.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 17 Oct 2013 08:29:46 +0200
parents 4eccd72595ee
children 495cde925702
files backend/src/main/java/org/dive4elements/river/model/FlowVelocityModel.java
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/FlowVelocityModel.java	Thu Oct 17 07:48:51 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/FlowVelocityModel.java	Thu Oct 17 08:29:46 2013 +0200
@@ -37,7 +37,6 @@
 {
     private static Logger logger = Logger.getLogger(FlowVelocityModel.class);
 
-
     private Integer id;
 
     private DischargeZone dischargeZone;
@@ -111,6 +110,8 @@
         return query.list();
     }
 
+
+    /** Get a Model by id. */
     public static FlowVelocityModel getModel(int id) {
 
         Session session = SessionHolder.HOLDER.get();
@@ -122,5 +123,21 @@
 
         return (FlowVelocityModel) query.list().get(0);
     }
+
+
+    /** Get description of a Model by id. */
+    public static String getModelDescription(int id) {
+
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from FlowVelocityModel where id=:id");
+
+        query.setParameter("id", id);
+
+        FlowVelocityModel model = (FlowVelocityModel) query.list().get(0);
+
+        return (model == null) ? null : model.getDescription();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org