Omit "iiif" bundle from toc ranges.

This commit is contained in:
Michael Spalti
2022-06-29 13:17:41 -07:00
parent 31f706042f
commit 84375b0499

View File

@@ -48,6 +48,8 @@ public class IIIFUtils {
// The DSpace bundle for other content related to item. // The DSpace bundle for other content related to item.
protected static final String OTHER_CONTENT_BUNDLE = "OtherContent"; protected static final String OTHER_CONTENT_BUNDLE = "OtherContent";
private static final String OMIT_FROM_TOC_BUNDLE = "iiif";
// The canvas position will be appended to this string. // The canvas position will be appended to this string.
private static final String CANVAS_PATH_BASE = "/canvas/c"; private static final String CANVAS_PATH_BASE = "/canvas/c";
@@ -335,12 +337,19 @@ public class IIIFUtils {
public String getBundleIIIFToC(Bundle bundle) { public String getBundleIIIFToC(Bundle bundle) {
String label = bundle.getMetadata().stream() String label = bundle.getMetadata().stream()
.filter(m -> m.getMetadataField().toString('.').contentEquals(METADATA_IIIF_LABEL)) .filter(m -> m.getMetadataField().toString('.').contentEquals(METADATA_IIIF_LABEL))
.findFirst().map(m -> m.getValue()).orElse(bundle.getName()); .findFirst().map(m -> m.getValue()).orElse(getBundleLabel(bundle));
return bundle.getMetadata().stream() return bundle.getMetadata().stream()
.filter(m -> m.getMetadataField().toString('.').contentEquals(METADATA_IIIF_TOC)) .filter(m -> m.getMetadataField().toString('.').contentEquals(METADATA_IIIF_TOC))
.findFirst().map(m -> m.getValue() + TOC_SEPARATOR + label).orElse(label); .findFirst().map(m -> m.getValue() + TOC_SEPARATOR + label).orElse(label);
} }
private String getBundleLabel(Bundle bundle) {
if (bundle.getName().contentEquals(OMIT_FROM_TOC_BUNDLE)) {
return null;
}
return bundle.getName();
}
/** /**
* Return the iiif viewing hint for the item * Return the iiif viewing hint for the item
* *