Class TocMaker

java.lang.Object
io.goobi.viewer.model.toc.TocMaker

public final class TocMaker extends Object
Builds the table-of-contents tree for a digitized record by querying the Solr index and structure map.
  • Method Details

    • getSolrFieldsToFetch

      protected static List<String> getSolrFieldsToFetch(String template)
      Returns a list of fields to be used as the field filter for Solr queries. The list consists of statically defined fields in REQUIRED_FIELDS and any additional fields configured for the TOC label.
      Parameters:
      template - docstruct type name used to look up the label configuration
      Returns:
      a list of Solr field names to fetch for TOC generation
    • generateToc

      public static Map<String,List<TOCElement>> generateToc(TOC toc, StructElement structElement, boolean addAllSiblings, String mimeType, int tocCurrentPage, int hitsPerPage) throws PresentationException, IndexUnreachableException, DAOException
      Generates the TOC.
      Parameters:
      toc - The TOC object (only required to set the number of volumes for anchor TOCs.
      structElement - struct element representing the record to generate the TOC for
      addAllSiblings - If true and structElement has a parent, other siblings will be listed as well and can be navigated.
      mimeType - Mime type determines the target URL of the TOC element.
      tocCurrentPage - Current page of a paginated TOC.
      hitsPerPage - Hits per page of a paginated TOC.
      Returns:
      a linked map of view names to their TOC element lists, preserving insertion order
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
    • getFirstFieldValue

      public static String getFirstFieldValue(org.apache.solr.common.SolrDocument doc, String footerIdField)
      getFirstFieldValue.
      Parameters:
      doc - Solr document to read the field value from
      footerIdField - name of the Solr field to read
      Returns:
      the first string value of the given Solr field, or null if the field is absent or empty
    • buildTocElementLabel

      public static de.intranda.metadata.multilanguage.IMetadataValue buildTocElementLabel(org.apache.solr.common.SolrDocument doc)
    • createMultiLanguageValue

      public static de.intranda.metadata.multilanguage.IMetadataValue createMultiLanguageValue(org.apache.solr.common.SolrDocument doc, String field, String altField)
      createMultiLanguageValue.
      Parameters:
      doc - Solr document to read language-specific values from
      field - Index field
      altField - Fallback index field
      Returns:
      the multilingual metadata value built from the given Solr document fields