java.lang.Object
io.goobi.viewer.model.iiif.presentation.v2.builder.AbstractBuilder
Direct Known Subclasses:
CollectionBuilder, LayerBuilder, ManifestBuilder, SequenceBuilder, StructureBuilder

public abstract class AbstractBuilder extends Object

Abstract AbstractBuilder class.

Author:
Florian Alpers
  • Field Details

    • REQUIRED_SOLR_FIELDS

      protected static final String[] REQUIRED_SOLR_FIELDS
      Constant REQUIRED_SOLR_FIELDS
    • urls

      protected final AbstractApiUrlManager urls
      Constant UGC_SOLR_FIELDS
    • config

      protected final Configuration config
  • Constructor Details

    • AbstractBuilder

      protected AbstractBuilder(AbstractApiUrlManager apiUrlManager)

      Constructor for AbstractBuilder.

      Parameters:
      apiUrlManager -
    • AbstractBuilder

      protected AbstractBuilder(AbstractApiUrlManager apiUrlManager, Configuration config)

      Constructor for AbstractBuilder.

      Parameters:
      apiUrlManager -
      config -
  • Method Details

    • getLabel

      protected de.intranda.metadata.multilanguage.IMetadataValue getLabel(String value)
      Parameters:
      value -
      Returns:
      IMetadataValue
    • absolutize

      public URI absolutize(URI uri)
      Parameters:
      uri -
      Returns:
      URI
    • absolutize

      public URI absolutize(String uri)
    • getLocale

      protected Locale getLocale(String language)

      getLocale.

      Parameters:
      language - a String object.
      Returns:
      a Locale object.
    • getMetsResolverUrl

      public String getMetsResolverUrl(StructElement ele)

      getMetsResolverUrl.

      Parameters:
      ele - a StructElement object.
      Returns:
      METS resolver link for the DFG Viewer
    • getLidoResolverUrl

      public String getLidoResolverUrl(StructElement ele)

      getLidoResolverUrl.

      Parameters:
      ele - a StructElement object.
      Returns:
      LIDO resolver link for the DFG Viewer
    • getViewUrl

      public String getViewUrl(PhysicalElement ele, PageType pageType)

      getViewUrl.

      Parameters:
      ele - a PhysicalElement object.
      pageType - a PageType object.
      Returns:
      viewer url for the given page in the given PageType
    • getLabelIfExists

      public Optional<de.intranda.metadata.multilanguage.IMetadataValue> getLabelIfExists(org.apache.solr.common.SolrDocument solrDocument)
      Simple method to create a label for a SolrDocument from SolrConstants.LABEL, SolrConstants.TITLE or SolrConstants.DOCSTRCT
      Parameters:
      solrDocument - a SolrDocument object.
      Returns:
      a Optional object.
    • addMetadata

      public void addMetadata(de.intranda.api.iiif.presentation.v2.AbstractPresentationModelElement2 manifest, StructElement ele)

      addMetadata.

      Parameters:
      manifest - a AbstractPresentationModelElement2 object.
      ele - a StructElement object.
    • addCrowdourcingAnnotations

      public void addCrowdourcingAnnotations(List<de.intranda.api.iiif.presentation.v2.Canvas2> canvases, Map<Integer,List<de.intranda.api.annotation.oa.OpenAnnotation>> crowdsourcingAnnotations, Map<de.intranda.api.iiif.presentation.enums.AnnotationType,List<de.intranda.api.iiif.presentation.v2.AnnotationList>> annotationMap)
      Add the annotations from the crowdsourcingAnnotations map to the respective canvases in the canvases list as well as to the given annotationMap
      Parameters:
      canvases - The list of canvases which should receive the annotations as otherContent
      crowdsourcingAnnotations - A map of annotations by page number
      annotationMap - A global annotation map for a whole manifest; may be null if not needed
    • contained

      protected boolean contained(String field, List<String> displayFields)
      Return true if the field is contained in displayFields, accounting for wildcard characters
      Parameters:
      field -
      displayFields -
      Returns:
      true if displayFields contains field; false otherwise
    • addLanguageFields

      protected static List<String> addLanguageFields(List<String> displayFields, List<Locale> locales)
      Parameters:
      displayFields -
      locales -
      Returns:
      List (immutable!)
    • getDocumentWithChildren

      public List<StructElement> getDocumentWithChildren(String pi) throws PresentationException, IndexUnreachableException
      Queries all DocStructs which have the given PI as PI_TOPSTRUCT or anchor (or are the anchor themselves). Works are sorted by a StructElementComparator If no hits are found, an empty list is returned.
      Parameters:
      pi - a String object.
      Returns:
      A list of all docstructs with the given pi or children thereof. An empty list if no hits are found
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • addEventMetadataToWorkElement

      protected void addEventMetadataToWorkElement(List<StructElement> eles, List<org.apache.solr.common.SolrDocument> events)
      Adds all metadata from the given events to the first work document contained in eles. All metadata will be attached twice, once in the form "/[fieldName]" and once in the form "[eventType]/[fieldName]"
      Parameters:
      eles - The list of StructElements from which to select the first work document. All metadata are attached to this document
      events - The list of event SolrDocuments from which to take the metadata
    • getEventFields

      protected Map<String,List<String>> getEventFields()

      getEventFields.

      Returns:
      a Map object.
    • getDocument

      getDocument.

      Parameters:
      pi - a String object.
      Returns:
      a StructElement object.
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • getSolrFieldList

      public List<String> getSolrFieldList()

      getSolrFieldList.

      Returns:
      a List object.
    • getAttributions

      protected List<de.intranda.metadata.multilanguage.IMetadataValue> getAttributions()
      Gets the attribution text configured in webapi.iiif.attribution and returns all translations if any are found, or the configured string itself otherwise
      Returns:
      the configured attribution
    • getDescription

      protected Optional<de.intranda.metadata.multilanguage.IMetadataValue> getDescription(StructElement ele)

      getDescription.

      Parameters:
      ele - a StructElement object.
      Returns:
      a Optional object.
    • getLabel

      protected Optional<de.intranda.metadata.multilanguage.IMetadataValue> getLabel(StructElement ele)

      getDescription.

      Parameters:
      ele - a StructElement object.
      Returns:
      a Optional object.
    • getCollectionURI

      public URI getCollectionURI(String collectionField, String baseCollectionName)

      getCollectionURI.

      Parameters:
      collectionField - a String object.
      baseCollectionName - a String object.
      Returns:
      a URI object.
    • getManifestURI

      public URI getManifestURI(String pi)

      getManifestURI.

      Parameters:
      pi - a String object.
      Returns:
      a URI object.
    • getExternalManifestURI

      public Optional<URI> getExternalManifestURI(String pi)
    • getPageManifestURI

      public URI getPageManifestURI(String pi, int pageNo)

      getManifestURI for page

      Parameters:
      pi - Persistent identifier of a record
      pageNo - 1-based page order within the record
      Returns:
      a URI object.
    • getManifestURI

      public URI getManifestURI(String pi, BuildMode mode)

      getManifestURI.

      Parameters:
      pi - a String object.
      mode - a BuildMode object.
      Returns:
      a URI object.
    • getRangeURI

      public URI getRangeURI(String pi, String logId)

      getRangeURI.

      Parameters:
      pi - a String object.
      logId - a String object.
      Returns:
      a URI object.
    • getSequenceURI

      public URI getSequenceURI(String pi, String label)

      getSequenceURI.

      Parameters:
      pi - a String object.
      label - a String object.
      Returns:
      a URI object.
    • getCanvasURI

      public URI getCanvasURI(String pi, int pageNo)

      getCanvasURI.

      Parameters:
      pi - a String object.
      pageNo - a int.
      Returns:
      a URI object.
    • getPageOrderFromCanvasURI

      public Integer getPageOrderFromCanvasURI(URI uri)
      Get the page order (1-based) from a canavs URI. That is the number in the last path paramter after '/canvas/' If the URI doesn't match a canvas URI, null is returned
      Parameters:
      uri - a URI object.
      Returns:
      a Integer object.
    • getPIFromCanvasURI

      public String getPIFromCanvasURI(URI uri)
      Get the persistent identifier from a canvas URI. This is the URI path param between '/iiif/manifests/' and '/canvas/'
      Parameters:
      uri - a URI object.
      Returns:
      The pi, or null if the URI doesn't match a iiif canvas URI
    • getAnnotationListURI

      public URI getAnnotationListURI(String pi, int pageNo, de.intranda.api.iiif.presentation.enums.AnnotationType type, boolean openAnnotation)

      getAnnotationListURI.

      Parameters:
      pi - a String object.
      pageNo - a int.
      type - a AnnotationType object.
      openAnnotation -
      Returns:
      a URI object.
    • getAnnotationListURI

      public URI getAnnotationListURI(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type)

      getAnnotationListURI.

      Parameters:
      pi - a String object.
      type - a AnnotationType object.
      Returns:
      a URI object.
    • getCommentAnnotationURI

      public URI getCommentAnnotationURI(long id)

      getCommentAnnotationURI.

      Parameters:
      id - a long.
      Returns:
      a URI object.
    • getLayerURI

      public URI getLayerURI(String pi, de.intranda.api.iiif.presentation.enums.AnnotationType type)

      getLayerURI.

      Parameters:
      pi - a String object.
      type - a AnnotationType object.
      Returns:
      a URI object.
    • getImageAnnotationURI

      public URI getImageAnnotationURI(String pi, int order)

      getImageAnnotationURI.

      Parameters:
      pi - a String object.
      order - a int.
      Returns:
      a URI object.
    • getAnnotationURI

      public URI getAnnotationURI(String pi, int order, de.intranda.api.iiif.presentation.enums.AnnotationType type, int annoNum) throws URISyntaxException

      getAnnotationURI.

      Parameters:
      pi - a String object.
      order - a int.
      type - a AnnotationType object.
      annoNum - a int.
      Returns:
      a URI object.
      Throws:
      URISyntaxException - if any.
    • getAnnotationURI

      public URI getAnnotationURI(String id)

      getAnnotationURI.

      Parameters:
      id - a String object.
      Returns:
      a URI object.
    • getSearchServiceURI

      public URI getSearchServiceURI(String pi)
      Get URL to search service from ApiUrls
      Parameters:
      pi - The persistent identifier of the work to search
      Returns:
      the service URI
    • getAutoCompleteServiceURI

      public URI getAutoCompleteServiceURI(String pi)
      Get URL to auto complete service from ApiUrls
      Parameters:
      pi - The persistent identifier of the work to search for autocomplete
      Returns:
      the service URI
    • getSearchURI

      public URI getSearchURI(String pi, String query, List<String> motivation)

      getSearchURI.

      Parameters:
      pi - a String object.
      query - a String object.
      motivation - a List object.
      Returns:
      a URI object.
    • getAutoSuggestURI

      public URI getAutoSuggestURI(String pi, String query, List<String> motivation)

      getAutoSuggestURI.

      Parameters:
      pi - a String object.
      query - a String object.
      motivation - a List object.
      Returns:
      a URI object.
    • addSeeAlso

      public AbstractBuilder addSeeAlso(LinkingProperty.LinkingTarget target, de.intranda.metadata.multilanguage.IMetadataValue label)
    • addRendering

      public AbstractBuilder addRendering(LinkingProperty.LinkingTarget target, de.intranda.metadata.multilanguage.IMetadataValue label)
    • getSeeAlsos

      public List<LinkingProperty> getSeeAlsos()
    • getRenderings

      public List<LinkingProperty> getRenderings()