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

public class SequenceBuilder extends AbstractBuilder
Builds the Sequence and Canvas resources within a IIIF Presentation API v2 Manifest.
Author:
Florian Alpers
  • Field Details

  • Constructor Details

    • SequenceBuilder

      public SequenceBuilder(AbstractApiUrlManager apiUrlManager)
      Creates a new SequenceBuilder instance.
      Parameters:
      apiUrlManager - API URL manager for building IIIF resource URIs
  • Method Details

    • addBaseSequence

      public Map<de.intranda.api.iiif.presentation.enums.AnnotationType,List<de.intranda.api.iiif.presentation.v2.AnnotationList>> addBaseSequence(de.intranda.api.iiif.presentation.v2.Manifest2 manifest, StructElement doc, String manifestId, List<Integer> pagesToInclude, HttpServletRequest request) throws URISyntaxException, PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException
      Creates a sequence from all pages within the given doc and appends it to manifest.
      Parameters:
      manifest - The manifest to include the sequence. May be null
      doc - structure element of the record whose pages are sequenced
      manifestId - URI string identifying the manifest this sequence belongs to
      pagesToInclude - list of physical page orders to include; empty means all pages
      request - the current HTTP servlet request, used for crowdsourcing annotation lookup
      Returns:
      a map of annotation type to lists of annotation lists collected while building the sequence
      Throws:
      URISyntaxException - if any.
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • addSeeAlsos

      public void addSeeAlsos(de.intranda.api.iiif.presentation.v2.Canvas2 canvas, PhysicalElement page) throws URISyntaxException, ViewerConfigurationException
      addSeeAlsos.
      Parameters:
      canvas - IIIF canvas to attach seeAlso links to
      page - physical page whose file names are used to resolve seeAlso URIs
      Throws:
      URISyntaxException - if any.
      ViewerConfigurationException - if any.
    • addRenderings

      public void addRenderings(PhysicalElement page, de.intranda.api.iiif.presentation.v2.Canvas2 canvas)
      Parameters:
      page - the physical page whose file info is used to resolve rendering URIs
      canvas - the canvas to add rendering links to
    • addComments

      public List<de.intranda.api.iiif.presentation.v2.AnnotationList> addComments(Map<Integer,de.intranda.api.iiif.presentation.v2.Canvas2> canvases, String pi, boolean populate) throws DAOException, URISyntaxException, ViewerConfigurationException
      Adds a comment annotation to all cavases which contain comments.
      Parameters:
      canvases - All canvases which may get comments, mapped by their page order
      pi - The pi of the work containing the pages
      populate - if true, the actual annotations will be included in the resources property
      Returns:
      a map with the list of all annotationlists (one list per page)
      Throws:
      DAOException - if any.
      URISyntaxException - if any.
      ViewerConfigurationException - if any.
    • merge

      public void merge(Map<de.intranda.api.iiif.presentation.enums.AnnotationType,List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annotationMap, Map<de.intranda.api.iiif.presentation.enums.AnnotationType,de.intranda.api.iiif.presentation.v2.AnnotationList> content)
      merge.
      Parameters:
      annotationMap - accumulator map to merge content into
      content - single-canvas annotation map to merge into annotationMap
    • getPage

      getPage.
      Parameters:
      doc - structure element that provides the record context for the loader
      order - physical page order number to retrieve
      Returns:
      the PhysicalElement at the given page order, or null if not found
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
      PresentationException
    • generateCanvas

      public de.intranda.api.iiif.presentation.v2.Canvas2 generateCanvas(String pi, PhysicalElement page) throws URISyntaxException, ViewerConfigurationException, IndexUnreachableException, PresentationException, DAOException
      generateCanvas.
      Parameters:
      pi - Record identifier
      page - physical page to generate the canvas from
      Returns:
      the IIIF Canvas for the given page, or null if pi or page is null
      Throws:
      URISyntaxException - if any.
      ViewerConfigurationException - if any.
      IndexUnreachableException - if any.
      PresentationException - if any.
      DAOException
    • addOtherContent

      public Map<de.intranda.api.iiif.presentation.enums.AnnotationType,de.intranda.api.iiif.presentation.v2.AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, de.intranda.api.iiif.presentation.v2.Canvas2 canvas, boolean populate) throws URISyntaxException, IndexUnreachableException, ViewerConfigurationException
      addOtherContent.
      Parameters:
      doc - structure element providing the record PI for text lookups
      page - physical page whose full-text, audio, and video resources are added
      canvas - IIIF canvas to attach annotation lists to
      populate - if true, annotation bodies are fully resolved; otherwise only list stubs are created
      Returns:
      a map of annotation type to annotation list for all content types found on the given page
      Throws:
      URISyntaxException - if any.
      IndexUnreachableException - if any.
      ViewerConfigurationException - if any.
    • getBuildMode

      public BuildMode getBuildMode()
      Getter for the field buildMode.
      Returns:
      the build mode controlling whether full IIIF or thumbnail-only canvases are built
    • setBuildMode

      public SequenceBuilder setBuildMode(BuildMode buildMode)
      Setter for the field buildMode.
      Parameters:
      buildMode - controls whether full IIIF or thumbnail-only canvases are built
      Returns:
      this SequenceBuilder instance for method chaining
    • getPreferedView

      public PageType getPreferedView()
      Getter for the field preferredView.
      Returns:
      the page type used when constructing viewer links for canvas renderings
    • setPreferedView

      public SequenceBuilder setPreferedView(PageType preferredView)
      Setter for the field preferredView.
      Parameters:
      preferredView - page type used when constructing viewer links for canvas renderings
      Returns:
      this SequenceBuilder instance for method chaining