java.lang.Object
io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
io.goobi.viewer.model.iiif.presentation.v2.builder.LayerBuilder

public class LayerBuilder extends AbstractBuilder
Builds IIIF Presentation API v2 Layer resources aggregating annotation lists across canvases.
Author:
Florian Alpers
  • Constructor Details

    • LayerBuilder

      public LayerBuilder(AbstractApiUrlManager apiUrlManager)
      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,List<Path>> fileGetter, BiFunction<String,String,URI> linkGetter) throws PresentationException, IndexUnreachableException, IOException, URISyntaxException
      createAnnotationLayer.
      Parameters:
      pi - persistent identifier of the record
      type - annotation type determining format and label
      motivation - OA motivation string for each annotation
      fileGetter - function resolving PI and repository to file paths
      linkGetter - 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 annotation
      linkURI - URI of the linked content resource
      format - MIME format of the linked content
      dcType - Dublin Core type label for the content
      annoType - annotation type used to set the label
      motivation - 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 resources
      id - URI identifying the annotation list
      type - 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 URISyntaxException
      generateLayer.
      Parameters:
      pi - persistent identifier of the record
      annoLists - map of annotation lists grouped by type
      annoType - 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 URISyntaxException
      mergeAnnotationLists.
      Parameters:
      pi - persistent identifier used to build annotation list URIs
      annoLists - 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.