Class CollectionBuilder

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

public class CollectionBuilder extends AbstractBuilder
Builds IIIF Presentation API v2 Collection resources from Solr index data.
Author:
Florian Alpers
  • Field Details

    • CONTAINED_WORKS_QUERY_FIELDS

      public static final String[] CONTAINED_WORKS_QUERY_FIELDS
      Required field to create manifest stubs for works in collection.
    • RSS_FEED_LABEL

      public static final String RSS_FEED_LABEL
      Constant RSS_FEED_LABEL="Rss feed".
      See Also:
    • RSS_FEED_FORMAT

      public static final String RSS_FEED_FORMAT
      Constant RSS_FEED_FORMAT="Rss feed".
      See Also:
  • Constructor Details

  • Method Details

    • generateCollection

      public de.intranda.api.iiif.presentation.v2.Collection2 generateCollection(String collectionField, String topElement, String facetField, String splittingChar, List<String> ignoreCollections) throws IndexUnreachableException, URISyntaxException, PresentationException, ViewerConfigurationException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      generateCollection.
      Parameters:
      collectionField - Solr field name identifying the collection
      topElement - name of the collection element to use as root; null or blank for top-level
      facetField - A SOLR field which values are requested for all records within the collection and stored within the collection for later use
      splittingChar - character separating hierarchy levels in collection names
      ignoreCollections - collection names to exclude from the result
      Returns:
      the generated IIIF Collection for the given Solr collection field and top element
      Throws:
      IndexUnreachableException - if any.
      URISyntaxException - if any.
      PresentationException - if any.
      ViewerConfigurationException - if any.
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException - if the top element is not empty and is not a collection
    • addContainedWorks

      public void addContainedWorks(String collectionField, String topElement, de.intranda.api.iiif.presentation.v2.Collection2 collection) throws PresentationException, IndexUnreachableException, URISyntaxException
      addContainedWorks.
      Parameters:
      collectionField - Solr field name identifying the collection
      topElement - name of the root collection element to query works for
      collection - the IIIF collection to add the work manifests to
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      URISyntaxException - if any.
    • createCollectionQuery

      public String createCollectionQuery(String collectionField, String topElement)
      createCollectionQuery.
      Parameters:
      collectionField - Solr field name identifying the collection
      topElement - name of the top-level collection element to filter by; null for all
      Returns:
      the Solr query string for retrieving records in the given collection hierarchy
    • createCollection

      public de.intranda.api.iiif.presentation.v2.Collection2 createCollection(CollectionView collectionView, HierarchicalBrowseDcElement baseElement, URI uri) throws URISyntaxException, ViewerConfigurationException
      createCollection.
      Parameters:
      collectionView - the collection view providing metadata and child elements
      baseElement - the collection element to build the IIIF collection for; null for top-level
      uri - the identifier URI for the resulting IIIF collection
      Returns:
      the IIIF Collection built from the given collection view and base element
      Throws:
      URISyntaxException - if any.
      ViewerConfigurationException - if any.
    • addTagListService

      public void addTagListService(de.intranda.api.iiif.presentation.v2.Collection2 collection, String collectionField, String facetField, String label) throws IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      Add a taglist service to the collection and all subcollections. The taglist service provides a list of
      Parameters:
      collection - the IIIF collection to attach the service to
      collectionField - the Solr field name identifying the collection
      facetField - the Solr field whose values populate the tag list
      label - display label for the tag list service
      Throws:
      IndexUnreachableException
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
    • getCollectionView

      public CollectionView getCollectionView(String collectionField, String groupingField, String splittingChar) throws IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      getCollectionView.
      Parameters:
      collectionField - Solr field name identifying the collection
      groupingField - Solr field used for grouping or faceting within the collection
      splittingChar - character separating hierarchy levels in collection names
      Returns:
      the CollectionView for the given field, retrieved from session cache or freshly created
      Throws:
      IndexUnreachableException - if any.
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
    • createCollectionView

      public CollectionView createCollectionView(String collectionField, String facetField, String splittingChar) throws IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      Parameters:
      collectionField - the Solr field name identifying the collection
      facetField - A SOLR field which values are queried and kept in the collectionView for later use
      splittingChar - character used to separate hierarchy levels in collection names
      Returns:
      CollectionView
      Throws:
      IndexUnreachableException
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
    • getFacetField

      public String getFacetField(String collectionField)
      getFacetField.
      Parameters:
      collectionField - Solr field name to derive the facet field from
      Returns:
      the corresponding Solr facet field name for the given collection field (e.g. MD_ prefix replaced with FACET_)