Class LayerBuilder
java.lang.Object
io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
io.goobi.viewer.model.iiif.presentation.v2.builder.LayerBuilder
Builds IIIF Presentation API v2 Layer resources aggregating annotation lists across canvases.
- Author:
- Florian Alpers
-
Field Summary
Fields inherited from class io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
config, REQUIRED_SOLR_FIELDS, urls -
Constructor Summary
ConstructorsConstructorDescriptionLayerBuilder(AbstractApiUrlManager apiUrlManager) Creates a new LayerBuilder instance. -
Method Summary
Modifier and TypeMethodDescriptionde.intranda.api.annotation.oa.OpenAnnotationcreateAnnotation(URI annotationId, URI linkURI, de.intranda.api.iiif.presentation.enums.Format format, de.intranda.api.iiif.presentation.enums.DcType dcType, de.intranda.api.iiif.presentation.enums.AnnotationType annoType, String motivation) createAnnotation.de.intranda.api.iiif.presentation.v2.LayercreateAnnotationLayer(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type, String motivation, BiFunction<String, String, List<Path>> fileGetter, BiFunction<String, String, URI> linkGetter) createAnnotationLayer.de.intranda.api.iiif.presentation.v2.AnnotationListcreateAnnotationList(List<de.intranda.api.annotation.IAnnotation> annotations, URI id, de.intranda.api.iiif.presentation.enums.AnnotationType type) createAnnotationList.de.intranda.api.iiif.presentation.v2.LayergenerateLayer(String pi, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annoLists, de.intranda.api.iiif.presentation.enums.AnnotationType annoType) generateLayer.Map<de.intranda.api.iiif.presentation.enums.AnnotationType, de.intranda.api.iiif.presentation.v2.AnnotationList> mergeAnnotationLists(String pi, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annoLists) mergeAnnotationLists.Methods inherited from class io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
absolutize, absolutize, addCrowdourcingAnnotations, addEventMetadataToWorkElement, addLanguageFields, addMetadata, addRendering, addSeeAlso, contained, getAnnotationListURI, getAnnotationListURI, getAnnotationURI, getAnnotationURI, getAttributions, getAutoCompleteServiceURI, getAutoSuggestURI, getCanvasURI, getCollectionURI, getCommentAnnotationURI, getDescription, getDocument, getDocumentWithChildren, getEventFields, getExternalManifestURI, getImageAnnotationURI, getLabel, getLabel, getLabelIfExists, getLayerURI, getLidoResolverUrl, getLocale, getManifestURI, getManifestURI, getMetsResolverUrl, getPageManifestURI, getPageOrderFromCanvasURI, getPIFromCanvasURI, getRangeURI, getRenderings, getSearchServiceURI, getSearchURI, getSeeAlsos, getSequenceURI, getSolrFieldList, getViewUrl
-
Constructor Details
-
LayerBuilder
Creates a new LayerBuilder instance.- Parameters:
apiUrlManager- API URL manager for building IIIF resource URLs
-
-
Method Details
-
createAnnotationLayer
public de.intranda.api.iiif.presentation.v2.Layer createAnnotationLayer(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type, String motivation, BiFunction<String, String, throws PresentationException, IndexUnreachableException, IOException, URISyntaxExceptionList<Path>> fileGetter, BiFunction<String, String, URI> linkGetter) createAnnotationLayer.- Parameters:
pi- persistent identifier of the recordtype- annotation type determining format and labelmotivation- OA motivation string for each annotationfileGetter- function resolving PI and repository to file pathslinkGetter- function resolving PI and language to resource URI- Returns:
- the IIIF Layer containing annotation lists for all available language files
- Throws:
PresentationException- if any.IndexUnreachableException- if any.IOException- if any.URISyntaxException- if any.
-
createAnnotation
public de.intranda.api.annotation.oa.OpenAnnotation createAnnotation(URI annotationId, URI linkURI, de.intranda.api.iiif.presentation.enums.Format format, de.intranda.api.iiif.presentation.enums.DcType dcType, de.intranda.api.iiif.presentation.enums.AnnotationType annoType, String motivation) createAnnotation.- Parameters:
annotationId- URI identifying the annotationlinkURI- URI of the linked content resourceformat- MIME format of the linked contentdcType- Dublin Core type label for the contentannoType- annotation type used to set the labelmotivation- OA motivation string; defaults to painting if null- Returns:
- the OpenAnnotation linking the given content resource with the specified motivation
-
createAnnotationList
public de.intranda.api.iiif.presentation.v2.AnnotationList createAnnotationList(List<de.intranda.api.annotation.IAnnotation> annotations, URI id, de.intranda.api.iiif.presentation.enums.AnnotationType type) createAnnotationList.- Parameters:
annotations- annotations to add as resourcesid- URI identifying the annotation listtype- annotation type used to set the list label- Returns:
- the AnnotationList containing all given annotations with the type-derived label
-
generateLayer
public de.intranda.api.iiif.presentation.v2.Layer generateLayer(String pi, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annoLists, de.intranda.api.iiif.presentation.enums.AnnotationType annoType) throws URISyntaxExceptiongenerateLayer.- Parameters:
pi- persistent identifier of the recordannoLists- map of annotation lists grouped by typeannoType- annotation type selecting which list to include- Returns:
- the IIIF Layer for the given annotation type, containing the matching annotation lists
- Throws:
URISyntaxException- if any.
-
mergeAnnotationLists
public Map<de.intranda.api.iiif.presentation.enums.AnnotationType,de.intranda.api.iiif.presentation.v2.AnnotationList> mergeAnnotationLists(String pi, Map<de.intranda.api.iiif.presentation.enums.AnnotationType, List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annoLists) throws URISyntaxExceptionmergeAnnotationLists.- Parameters:
pi- persistent identifier used to build annotation list URIsannoLists- per-type lists of annotation lists to merge- Returns:
- a map of annotation type to merged annotation list containing all resources from the per-type lists
- Throws:
URISyntaxException- if any.
-