Class BrowseElement

java.lang.Object
io.goobi.viewer.model.search.BrowseElement
All Implemented Interfaces:
IAccessDeniedThumbnailOutput, Serializable

public class BrowseElement extends Object implements IAccessDeniedThumbnailOutput, Serializable
Representation of a search hit.
See Also:
  • Constructor Details

    • BrowseElement

      public BrowseElement(String pi, int imageNo, String label, String fulltext, Locale locale, String dataRepository, String url)
      Creates a new unit tests and special instances instance.
      Parameters:
      pi - persistent identifier of the record
      imageNo - representative image page number
      label - display label for the element
      fulltext - full-text content for the element
      locale - locale for translations
      dataRepository - data repository name for the record
      url - Injected URL, overrides URL generation
  • Method Details

    • createMultiLanguageLabel

      public de.intranda.metadata.multilanguage.IMetadataValue createMultiLanguageLabel(StructElement structElement)
      createMultiLanguageLabel.
      Parameters:
      structElement - structure element to generate the label from
      Returns:
      the multilingual label derived from the structure element's metadata fields
    • getLabel

      public String getLabel()
      Getter for the field label.
      Returns:
      the translated label for the current locale, falling back to the default value or an empty string
    • getLabel

      public String getLabel(Locale locale)
      Getter for the field label.
      Parameters:
      locale - locale used to select the translated label
      Returns:
      the display label for this search result in the given locale
    • getLabelAsMetadataValue

      public de.intranda.metadata.multilanguage.IMetadataValue getLabelAsMetadataValue()
      getLabelAsMetadataValue.
      Returns:
      the multilingual label of this browse element
    • getLabelShort

      public String getLabelShort()
      Getter for the field labelShort.
      Returns:
      the abbreviated label for the current locale, falling back to the default value or an empty string
    • setLabelShort

      public void setLabelShort(de.intranda.metadata.multilanguage.IMetadataValue labelShort)
      Setter for the field labelShort.
      Parameters:
      labelShort - the abbreviated label value to display in compact search result views
    • getDocStructType

      public String getDocStructType()
      Getter for the field docStructType.
      Returns:
      the document structure type identifier (e.g. "monograph", "chapter") for this browse element
    • getIddoc

      public String getIddoc()
      Getter for the field iddoc.
      Returns:
      the internal Solr document ID for this browse element
    • getThumbnailUrl

      public String getThumbnailUrl()
      Getter for the field thumbnailUrl.
      Returns:
      the URL of the thumbnail image for this browse element
    • getThumbnailUrl

      public String getThumbnailUrl(String width, String height)
      Called from HTML.
      Parameters:
      width - desired thumbnail width in pixels
      height - desired thumbnail height in pixels
      Returns:
      the thumbnail URL for this search result scaled to the given dimensions
    • getAccessDeniedThumbnailUrl

      public String getAccessDeniedThumbnailUrl(Locale locale)
      Specified by:
      getAccessDeniedThumbnailUrl in interface IAccessDeniedThumbnailOutput
      Parameters:
      locale - locale for selecting the appropriate image
      Returns:
      Configured image URI for the given language; null if none found
    • getImageNo

      public int getImageNo()
      Getter for the field imageNo.
      Returns:
      a int.
    • setImageNo

      public void setImageNo(int imageNo)
    • getStructElements

      public List<StructElementStub> getStructElements()
      Getter for the field structElements.
      Returns:
      the list of structure element stubs from the record hierarchy (outermost first)
    • getBottomStructElement

      public StructElementStub getBottomStructElement()
      Returns the lowest StructElementStub in the list.
      Returns:
      last StructElementStub in the list
    • getDefaultCitationLinkUrl

      public String getDefaultCitationLinkUrl()
      Returns the URL for the configured default citation link (default="true" in config), or null if:
      • no citation link is marked as default
      • the default link is not at record level
      • the required Solr field has no value for this record
      Result is cached after the first call.
      Returns:
      resolved citation link URL, or null
    • getEvents

      public List<EventElement> getEvents()
    • setFulltext

      public void setFulltext(String fulltext)
      Setter for the field fulltext.
      Parameters:
      fulltext - the full-text content associated with this browse element
    • getFulltext

      public String getFulltext()
      Getter for the field fulltext.
      Returns:
      the full-text content associated with this browse element
    • getFulltextForHtml

      public String getFulltextForHtml()
      Returns a relevant full-text fragment for displaying in the search hit box, sanitized to the snippet profile (only <mark class="…"> survives, all other tags and attributes are stripped).
      Returns:
      Full-text fragment sans any line breaks; only Solr-highlight markup is preserved
    • getVolumeNo

      public String getVolumeNo()
      Getter for the field volumeNo.
      Returns:
      the volume number string for this browse element
    • setVolumeNo

      public void setVolumeNo(String volumeNo)
      Setter for the field volumeNo.
      Parameters:
      volumeNo - the volume number string for this browse element
    • isDisplayGroupStatus

      public boolean isDisplayGroupStatus()
      Checks whether the search hit should identify itself as a group document when being displayed.
      Returns:
      true if group and not newspaper; false otherwise
    • isGroup

      public boolean isGroup()
      Returns:
      true if doctype is GROUP; false otherwise
    • isArchive

      public boolean isArchive()
      Returns:
      true if doctype is ARCHIVE; false otherwise
    • isCmsPage

      public boolean isCmsPage()
    • setCmsPage

      public void setCmsPage(boolean cmsPage)
    • isWork

      public boolean isWork()
    • setWork

      public void setWork(boolean work)
    • isAnchor

      public boolean isAnchor()
      isAnchor.
      Returns:
      true if this element represents an anchor document, false otherwise
    • setAnchor

      public void setAnchor(boolean anchor)
      Setter for the field anchor.
      Parameters:
      anchor - true if this element represents an anchor document; false otherwise
    • isHasImages

      public boolean isHasImages()
      isHasImages.
      Returns:
      true if this element has associated image content, false otherwise
    • setHasImages

      public void setHasImages(boolean hasImages)
      Setter for the field hasImages.
      Parameters:
      hasImages - true if this element has associated image content; false otherwise
    • isHasTeiFiles

      public boolean isHasTeiFiles()
    • setHasTeiFiles

      public void setHasTeiFiles(boolean hasTeiFiles)
    • isShowThumbnail

      public boolean isShowThumbnail()
      Returns:
      true if either criterion for thumbnail display is fulfilled; false otherwise
    • getNumVolumes

      public long getNumVolumes()
      Returns the number of volumes contained in this anchor record. The value is computed live (a Solr count of the anchor's volumes) rather than read from the stored NUMVOLUMES field, so the figure shown in search hits is current even if the anchor has not yet been re-indexed after a volume was added or removed. The result is cached per BrowseElement instance. Non-anchor elements always return 0.
      Returns:
      the number of volumes contained in this anchor record
    • setPi

      public void setPi(String pi)
      Setter for the field pi.
      Parameters:
      pi - the persistent identifier of the record associated with this browse element
    • getPi

      public String getPi()
      Getter for the field pi.
      Returns:
      the persistent identifier of the record associated with this browse element
    • getUrl

      public String getUrl()
      Returns the search hint URL (without the application root!).
      Returns:
      the relative URL for this browse element's detail page
    • getSidebarPrevUrl

      public String getSidebarPrevUrl()
      Getter for the field sidebarPrevUrl.
      Returns:
      the URL for navigating to the previous search hit in the sidebar
    • getSidebarNextUrl

      public String getSidebarNextUrl()
      Getter for the field sidebarNextUrl.
      Returns:
      the URL for navigating to the next search hit in the sidebar
    • getRisExport

      public String getRisExport()
    • getMetadataFieldNames

      public Set<String> getMetadataFieldNames()
      Returns:
      List of field names in the metadata list
    • getMetadataList

      public List<Metadata> getMetadataList()
      Getter for the field metadataList.
      Returns:
      a list of metadata entries configured for the search hit display
    • getMetadataValues

      public List<String> getMetadataValues(String field)
    • getFirstMetadataValue

      public String getFirstMetadataValue(String field)
    • getMetadataListForLocale

      public List<Metadata> getMetadataListForLocale(String field, Locale locale)
      Parameters:
      field - metadata field name to filter by
      locale - locale for language-specific filtering
      Returns:
      List
    • getMetadataListForLocale

      public List<Metadata> getMetadataListForLocale(String field, Locale locale, String metadataListType)
      Parameters:
      field - Requested field name
      locale - Requested locale
      metadataListType - key of the metadata list to query (e.g. search hit or secondary)
      Returns:
      List
    • getMetadataListForLocale

      public List<Metadata> getMetadataListForLocale(Locale locale)
      getMetadataListForLocale.
      Parameters:
      locale - locale used to filter language-specific metadata
      Returns:
      a list of metadata entries for the search hit display filtered to the given locale
    • getMetadataListForLocale

      public List<Metadata> getMetadataListForLocale(Locale locale, String metadataListType)
      Parameters:
      locale - locale for language-specific filtering
      metadataListType - key of the metadata list to query (e.g. search hit or secondary)
      Returns:
      List
    • getMetadataListForCurrentLocale

      public List<Metadata> getMetadataListForCurrentLocale()
      getMetadataListForCurrentLocale.
      Returns:
      a list of metadata entries for the search hit display filtered to the current request locale
    • getSecondaryMetadataListForCurrentLocale

      public List<Metadata> getSecondaryMetadataListForCurrentLocale()
      Returns:
      First metadata list in metadataListMap that's not the default search metadata list configuration; empty list if not found
    • getExistingMetadataFields

      public Set<String> getExistingMetadataFields()
    • getMetadataGroupType

      public SolrConstants.MetadataGroupType getMetadataGroupType()
      Getter for the field metadataGroupType.
      Returns:
      the metadata group type classifying the kind of grouped metadata this element represents
    • getMetadataList

      public List<Metadata> getMetadataList(String metadataLabel)
      Getter for the field metadataList.
      Parameters:
      metadataLabel - label key to filter metadata entries by
      Returns:
      a list of metadata entries from the search hit list whose label matches the given key
    • getFoundMetadataList

      public List<Metadata> getFoundMetadataList()
      Getter for the field foundMetadataList.
      Returns:
      the list of metadata entries that matched the search query
    • getDataRepository

      public String getDataRepository()
      Getter for the field dataRepository.
      Returns:
      the name of the data repository storing the content files for this record
    • getAccessPermissionThumbnail

      public AccessPermission getAccessPermissionThumbnail()
    • setAccessPermissionThumbnail

      public void setAccessPermissionThumbnail(AccessPermission accessPermissionThumbnail)
    • isDownloadPdfAllowed

      public boolean isDownloadPdfAllowed()
    • isHasPrerenderedPagePdfs

      public boolean isHasPrerenderedPagePdfs()
    • getPdfDownloadLink

      public String getPdfDownloadLink()
    • getPdfDownloadLinkSmall

      public String getPdfDownloadLinkSmall()
    • getPdfDownloadLinkFull

      public String getPdfDownloadLinkFull()
    • getCitationStringPlain

      public String getCitationStringPlain()
    • getContextObject

      public String getContextObject()
      Returns the ContextObject value for a COinS element using the docstruct hierarchy for this search hit.
      Returns:
      the COinS context object string for embedding bibliographic metadata in a <span> element
    • getRecordLanguages

      public List<String> getRecordLanguages()
      Getter for the field recordLanguages.
      Returns:
      the list of language codes in which the record content is available
    • setHasMedia

      public void setHasMedia(boolean hasMedia)
      Setter for the field hasMedia.
      Parameters:
      hasMedia - true if this element has associated non-image media content; false otherwise
    • isHasMedia

      public boolean isHasMedia()
      isHasMedia.
      Returns:
      true if this element has associated non-image media content, false otherwise
    • getOriginalFieldName

      public String getOriginalFieldName()
      Getter for the field originalFieldName.
      Returns:
      the original Solr field name from which this browse element's label was derived
    • determinePageType

      public PageType determinePageType()
      determinePageType.
      Returns:
      the PageType appropriate for this browse element based on its document structure and MIME type
    • getLogId

      public String getLogId()
      Getter for the field logId.
      Returns:
      the logical structure element ID (LOG_ID) of the record associated with this browse element
    • setLogId

      public void setLogId(String logId)
    • getDocType

      public SolrConstants.DocType getDocType()
      Getter for the field docType.
      Returns:
      the document type of this browse element (e.g. DOCSTRCT, UGC, CMS)
    • setThumbnailUrl

      public void setThumbnailUrl(String thumbnailUrl)