Package io.goobi.viewer.model.metadata
Class MetadataTools
java.lang.Object
io.goobi.viewer.model.metadata.MetadataTools
Utility class providing helpers for processing, formatting, and normalising metadata values.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringapplyReplaceRules(String value, List<MetadataReplaceRule> replaceRules, String pi) applyReplaceRules.static StringconvertLanguageToIso2(String language) Converts given language name or ISO-3 code to ISO-2, if possible.static StringfindMetadataGroupType(String type) findMetadataGroupType.static StringgenerateDublinCoreMetaTags(StructElement structElement) generateDublinCoreMetaTags.static StringgenerateHighwirePressMetaTags(StructElement structElement, List<PhysicalResource> resources) generateHighwirePressMetaTags.static StringgenerateRIS.static StringGenerates RIS without a number of volumes (NV) entry.static StringGenerates RIS from the given metadata fields.static de.intranda.digiverso.normdataimporter.model.RecordRetrieves authority data record from the given URL, using proxy configuration, if configured.static org.apache.solr.common.SolrDocumentListgetGroupedMetadata(String ownerIddoc, String subQuery, List<StringPair> sortFields)
-
Method Details
-
generateDublinCoreMetaTags
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
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
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 fromnumVolumesinstead, which callers compute live for anchors.- Parameters:
docstructType- logical document structure type (e.g. "monograph", "article")metadataFields- map of metadata field names to their valuesnumVolumes- number of volumes to export as NV; null to omit NV- Returns:
- Generated RIS string; null of no docstructType given
-
convertLanguageToIso2
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 modifyreplaceRules- List ofMetadataReplaceRuleobjectspi- 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:
PresentationExceptionIndexUnreachableException
-
findMetadataGroupType
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 IDDOCsubQuery- Optional additional subQuery for filteringsortFields- Optional field/order pairs for sorting- Returns:
- SolrDocumentList
- Throws:
IndexUnreachableExceptionPresentationException
-
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:
Recordif found; null otherwise
-