From 43a57af1d6c4cc834a337b934603c3449845fe6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Tue, 22 Oct 2024 13:17:04 +0200 Subject: [PATCH] XSL utility / Add function to retrieve thesaurus URI RDF based schema plugins may need the URI of vocabularies in a number of places. This utility is used in the DCAT-AP plugin when building concept elements in thesaurus-transformation.xsl: eg. ``` public public ``` --- core/src/main/java/org/fao/geonet/util/XslUtil.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/fao/geonet/util/XslUtil.java b/core/src/main/java/org/fao/geonet/util/XslUtil.java index 34b9ae272ee..c6e5ca26576 100644 --- a/core/src/main/java/org/fao/geonet/util/XslUtil.java +++ b/core/src/main/java/org/fao/geonet/util/XslUtil.java @@ -1440,7 +1440,7 @@ public static String getThesaurusIdByTitle(String title) { return thesaurus == null ? "" : "geonetwork.thesaurus." + thesaurus.getKey(); } - + /** * Retrieve the thesaurus title using the thesaurus key. * @@ -1455,6 +1455,15 @@ public static String getThesaurusTitleByKey(String id) { } + public static String getThesaurusUriByKey(String id) { + ApplicationContext applicationContext = ApplicationContextHolder.get(); + ThesaurusManager thesaurusManager = applicationContext.getBean(ThesaurusManager.class); + Thesaurus thesaurus = thesaurusManager.getThesaurusByName(id); + return thesaurus == null ? "" : thesaurus.getDefaultNamespace(); + } + + + /** * Utility method to retrieve the name (label) for an iso language using it's code for a specific language. *

@@ -1594,7 +1603,7 @@ private static List buildRecordLink(List hits, String type) { public static String escapeForJson(String value) { return StringEscapeUtils.escapeJson(value); } - + public static String getWebAnalyticsService() { ApplicationContext applicationContext = ApplicationContextHolder.get(); WebAnalyticsConfiguration webAnalyticsConfiguration = applicationContext.getBean(WebAnalyticsConfiguration.class);