Package io.goobi.viewer.model.cms.media
Class CMSMediaItem
java.lang.Object
io.goobi.viewer.model.cms.media.CMSMediaItem
- All Implemented Interfaces:
BrowseElementInfo,Serializable,Comparable<CMSMediaItem>
@Entity
public class CMSMediaItem
extends Object
implements BrowseElementInfo, Comparable<CMSMediaItem>, Serializable
Represents a media file (image, video, audio, or document) managed in the CMS media library.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates the display priority levels for a CMS media item, distinguishing items that should be highlighted from those with default treatment. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstantCONTENT_TYPE_AUDIO="audio".static final StringConstantCONTENT_TYPE_GIF="application/gif".static final StringConstantCONTENT_TYPE_SVG="image/svg+xml".static final StringConstantCONTENT_TYPE_PDF="application/pdf".static final StringConstantCONTENT_TYPE_SVG="image/svg+xml".static final StringConstantCONTENT_TYPE_VIDEO="video".static final StringConstantCONTENT_TYPE_XML="text/xml". -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddCategory(CMSCategory cat) addCategory.voidaddMetadata(CMSMediaItemMetadata metadata) Adds a metadata item to the list of image metadata.intbooleanDeprecated.Determines this media item's file's content type via the extension.getCurrentLanguageMetadata.getDescription.getDescription(String language) intGetter for the fieldfileName.getFilePath.getFinishedLocales.getIconURI.getIconURI(int size) getIconURI.getIconURI(int width, int height) getIconURI.getId()Getter for the fieldid.getImageURI.Getter for the fieldlastModifiedTime.getLink()Getter for the fieldlink.getLinkURI.getLinkURI(HttpServletRequest request) getLinkURI.Getter for the fieldmetadata.getMetadataForLanguage(String language) getMetadataForLanguage.getMetadataForLocale(Locale locale) getMetadataForLocale.getName()getName.de.intranda.metadata.multilanguage.IMetadataValuegetTranslationsForAlternativeText.de.intranda.metadata.multilanguage.IMetadataValuegetTranslationsForDescription.de.intranda.metadata.multilanguage.IMetadataValuegetTranslationsForName.booleanhasCateories.inthashCode()booleanisFinished(Locale locale) isFinished.booleanChecks whether this media item contains a text file that can be exported for indexing.booleanbooleanremoveCategory.voidsetAlternativeText(String alternativeText) Deprecated.voidsetCategories(List<CMSCategory> categories) Setter for the fieldcategories.voidsetDisplayOrder(int displayOrder) Setter for the fielddisplayOrder.voidsetFileName(String fileName) Setter for the fieldfileName.voidSetter for the fieldid.voidsetImportant(boolean important) setImportant.voidSet the link for this media item.voidsetMetadata(List<CMSMediaItemMetadata> metadata) Setter for the fieldmetadata.voidsetPriority(CMSMediaItem.Priority priority) Setter for the fieldpriority.toString()wrapCategories(List<CMSCategory> categories) wrapCategories.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.goobi.viewer.model.viewer.collections.BrowseElementInfo
hasDescription
-
Field Details
-
CONTENT_TYPE_XML
ConstantCONTENT_TYPE_XML="text/xml".- See Also:
-
CONTENT_TYPE_SVG
ConstantCONTENT_TYPE_SVG="image/svg+xml".- See Also:
-
CONTENT_TYPE_ICO
ConstantCONTENT_TYPE_SVG="image/svg+xml".- See Also:
-
CONTENT_TYPE_PDF
ConstantCONTENT_TYPE_PDF="application/pdf".- See Also:
-
CONTENT_TYPE_GIF
ConstantCONTENT_TYPE_GIF="application/gif".- See Also:
-
CONTENT_TYPE_VIDEO
ConstantCONTENT_TYPE_VIDEO="video".- See Also:
-
CONTENT_TYPE_AUDIO
ConstantCONTENT_TYPE_AUDIO="audio".- See Also:
-
-
Constructor Details
-
CMSMediaItem
public CMSMediaItem()Default constructor. -
CMSMediaItem
Copy constructor.- Parameters:
orig- source media item to copy from
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getContentType
Determines this media item's file's content type via the extension.- Returns:
- Content type string
-
isHasExportableText
public boolean isHasExportableText()Checks whether this media item contains a text file that can be exported for indexing.- Returns:
- true if item content types allows for text export; false otherwise
-
getId
Getter for the fieldid.- Returns:
- the database primary key of this media item
-
setId
Setter for the fieldid.- Parameters:
id- the database primary key to set
-
getFileName
Getter for the fieldfileName.- Returns:
- the file name of the media file
-
setFileName
Setter for the fieldfileName.- Parameters:
fileName- the file name of the media file (also resets the cached last modified time)
-
setAlternativeText
Deprecated.Setter for the fieldalternativeText.- Parameters:
alternativeText- the legacy alternative text value to store
-
getMetadataForLocale
getMetadataForLocale.- Parameters:
locale- locale used to look up the language tag- Returns:
- media item metadata for the given locale; null if no locale given
-
getMetadataForLanguage
getMetadataForLanguage.- Parameters:
language- BCP 47 language code to look up- Returns:
- media item metadata for the given locale
-
getMetadata
Getter for the fieldmetadata.- Returns:
- the list of language-specific metadata entries for this media item
-
setMetadata
Setter for the fieldmetadata.- Parameters:
metadata- the list of language-specific metadata entries to assign
-
addMetadata
Adds a metadata item to the list of image metadata. If a metadata item with the same language string exists, it is replaced- Parameters:
metadata- metadata entry to add or replace for its language
-
getCurrentLanguageMetadata
getCurrentLanguageMetadata.- Returns:
- metadata list for the current language
-
hasCateories
public boolean hasCateories()hasCateories.- Returns:
- true if this media item has at least one assigned category, false otherwise
-
getCategories
-
setCategories
Setter for the fieldcategories.- Parameters:
categories- replacement list of categories to assign
-
removeCategory
removeCategory.- Parameters:
cat- category to remove from this item- Returns:
- true if the category was present and has been removed, false otherwise
-
addCategory
addCategory.- Parameters:
cat- category to add if not already present- Returns:
- true if the category was added, false if it was already present
-
isImportant
public boolean isImportant() -
setImportant
public void setImportant(boolean important) setImportant.- Parameters:
important- true sets priority to IMPORTANT, false to DEFAULT
-
getPriority
-
setPriority
Setter for the fieldpriority.- Parameters:
priority- the display priority to assign to this media item
-
getLinkURI
getLinkURI.- Specified by:
getLinkURIin interfaceBrowseElementInfo- Returns:
- the link URI for this media item, resolved using the current HTTP request
-
getLinkURI
getLinkURI.- Specified by:
getLinkURIin interfaceBrowseElementInfo- Parameters:
request- aHttpServletRequestobject.- Returns:
- the link URI for this browse element, resolved relative to the given request context
-
getLink
Getter for the fieldlink.- Returns:
- the entered link url
-
setLink
Set the link for this media item.- Parameters:
linkUrl- URL string to associate with this media item- Throws:
URISyntaxException- if any.
-
getDescription
getDescription.- Specified by:
getDescriptionin interfaceBrowseElementInfo- Returns:
- the description of this browse element in the default language
-
getName
getName.- Specified by:
getNamein interfaceBrowseElementInfo- Returns:
- the name of this browse element
-
getAlternativeText
-
getAlternativeTextOld
Deprecated. -
getIconURI
getIconURI.- Specified by:
getIconURIin interfaceBrowseElementInfo- Returns:
- the icon URI for this browse element, or null if no icon is set
-
getIconURI
getIconURI.- Specified by:
getIconURIin interfaceBrowseElementInfo- Parameters:
width- a int.height- a int.- Returns:
- the icon URI scaled to the given width and height, or null if no icon is set
-
getIconURI
getIconURI.- Specified by:
getIconURIin interfaceBrowseElementInfo- Parameters:
size- a int.- Returns:
- the icon URI scaled to the given square size, or null if no icon is set
-
toString
-
getName
-
getDescription
- Specified by:
getDescriptionin interfaceBrowseElementInfo- Parameters:
language- language code for the requested description- Returns:
- the description of this browse element in the given language
-
getDisplayOrder
public int getDisplayOrder() -
setDisplayOrder
public void setDisplayOrder(int displayOrder) Setter for the fielddisplayOrder.- Parameters:
displayOrder- the sort order index for displaying this media item in lists
-
getImageURI
getImageURI.- Returns:
- the file URI to the CMS media image file
-
getTranslationsForName
public de.intranda.metadata.multilanguage.IMetadataValue getTranslationsForName()getTranslationsForName.- Specified by:
getTranslationsForNamein interfaceBrowseElementInfo- Returns:
- the multilingual name translations for this browse element
-
getTranslationsForDescription
public de.intranda.metadata.multilanguage.IMetadataValue getTranslationsForDescription()getTranslationsForDescription.- Specified by:
getTranslationsForDescriptionin interfaceBrowseElementInfo- Returns:
- the multilingual metadata value containing description translations for all configured languages
-
getTranslationsForAlternativeText
public de.intranda.metadata.multilanguage.IMetadataValue getTranslationsForAlternativeText()getTranslationsForAlternativeText.- Returns:
- the multilingual metadata value containing alternative text translations for all configured languages
-
isFinished
isFinished.- Parameters:
locale- locale to check for a non-blank name entry- Returns:
- true if the metadata name for the given locale is non-blank, false otherwise
-
getFinishedLocales
getFinishedLocales.- Returns:
- a list of locales for which this media item has a non-blank name translation
-
compareTo
- Specified by:
compareToin interfaceComparable<CMSMediaItem>
-
getLastModifiedTime
Getter for the fieldlastModifiedTime.- Returns:
- the lastModifiedTime. May be null only if no file exists or last modified time cannot be read
-
getFilePath
getFilePath.- Returns:
- the filesystem path to the CMS media file
-
wrapCategories
wrapCategories.- Parameters:
categories- all available categories to wrap with selection state- Returns:
- the categoryMap. Never null. If it isn't defined yet, create a map from all categories
-