Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WKmsFactory.java @ 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 | ae6ace900c07 |
children | 1cf36ffe69b5 |
comparison
equal
deleted
inserted
replaced
1891:99ca3b686dd1 | 1892:eef657302834 |
---|---|
36 public static final String SQL_SELECT_NAME = | 36 public static final String SQL_SELECT_NAME = |
37 "SELECT name " + | 37 "SELECT name " + |
38 "FROM wst_columns "+ | 38 "FROM wst_columns "+ |
39 "WHERE wst_id = :wst_id AND position = :column_pos"; | 39 "WHERE wst_id = :wst_id AND position = :column_pos"; |
40 | 40 |
41 /** Query to get name (description) for wst_id. */ | |
42 public static final String SQL_SELECT_WST_NAME = | |
43 "SELECT description from wsts "+ | |
44 "WHERE wst_id = :wst_id"; | |
45 | |
41 | 46 |
42 private WKmsFactory() { | 47 private WKmsFactory() { |
43 } | 48 } |
44 | 49 |
45 | 50 |
72 cache.put(element); | 77 cache.put(element); |
73 } | 78 } |
74 return values; | 79 return values; |
75 } | 80 } |
76 | 81 |
82 /** Get name for a WKms. */ | |
83 public static String getWKmsName(int column, int wst_id) { | |
84 log.debug("WKmsFactory.getWKmsName wst_id/" + wst_id); | |
85 | |
86 String name = null; | |
87 Session session = SessionHolder.HOLDER.get(); | |
88 | |
89 SQLQuery nameQuery = session.createSQLQuery(SQL_SELECT_NAME) | |
90 .addScalar("name", StandardBasicTypes.STRING); | |
91 nameQuery.setInteger("wst_id", wst_id); | |
92 | |
93 List<String> names = nameQuery.list(); | |
94 if (names.size() >= 1) { | |
95 name = names.get(0); | |
96 } | |
97 | |
98 return name; | |
99 } | |
77 | 100 |
78 /** Get name for a WKms. */ | 101 /** Get name for a WKms. */ |
79 public static String getWKmsName(int column, int wst_id) { | 102 public static String getWKmsName(int column, int wst_id) { |
80 log.debug("WKmsFactory.getWKmsName c/" + column + ", wst_id/" + wst_id); | 103 log.debug("WKmsFactory.getWKmsName c/" + column + ", wst_id/" + wst_id); |
81 | 104 |