diff backend/src/main/java/org/dive4elements/river/model/sinfo/Infrastructure.java @ 9176:1614cb14308f

Work on calculations for S-Info flood duration workflow
author mschaefer
date Mon, 25 Jun 2018 19:21:11 +0200
parents a165cd63099f
children d889ffe2fb05
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/sinfo/Infrastructure.java	Mon Jun 25 17:58:11 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/sinfo/Infrastructure.java	Mon Jun 25 19:21:11 2018 +0200
@@ -199,4 +199,18 @@
         query.setParameter("id", id);
         return (Infrastructure) query.list().get(0);
     }
+
+    /**
+     * Get first data series of a river
+     */
+    public static Infrastructure getSeries(final River river) {
+        final Session session = SessionHolder.HOLDER.get();
+        final Query query = session.createQuery("FROM Infrastructure WHERE (river=:river)");
+        query.setParameter("river", river);
+        final List rows = query.list();
+        if (!rows.isEmpty())
+            return (Infrastructure) rows.get(0);
+        else
+            return null;
+    }
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org