Skip to content

Commit

Permalink
Rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
solth committed Oct 7, 2024
1 parent 265b488 commit 5512191
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ public String getMetadataEntryLabel(String metadataEntryKey, String groupKey) {
public String getGroupDisplayLabel(MetadataGroup metadataGroup) {
try {
Collection<String> 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 "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,19 @@ public static List<Metadata> getGroupsSortedByGroupDisplayLabel(HashSet<Metadata
throws IOException {
Collection<String> 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<String> keys) {
public String getAnyNestedMetadataValue(Metadata metadata, Collection<String> keys) {
for (String groupDisplayLabelKey : keys) {
String[] keySegments = groupDisplayLabelKey.split("@");
String metadataValue = getNestedMetadataValue(metadata, Arrays.asList(keySegments).subList(1, keySegments.length));
Expand Down

0 comments on commit 5512191

Please sign in to comment.