Class WebAnnotationBuilder

java.lang.Object
io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractAnnotationBuilder
io.goobi.viewer.model.iiif.presentation.v2.builder.WebAnnotationBuilder

public class WebAnnotationBuilder extends AbstractAnnotationBuilder
Author:
Florian Alpers
  • Constructor Details

    • WebAnnotationBuilder

      public WebAnnotationBuilder(AbstractApiUrlManager apiUrlManager)
      Parameters:
      apiUrlManager - API URL manager for building IIIF resource URIs
  • Method Details

    • getCrowdsourcingAnnotationsFromSolr

      public Map<Integer,List<de.intranda.api.annotation.wa.WebAnnotation>> getCrowdsourcingAnnotationsFromSolr(String pi, boolean urlOnlyTarget, HttpServletRequest request) throws PresentationException, IndexUnreachableException
      Gets all annotations for the given PI from the SOLR index, sorted by page number. The annotations are stored as DOCTYPE:UGC in the SOLR and are converted to WebAnnotations here
      Parameters:
      pi - The persistent identifier of the work to query
      urlOnlyTarget - if true, use URI-only annotation targets
      request - current HTTP servlet request
      Returns:
      A map of page numbers (1-based) mapped to a list of associated annotations
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • getCrowdsourcingAnnotations

      public Map<Integer,List<de.intranda.api.annotation.wa.WebAnnotation>> getCrowdsourcingAnnotations(String pi, boolean urlOnlyTarget) throws DAOException
      Gets all annotations for the given PI from the the DAO, sorted by page number. The annotations are stored as DOCTYPE:UGC in the SOLR and are converted to WebAnnotations here
      Parameters:
      pi - The persistent identifier of the work to query
      urlOnlyTarget - if true, use URI-only annotation targets
      Returns:
      A map of page numbers (1-based) mapped to a list of associated annotations
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException
    • getCrowdsourcingAnnotation

      public de.intranda.api.annotation.IAnnotation getCrowdsourcingAnnotation(String id) throws PresentationException, IndexUnreachableException
      Parameters:
      id - the IDDOC of the UGC Solr document to retrieve
      Returns:
      IAnnotation
      Throws:
      PresentationException
      IndexUnreachableException
    • createUGCWebAnnotation

      public de.intranda.api.annotation.wa.WebAnnotation createUGCWebAnnotation(org.apache.solr.common.SolrDocument doc, boolean urlOnlyTarget)
      createWebAnnotation.
      Parameters:
      doc - Solr document of type UGC containing the annotation data
      urlOnlyTarget - if true, use URI-only annotation targets
      Returns:
      the WebAnnotation created from the given UGC Solr document
    • createUGCWebAnnotation

      public de.intranda.api.annotation.wa.WebAnnotation createUGCWebAnnotation(String pi, org.apache.solr.common.SolrDocument doc, boolean urlOnlyTarget)
      createWebAnnotation.
      Parameters:
      pi - persistent identifier of the annotated record
      doc - Solr document of type UGC containing the annotation data
      urlOnlyTarget - if true, use URI-only annotation targets
      Returns:
      the WebAnnotation created from the given UGC Solr document for the specified record
    • createFragmentTarget

      public de.intranda.api.annotation.IResource createFragmentTarget(String pi, int pageOrder, String coordString, boolean urlOnlyTarget)
      Parameters:
      pi - persistent identifier of the record containing the page
      pageOrder - 1-based physical page order of the target canvas
      coordString - coordinate string describing the fragment region (IIIF xywh or legacy format)
      urlOnlyTarget - if true, returns a SpecificResourceURI instead of a full SpecificResource
      Returns:
      IResource
    • createAnnnotationBodyFromUGCDocument

      public de.intranda.api.annotation.IResource createAnnnotationBodyFromUGCDocument(org.apache.solr.common.SolrDocument doc)
      Parameters:
      doc - the UGC Solr document from which to extract the annotation body
      Returns:
      IResource
    • getCrowdsourcingAnnotationCollection

      public de.intranda.api.annotation.wa.collection.AnnotationPage getCrowdsourcingAnnotationCollection(URI uri, String pi, boolean urlsOnly) throws DAOException
      Parameters:
      uri - the URI to use as the ID of the returned annotation page
      pi - persistent identifier of the work to collect annotations for
      urlsOnly - if true, annotation targets are represented as URL-only resources
      Returns:
      AnnotationPage
      Throws:
      IndexUnreachableException
      PresentationException
      DAOException
    • getCrowdsourcingAnnotationCollection

      public de.intranda.api.annotation.wa.collection.AnnotationPage getCrowdsourcingAnnotationCollection(URI uri, String pi, Integer pageNo, boolean urlsOnly) throws DAOException
      Parameters:
      uri - the URI to use as the ID of the returned annotation page
      pi - persistent identifier of the work to collect annotations for
      pageNo - 1-based page order to filter annotations by; null returns all pages
      urlsOnly - if true, annotation targets are represented as URL-only resources
      Returns:
      AnnotationPage
      Throws:
      DAOException