Package io.goobi.viewer.managedbeans
Class MetadataBean
java.lang.Object
io.goobi.viewer.managedbeans.MetadataBean
Provides the metadata for the current structure and event elements.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandisplayChildStructs.getBottomMetadataElement(int metadataViewIndex) Returns the last element inmetadataElementList, which is the bottom element in the hierarchy.getBottomMetadataElementAsList(int metadataViewIndex) getComplexMetadataFieldsToList(String... fields) Convenience method for the metadata page/link label key, depending on the document type.Convenience method for the sidebar metadata widget label key, depending on the document type.Getter for the fieldevents.getFirstMetadataValue(int metadataViewIndex, String mainFieldName, String language, String subFieldName) getFirstMetadataValueForPage(int metadataViewIndex, String mainFieldName, String language, String subFieldName, int order) Returns the firstStringvalues forsubFieldNameof a grouped metadata fieldmainFieldNamewhere the subfield value of MD_ORDER matches the givenordervalue.getMainMetadataElement(int index) The main metadata element is the first element which isn't an anchor if any such elements are in the metadata element list.Convenience method forgetMetadataElementList(0).getMetadataElementList(int index) Getter for the fieldmetadataElementList.getMetadataElementList(int index, boolean forceReload) Returns the list ofMetadataElements for the given metadata view index, optionally forcing a reload.getMetadataElementsAsList(MetadataElement... elements) Returns givenMetadataElements as anArrayList.getMetadataList(StructElement struct, String type) Returns a populated list ofMetadatafor the given struct element and metadata type.getMetadataValues(int metadataViewIndex, String mainFieldName, String subFieldName, String language) getMetadataValuesForPage(int metadataViewIndex, String mainFieldName, String language, String subFieldName, int order) Returns a list ofStringvalues forsubFieldNameof a grouped metadata fieldmainFieldNamewhere the subfield value of MD_ORDER matches the givenordervalue.getTopMetadataElement(int index) getTopMetadataElement.loadMetadata(int index, Locale locale) loadMetadata.range(int start, int end) voidselectFirstMetadataViewOfLocation(String location) Sets activeMetadataView to the first configured MetadataView with location="location".voidsetActiveDocumentBean(ActiveDocumentBean activeDocumentBean) Required setter for ManagedProperty injection.voidsetActiveMetadataView(MetadataView activeMetadataView) voidsetEvents(List<EventElement> events) Setter for the fieldevents.voidsetMetadataViewUrl(String metadataViewUrl) voidsetSelectedRecordLanguage(String selectedRecordLanguage) setSelectedRecordLanguage.
-
Constructor Details
-
MetadataBean
public MetadataBean()Empty constructor.
-
-
Method Details
-
setActiveDocumentBean
Required setter for ManagedProperty injection.- Parameters:
activeDocumentBean- the ActiveDocumentBean instance to inject
-
loadMetadata
loadMetadata.- Parameters:
index- Metadata view index to loadlocale- Locale used for translating metadata values- Returns:
- navigation outcome string for the metadata view
- Throws:
IndexUnreachableException- if any.DAOException- if any.
-
getMetadataElementList
Convenience method forgetMetadataElementList(0).- Returns:
- the first metadata element list
-
getMetadataElementList
Getter for the fieldmetadataElementList.- Parameters:
index- Metadata view index to retrieve- Returns:
- the list of metadata elements for the given view index
-
getMetadataElementList
Returns the list ofMetadataElements for the given metadata view index, optionally forcing a reload.- Parameters:
index- the metadata view indexforceReload- if true, always reload from the current document- Returns:
- list of metadata elements, or an empty list if no document is loaded or loading fails
-
getMetadataElementsAsList
Returns givenMetadataElements as anArrayList. Used for supplying a custom list of elements for the metadata sidebar widget.- Parameters:
elements- Vararg metadata elements to wrap in a list- Returns:
- List
-
getTopMetadataElement
getTopMetadataElement.- Parameters:
index- Metadata view index- Returns:
- the top MetadataElement at the given view index, or null if none is available
-
getMainMetadataElement
The main metadata element is the first element which isn't an anchor if any such elements are in the metadata element list. Otherwise it is just the first (anchor) metadata element- Parameters:
index- Metadata view index to retrieve- Returns:
- the main MetadataElement (first non-anchor) for the given view index, or null if none is available
-
getBottomMetadataElement
Returns the last element inmetadataElementList, which is the bottom element in the hierarchy. If the element contains no side bar metadata, the next higher element is checked until an element with sidebar metadata is found. TODO for some reason this method is called 6-15 times per page- Parameters:
metadataViewIndex- Metadata view index- Returns:
- the bottom MetadataElement with sidebar metadata for the given view index, or null if none is available
-
getBottomMetadataElementAsList
- Parameters:
metadataViewIndex- Metadata view index to retrieve- Returns:
- List
-
getDefaultMetadataLabel
Convenience method for the metadata page/link label key, depending on the document type.- Returns:
- Message key for the label
-
getDefaultSidebarMetadataLabel
Convenience method for the sidebar metadata widget label key, depending on the document type.- Returns:
- Message key for the label
-
getEvents
Getter for the fieldevents.- Returns:
- the list of LIDO event elements for the current record
-
setEvents
Setter for the fieldevents.- Parameters:
events- LIDO event elements to display
-
displayChildStructs
public boolean displayChildStructs()displayChildStructs.- Returns:
- true if child structural elements should be displayed in the metadata view, false otherwise
-
setSelectedRecordLanguage
setSelectedRecordLanguage.- Parameters:
selectedRecordLanguage- ISO language code to use for multi-language fields
-
getMetadataViews
- Returns:
- List of available
MetadataViews
-
getMetadataViewUrl
-
setMetadataViewUrl
- Parameters:
metadataViewUrl- URL segment identifying the metadata view to activate
-
selectFirstMetadataViewOfLocation
Sets activeMetadataView to the first configured MetadataView with location="location".- Parameters:
location- Location name
-
getActiveMetadataView
-
setActiveMetadataView
- Parameters:
activeMetadataView- metadata view configuration to make active
-
getComplexMetadataFieldsToList
- Parameters:
fields- Vararg Solr field names to convert to a list- Returns:
- Given strings as List
-
getMetadataValuesForPage
public List<String> getMetadataValuesForPage(int metadataViewIndex, String mainFieldName, String language, String subFieldName, int order) Returns a list ofStringvalues forsubFieldNameof a grouped metadata fieldmainFieldNamewhere the subfield value of MD_ORDER matches the givenordervalue.- Parameters:
metadataViewIndex- Index of the requested metadataView where the requested metadata is configuredmainFieldName- Main metadata fieldlanguage- Optional metadata field languagesubFieldName- Child metadata fieldorder- Page number- Returns:
- Metadata values of subFieldName; empty list if none found
-
getFirstMetadataValueForPage
public String getFirstMetadataValueForPage(int metadataViewIndex, String mainFieldName, String language, String subFieldName, int order) Returns the firstStringvalues forsubFieldNameof a grouped metadata fieldmainFieldNamewhere the subfield value of MD_ORDER matches the givenordervalue.- Parameters:
metadataViewIndex- Index of the requested metadataView where the requested metadata is configuredmainFieldName- Main metadata fieldlanguage- Optional metadata field languagesubFieldName- Child metadata fieldorder- Page number- Returns:
- First value of subFieldName; null if none found
-
getFirstMetadataValue
public String getFirstMetadataValue(int metadataViewIndex, String mainFieldName, String language, String subFieldName) - Parameters:
metadataViewIndex- Index of the requested metadataView where the requested metadata is configuredmainFieldName- Main metadata fieldlanguage- Optional metadata field languagesubFieldName- Child metadata field- Returns:
- First value of subFieldName; null if none found
-
getMetadataValues
public List<String> getMetadataValues(int metadataViewIndex, String mainFieldName, String subFieldName, String language) - Parameters:
metadataViewIndex- Index of the requested metadataView where the requested metadata is configuredmainFieldName- Main metadata fieldsubFieldName- Child metadata fieldlanguage- Optional metadata field language- Returns:
- Metadata values of subFieldName; empty list if none found
-
range
-
getMetadataList
Returns a populated list ofMetadatafor the given struct element and metadata type.- Parameters:
struct- the struct element to retrieve metadata for; may be nulltype- the metadata configuration type key- Returns:
- populated list of metadata, or an empty list if struct is null
-