Class OpenAnnotationBuilder

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

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

    • OpenAnnotationBuilder

      public OpenAnnotationBuilder(AbstractApiUrlManager apiUrlManager)
      Parameters:
      apiUrlManager - the URL manager for building API paths
  • Method Details

    • getCrowdsourcingAnnotationsFromSolr

      public Map<Integer,List<de.intranda.api.annotation.oa.OpenAnnotation>> 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 OpenAnnotations here
      Parameters:
      pi - The persistent identifier of the work to query
      urlOnlyTarget - if true, use URI-only annotation targets
      request - the 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.oa.OpenAnnotation>> getCrowdsourcingAnnotations(String pi, boolean urlOnlyTarget, HttpServletRequest request) throws DAOException
      Gets all annotations for the given PI from the DAO, sorted by page number. The annotations are stored as DOCTYPE:UGC in the SOLR and are converted to OpenAnnotations here
      Parameters:
      pi - The persistent identifier of the work to query
      urlOnlyTarget - if true, use URI-only annotation targets
      request - the 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.
      DAOException
    • getCrowdsourcingAnnotation

      public de.intranda.api.annotation.IAnnotation getCrowdsourcingAnnotation(String id) throws PresentationException, IndexUnreachableException
      Throws:
      PresentationException
      IndexUnreachableException
    • createUGCOpenAnnotation

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

      public de.intranda.api.annotation.oa.OpenAnnotation createUGCOpenAnnotation(String pi, org.apache.solr.common.SolrDocument doc, boolean urlOnlyTarget)
      createOpenAnnotation.
      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 OpenAnnotation 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 work
      pageOrder - physical page number (1-based)
      coordString - coordinate string encoding the fragment region
      urlOnlyTarget - if true, return a URI-only specific resource
      Returns:
      IResource
    • createAnnnotationBodyFromUGCDocument

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

      public de.intranda.api.annotation.IAnnotationCollection getCrowdsourcingAnnotationCollection(URI uri, String pi, boolean urlsOnly, HttpServletRequest request) throws DAOException
      Parameters:
      uri - the URI to assign to the annotation collection
      pi - persistent identifier of the work
      urlsOnly - if true, annotation targets are URL-only resources
      request - the current HTTP servlet request
      Returns:
      IAnnotationCollection
      Throws:
      IndexUnreachableException
      PresentationException
      DAOException
    • getCrowdsourcingAnnotationCollection

      public de.intranda.api.annotation.IAnnotationCollection getCrowdsourcingAnnotationCollection(URI uri, String pi, Integer page, boolean urlsOnly, HttpServletRequest request) throws DAOException
      Parameters:
      uri - the URI to assign to the annotation collection
      pi - persistent identifier of the work
      page - physical page number to filter annotations by
      urlsOnly - if true, annotation targets are URL-only resources
      request - the current HTTP servlet request
      Returns:
      IAnnotationCollection
      Throws:
      DAOException