Class MetadataTools

java.lang.Object
io.goobi.viewer.model.metadata.MetadataTools

public final class MetadataTools extends Object
Utility class providing helpers for processing, formatting, and normalising metadata values.
  • Method Details

    • generateDublinCoreMetaTags

      public static String generateDublinCoreMetaTags(StructElement structElement)
      generateDublinCoreMetaTags.
      Parameters:
      structElement - structural element whose metadata is rendered.
      Returns:
      String containing meta tags
    • generateHighwirePressMetaTags

      public static String generateHighwirePressMetaTags(StructElement structElement, List<PhysicalResource> resources) throws IndexUnreachableException, ViewerConfigurationException, PresentationException
      generateHighwirePressMetaTags.
      Parameters:
      structElement - structural element whose metadata is rendered.
      resources - list of physical resources for citation_pdf_url tags.
      Returns:
      String containing meta tags
      Throws:
      IndexUnreachableException - if any.
      ViewerConfigurationException - if any.
      PresentationException - if any.
    • generateRIS

      public static String generateRIS(StructElement se)
      generateRIS. For anchors, the number of volumes (NV) is the live count of the anchor's volumes rather than the stored NUMVOLUMES field, so it is current even if the anchor has not been re-indexed since a volume was added or removed.
      Parameters:
      se - structural element to generate RIS output for.
      Returns:
      the RIS-formatted bibliographic reference string for the given structure element, or null if se is null
    • generateRIS

      public static String generateRIS(String docstructType, Map<String,List<String>> metadataFields)
      Generates RIS without a number of volumes (NV) entry.
      Parameters:
      docstructType - logical document structure type (e.g. "monograph", "article")
      metadataFields - map of metadata field names to their values
      Returns:
      Generated RIS string; null of no docstructType given
    • generateRIS

      public static String generateRIS(String docstructType, Map<String,List<String>> metadataFields, Long numVolumes)
      Generates RIS from the given metadata fields. The stored NUMVOLUMES field is ignored; the number of volumes (NV) is taken from numVolumes instead, which callers compute live for anchors.
      Parameters:
      docstructType - logical document structure type (e.g. "monograph", "article")
      metadataFields - map of metadata field names to their values
      numVolumes - number of volumes to export as NV; null to omit NV
      Returns:
      Generated RIS string; null of no docstructType given
    • convertLanguageToIso2

      public static String convertLanguageToIso2(String language)
      Converts given language name or ISO-3 code to ISO-2, if possible.
      Parameters:
      language - language name or ISO-3 code to convert.
      Returns:
      ISO-2 representation; original string if none found
    • applyReplaceRules

      public static String applyReplaceRules(String value, List<MetadataReplaceRule> replaceRules, String pi) throws IndexUnreachableException, PresentationException
      applyReplaceRules.
      Parameters:
      value - Metadata value to modify
      replaceRules - List of MetadataReplaceRule objects
      pi - Record identifier to whose context the value belongs; used for checking conditions
      Returns:
      the metadata value after all applicable replace rules have been applied
      Throws:
      PresentationException
      IndexUnreachableException
    • findMetadataGroupType

      public static String findMetadataGroupType(String type)
      findMetadataGroupType.
      Parameters:
      type - gndspec type code to look up.
      Returns:
      MetadataGroupType value corresponding to the given gndspec type
    • getGroupedMetadata

      public static org.apache.solr.common.SolrDocumentList getGroupedMetadata(String ownerIddoc, String subQuery, List<StringPair> sortFields) throws PresentationException, IndexUnreachableException
      Parameters:
      ownerIddoc - owner IDDOC
      subQuery - Optional additional subQuery for filtering
      sortFields - Optional field/order pairs for sorting
      Returns:
      SolrDocumentList
      Throws:
      IndexUnreachableException
      PresentationException
    • getAuthorityDataRecord

      public static de.intranda.digiverso.normdataimporter.model.Record getAuthorityDataRecord(String url)
      Retrieves authority data record from the given URL, using proxy configuration, if configured.
      Parameters:
      url - Authority data record URL
      Returns:
      Record if found; null otherwise