changeset 1892:eef657302834

Added function to get name/description of Wst. flys-artifacts/trunk@3252 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 15 Nov 2011 14:32:42 +0000
parents 99ca3b686dd1
children 1cf36ffe69b5
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java
diffstat 2 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Nov 15 14:17:41 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Nov 15 14:32:42 2011 +0000
@@ -1,3 +1,13 @@
+2011-11-15  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java:
+	  (getWKmsName): New function. Get name (description) of a WST.
+
+2011-11-15  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/WQFacet.java:
+	  New facet (W over Qs).
+
 2011-11-15  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java	Tue Nov 15 14:17:41 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java	Tue Nov 15 14:32:42 2011 +0000
@@ -38,6 +38,11 @@
         "FROM wst_columns "+
         "WHERE wst_id = :wst_id AND position = :column_pos";
 
+    /** Query to get name (description) for wst_id. */
+    public static final String SQL_SELECT_WST_NAME =
+        "SELECT description from wsts "+
+        "WHERE wst_id = :wst_id";
+
 
     private WKmsFactory() {
     }
@@ -74,6 +79,24 @@
         return values;
     }
 
+    /** Get name for a WKms. */
+    public static String getWKmsName(int column, int wst_id) {
+        log.debug("WKmsFactory.getWKmsName wst_id/" + wst_id);
+
+        String name = null;
+        Session session = SessionHolder.HOLDER.get();
+
+        SQLQuery nameQuery = session.createSQLQuery(SQL_SELECT_NAME)
+            .addScalar("name", StandardBasicTypes.STRING);
+        nameQuery.setInteger("wst_id",     wst_id);
+
+        List<String> names = nameQuery.list();
+        if (names.size() >= 1) {
+            name = names.get(0);
+        }
+
+        return name;
+    }
 
     /** Get name for a WKms. */
     public static String getWKmsName(int column, int wst_id) {

http://dive4elements.wald.intevation.org