285 | | public static String getCollectionText(String collection, String site_name, String lang, String key) { |
286 | | return getCollectionTextWithDOMMulti(collection, site_name, lang, key); |
287 | | } |
288 | | // xslt didn't like calling the function with Node varargs, so have this hack for now |
289 | | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1) { |
290 | | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1); |
291 | | } |
292 | | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2) { |
293 | | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2); |
294 | | } |
295 | | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2, Node n3) { |
296 | | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2, n3); |
297 | | } |
298 | | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2, Node n3, Node n4) { |
299 | | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2, n3, n4); |
300 | | } |
301 | | public static String getCollectionTextWithDOMMulti(String collection, String site_name, String lang, String key, Node ... nodes) { |
302 | | |
303 | | int num_nodes = nodes.length; |
304 | | String [] args = null; |
305 | | if (num_nodes != 0) { |
306 | | args = new String[num_nodes]; |
307 | | |
308 | | for (int i=0; i<num_nodes; i++) { |
309 | | |
310 | | String node_str = XMLConverter.getString(nodes[i]); |
311 | | args[i] = node_str; |
312 | | } |
313 | | } |
314 | | CollectionClassLoader class_loader = new CollectionClassLoader(XSLTUtil.class.getClassLoader(), GSFile.siteHome(GlobalProperties.getGSDL3Home(), site_name), collection); |
315 | | Dictionary dict = new Dictionary(collection, lang, class_loader); |
316 | | String result = dict.get(key, args); |
317 | | if (result != null) { |
318 | | return result; |
319 | | } |
320 | | return "text:"+collection+":"+key; |
321 | | |
322 | | } |
323 | | |
| 283 | public static String getCollectionText(String collection, String site_name, String lang, String key) |
| 284 | { |
| 285 | return getCollectionTextWithDOMMulti(collection, site_name, lang, key); |
| 286 | } |
| 287 | |
| 288 | // xslt didn't like calling the function with Node varargs, so have this hack for now |
| 289 | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1) |
| 290 | { |
| 291 | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1); |
| 292 | } |
| 293 | |
| 294 | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2) |
| 295 | { |
| 296 | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2); |
| 297 | } |
| 298 | |
| 299 | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2, Node n3) |
| 300 | { |
| 301 | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2, n3); |
| 302 | } |
| 303 | |
| 304 | public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2, Node n3, Node n4) |
| 305 | { |
| 306 | return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2, n3, n4); |
| 307 | } |
| 308 | |
| 309 | public static String getCollectionTextWithDOMMulti(String collection, String site_name, String lang, String key, Node... nodes) |
| 310 | { |
| 311 | int num_nodes = nodes.length; |
| 312 | String[] args = null; |
| 313 | if (num_nodes != 0) |
| 314 | { |
| 315 | args = new String[num_nodes]; |
| 316 | |
| 317 | for (int i = 0; i < num_nodes; i++) |
| 318 | { |
| 319 | |
| 320 | String node_str = XMLConverter.getString(nodes[i]); |
| 321 | args[i] = node_str; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | CollectionClassLoader class_loader = new CollectionClassLoader(XSLTUtil.class.getClassLoader(), GSFile.siteHome(GlobalProperties.getGSDL3Home(), site_name), collection); |
| 326 | Dictionary dict = new Dictionary(collection, lang, class_loader); |
| 327 | String result = dict.get(key, args); |
| 328 | if (result != null) |
| 329 | { |
| 330 | return result; |
| 331 | } |
| 332 | return "text:" + collection + ":" + key; |
| 333 | |
| 334 | } |