Package io.goobi.viewer.model.metadata
Class MetadataElement
java.lang.Object
io.goobi.viewer.model.metadata.MetadataElement
- All Implemented Interfaces:
Serializable
Represents a group of metadata fields belonging to a single structural element of a digitized record.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassWrapper class for the metadata type numerical value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGetter for the fielddocStructType.Returns the docstruct type or the group type if this is a record group.Getter for the fielddocType.getFirstMetadataValue(String name) getFirstMetadataValue.getFirstMetadataValue(String prefix, String name, String suffix) getFirstMetadataValue.getFirstMetadataValueIfExists.getLabel()Getter for the fieldlabel.getMetadata(String name) Returns the first instance of a Metadata object whose label matches the given field name.getMetadata(String name, String language) Returns the first instance of a Metadata object whose label matches the given field name.getMetadata(List<String> fields) getMetadata.intGetter for the fieldmetadataList.getMetadataList(boolean beforeFold) Getter for the fieldmetadataList.Alias forgetMetadataList(true).Returns a sorted list of all metadata types contained in metadataList.getPi()Getter for the fieldsidebarMetadataList.getTitle()Getter for the fieldtitle.getUrl()Getter for the fieldurl.booleanhasMetadata.booleanhasMetadataTypeLabels(int viewIndex) booleanhasSidebarMetadata.init(StructElement se, int metadataViewIndex, Locale sessionLocale) booleanisAnchor()isAnchor.booleanisDisplayBoxed(int type) Checks whether all metadata fields for this element can be displayed in a single box (i.e. no table type grouped metadata are configured).booleanisFilesOnly.booleanbooleanbooleanisHasSidebarMetadata.booleanisSkip()booleanReturns true if this MetadataElement represents a stand-alone record, volume or anchor element.voidSetter for the fieldlabel.voidsetMetadataList(List<Metadata> metadataList) Setter for the fieldmetadataList.setSelectedRecordLanguage(String language) Setter for the fieldselectedRecordLanguage.voidsetSidebarMetadataList(List<Metadata> sidebarMetadataList) Setter for the fieldsidebarMetadataList.voidSetter for the fieldurl.
-
Constructor Details
-
MetadataElement
public MetadataElement()
-
-
Method Details
-
init
public MetadataElement init(StructElement se, int metadataViewIndex, Locale sessionLocale) throws PresentationException, IndexUnreachableException - Parameters:
se- StructElementmetadataViewIndex- Metadata view indexsessionLocale- locale for translations/formatting- Returns:
- Constructed
MetadataElement - Throws:
PresentationExceptionIndexUnreachableException
-
isHasMetadataListFold
public boolean isHasMetadataListFold() -
getMetadataFoldIndex
public int getMetadataFoldIndex() -
isSkip
public boolean isSkip()- Returns:
- true if all available metadata fields for this element are marked as hidden; false otherwise
-
getMetadataTypes
Returns a sorted list of all metadata types contained in metadataList.- Returns:
- a list of distinct metadata types present in the metadata list
-
hasMetadataTypeLabels
public boolean hasMetadataTypeLabels(int viewIndex) -
getMetadata
Returns the first instance of a Metadata object whose label matches the given field name.- Parameters:
name- Solr field name to look up- Returns:
- the first Metadata object whose label matches the given field name, or null if not found
-
getMetadata
Returns the first instance of a Metadata object whose label matches the given field name. If a language is given, a localized field name will be used.- Parameters:
name- Solr field name to look uplanguage- Optional language- Returns:
- the first Metadata object matching the field name and optional language, or null if not found
-
getMetadata
getMetadata.- Parameters:
fields- Solr field names to retrieve metadata for- Returns:
- List of Metadata objects that match the given field names
-
setMetadataList
Setter for the fieldmetadataList.- Parameters:
metadataList- the list of metadata fields to display in the main metadata section
-
getMetadataList
Getter for the fieldmetadataList.- Returns:
- the full list of
Metadataobjects for this element, filtered by the selected record language
-
getMetadataList
Getter for the fieldmetadataList.- Parameters:
beforeFold- if true, only list metadata before index #metadataFoldIndex- Returns:
- the list of
Metadataobjects, optionally truncated at the fold index
-
getMetadataListBeforeFold
Alias forgetMetadataList(true).- Returns:
- the list of
Metadataobjects that appear before the fold index
-
getMetadataListAfterFold
-
hasMetadata
public boolean hasMetadata()hasMetadata.- Returns:
- true if this element has at least one non-blank metadata entry in the main metadata list, false otherwise
-
isDisplayBoxed
public boolean isDisplayBoxed(int type) Checks whether all metadata fields for this element can be displayed in a single box (i.e. no table type grouped metadata are configured).- Parameters:
type- the metadata type to check- Returns:
- true if all metadata are not configured as single string; false otherwise
-
hasSidebarMetadata
public boolean hasSidebarMetadata()hasSidebarMetadata.- Returns:
- true if this element has at least one non-blank metadata entry in the sidebar metadata list, false otherwise
-
getSidebarMetadataList
Getter for the fieldsidebarMetadataList.- Returns:
- the list of
Metadataobjects configured for display in the sidebar, filtered by the selected record language
-
setSidebarMetadataList
Setter for the fieldsidebarMetadataList.- Parameters:
sidebarMetadataList- the list of metadata fields to display in the sidebar section
-
isHasSidebarMetadata
public boolean isHasSidebarMetadata()isHasSidebarMetadata.- Returns:
- true if the sidebar metadata list is non-null and not empty, false otherwise
-
getDocStructTypeLabel
Returns the docstruct type or the group type if this is a record group.- Returns:
- docstruct type if record; group type if group
-
getLabel
Getter for the fieldlabel.- Returns:
- the display label for this metadata element, or null if not set
-
setLabel
Setter for the fieldlabel.- Parameters:
label- display label for this metadata element
-
getTitle
Getter for the fieldtitle.- Returns:
- the title of the record or structure element represented by this metadata element
-
getUrl
Getter for the fieldurl.- Returns:
- the URL associated with this metadata element
-
setUrl
Setter for the fieldurl.- Parameters:
url- viewer URL for this element's record page
-
isTopElement
public boolean isTopElement()Returns true if this MetadataElement represents a stand-alone record, volume or anchor element.- Returns:
- topElement
-
getDocType
Getter for the fielddocType.- Returns:
- the document type string (e.g. "monograph", "periodical") of the record represented by this element
-
getDocStructType
Getter for the fielddocStructType.- Returns:
- the document structure type (e.g. "Chapter", "Article") of the record represented by this element
-
getGroupType
-
getPi
-
isAnchor
public boolean isAnchor()isAnchor.- Returns:
- true if this metadata element belongs to an anchor (multi-volume) record, false otherwise
-
isFilesOnly
public boolean isFilesOnly()isFilesOnly.- Returns:
- true if this metadata element represents a files-only record (no displayable image), false otherwise
-
isHasImages
public boolean isHasImages() -
getFirstMetadataValue
getFirstMetadataValue.- Parameters:
name- The name of the metadata- Returns:
- the best available metadata value, or an empty string if no metadata was found
-
getFirstMetadataValueIfExists
getFirstMetadataValueIfExists.- Parameters:
name- Solr field name to look up- Returns:
- an Optional containing the first non-blank metadata value for the field, or empty if not found
-
getFirstMetadataValue
getFirstMetadataValue.- Parameters:
prefix- string prepended to the metadata valuename- Solr field name to look upsuffix- string appended to the metadata value- Returns:
- the first metadata value for the given Solr field, wrapped with the given prefix and suffix
-
setSelectedRecordLanguage
Setter for the fieldselectedRecordLanguage.- Parameters:
language- ISO language code for the selected record language- Returns:
- this
-