Package io.goobi.viewer.model.toc
Class TocMaker
java.lang.Object
io.goobi.viewer.model.toc.TocMaker
Builds the table-of-contents tree for a digitized record by querying the Solr index and structure map.
-
Method Summary
Modifier and TypeMethodDescriptionstatic de.intranda.metadata.multilanguage.IMetadataValuebuildTocElementLabel(org.apache.solr.common.SolrDocument doc) static de.intranda.metadata.multilanguage.IMetadataValuecreateMultiLanguageValue(org.apache.solr.common.SolrDocument doc, String field, String altField) createMultiLanguageValue.static Map<String, List<TOCElement>> generateToc(TOC toc, StructElement structElement, boolean addAllSiblings, String mimeType, int tocCurrentPage, int hitsPerPage) Generates the TOC.static StringgetFirstFieldValue(org.apache.solr.common.SolrDocument doc, String footerIdField) getFirstFieldValue.getSolrFieldsToFetch(String template) Returns a list of fields to be used as the field filter for Solr queries.
-
Method Details
-
getSolrFieldsToFetch
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 foraddAllSiblings- If true andstructElementhas 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 fromfooterIdField- 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 fromfield- Index fieldaltField- Fallback index field- Returns:
- the multilingual metadata value built from the given Solr document fields
-