Skip to content

Commit

Permalink
Merge pull request #808 from felleskatalogen/autoloaded-bundle-titles
Browse files Browse the repository at this point in the history
When autoloading document Bundles, read title from Composition
  • Loading branch information
grahamegrieve authored Nov 24, 2023
2 parents e70a932 + a480c00 commit 93bdf81
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4784,7 +4784,16 @@ private boolean load() throws Exception {
rg.setName(r.getElement().getExtensionValue(ToolingExtensions.EXT_ARTIFACT_NAME).primitiveValue());
} else if (!rg.hasName()) {
if (r.getElement().hasChild("title")) {
rg.setName(r.getElement().getChildValue("title"));
rg.setName(r.getElement().getChildValue("title"));
} else if ("Bundle".equals(r.getElement().getName())) {
// If the resource is a document Bundle, get the title from the Composition
List<Element> entryList = r.getElement().getChildren("entry");
if (entryList != null && !entryList.isEmpty()) {
Element resource = entryList.get(0).getNamedChild("resource");
if (resource != null) {
rg.setName(resource.getChildValue("title") + " (Bundle)");
}
}
}
}
if (r.getElement().hasExtension(ToolingExtensions.EXT_RESOURCE_DESC)) {
Expand Down

0 comments on commit 93bdf81

Please sign in to comment.