From 551219188968e991b7136b63243eb18698d5f25b Mon Sep 17 00:00:00 2001 From: Arved Solth Date: Mon, 7 Oct 2024 16:04:03 +0200 Subject: [PATCH] Rename method --- .../production/forms/dataeditor/DataEditorForm.java | 2 +- .../kitodo/production/services/data/RulesetService.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java index 2fc0c993021..02e81c465fc 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java @@ -1302,7 +1302,7 @@ public String getMetadataEntryLabel(String metadataEntryKey, String groupKey) { public String getGroupDisplayLabel(MetadataGroup metadataGroup) { try { Collection groupDisplayLabel = ImportService.getGroupDisplayLabelMetadata(process.getRuleset()); - return ServiceManager.getRulesetService().getNestedMetadataValue(metadataGroup, groupDisplayLabel); + return ServiceManager.getRulesetService().getAnyNestedMetadataValue(metadataGroup, groupDisplayLabel); } catch (IOException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); return ""; diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java index ba6c1c129f7..d43c6336f53 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java @@ -291,19 +291,19 @@ public static List getGroupsSortedByGroupDisplayLabel(HashSet groupDisplayLabel = ImportService.getGroupDisplayLabelMetadata(ruleset); return metadataSet.stream().filter(m -> m instanceof MetadataGroup) - .sorted(Comparator.comparing(m -> ServiceManager.getRulesetService().getNestedMetadataValue(m, groupDisplayLabel))) + .sorted(Comparator.comparing(m -> ServiceManager.getRulesetService().getAnyNestedMetadataValue(m, groupDisplayLabel))) .collect(Collectors.toList()); } /** - * Retrieve and return value of functional metadata 'groupDisplayLabel' for given MetadataGroup 'group' from given - * Ruleset 'ruleset'. + * Retrieve and return value of Metadata with any of the given 'keys' from given Ruleset 'ruleset'. If Metadata + * contains no nested metadata with any of the given keys an empty String is returned instead. * * @param metadata Metadata for which value of nested metadata is retrieved * @param keys keys of nested metadata whose value is to be retrieved * @return value found of first nested metadata found, identified by provided keys */ - public String getNestedMetadataValue(Metadata metadata, Collection keys) { + public String getAnyNestedMetadataValue(Metadata metadata, Collection keys) { for (String groupDisplayLabelKey : keys) { String[] keySegments = groupDisplayLabelKey.split("@"); String metadataValue = getNestedMetadataValue(metadata, Arrays.asList(keySegments).subList(1, keySegments.length));