Class Media
java.lang.Object
org.silverpeas.components.gallery.model.Media
- All Implemented Interfaces:
Serializable,org.silverpeas.core.contribution.model.Contribution,org.silverpeas.core.contribution.model.SilverpeasContent,org.silverpeas.core.contribution.model.WithPermanentLink,org.silverpeas.core.contribution.model.WithURL,org.silverpeas.core.Identifiable,org.silverpeas.core.Instance<org.silverpeas.core.contribution.model.Contribution>,org.silverpeas.core.Nameable,org.silverpeas.core.security.Securable,org.silverpeas.core.SilverpeasResource
- Direct Known Subclasses:
InternalMedia,Streaming
public abstract class Media
extends Object
implements org.silverpeas.core.contribution.model.SilverpeasContent, Serializable, org.silverpeas.core.contribution.model.WithPermanentLink, org.silverpeas.core.contribution.model.WithURL
This class represents a Media and provides all the common data.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.silverpeas.core.process.io.file.FileBasePath -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToAlbums(String... albumIds) Adds the current media to the album represented by specified identifiers.booleancanBeAccessedBy(org.silverpeas.core.admin.user.model.User user) booleangetApplicationEmbedUrl(MediaResolution mediaResolution) Gets the Application URL thumbnail of the media according the specified media resolution.Gets the original URL of a media with cache handling.getApplicationThumbnailUrl(MediaResolution mediaResolution) Gets the Application URL thumbnail of the media according the specified media resolution.abstract MediagetCopy()Creates a copy of the instance.org.silverpeas.core.admin.user.model.Userorg.silverpeas.core.io.file.SilverpeasFilegetFile(MediaResolution mediaResolution) Gets the Silverpeas file.abstract org.silverpeas.core.io.file.SilverpeasFilegetFile(MediaResolution mediaResolution, String size) Gets the Silverpeas file.protected org.silverpeas.core.admin.user.model.SilverpeasRolegetHighestUserRole(org.silverpeas.core.admin.user.model.User user) Retrieve the highest user rolegetId()Gets the internal media instance if type of the current media isMediaType.PhotoorMediaType.VideoorMediaType.Sound.org.silverpeas.core.admin.user.model.UserGets the permalink of a media.getPhoto()Gets the photo instance if type of the current media isMediaType.Photo.getSound()Gets the sound instance if type of the current media isMediaType.Sound.Gets the streaming instance if type of the current media isMediaType.Streaming.getTitle()abstract MediaTypegetType()getURL()getVideo()Gets the video instance if type of the current media isMediaType.Video.org.silverpeas.core.date.period.PeriodGets the sub folder name of the media in the Silverpeas workspace.inthashCode()booleanIndicated if the download is possible.booleanIndicates if the media is previewable.booleanprotected booleanvoidRemoves the current media from all albums which it is attached to.voidvoidsetComponentInstanceId(String instanceId) voidsetCreationDate(Date createDate) voidsetCreator(org.silverpeas.core.admin.user.model.User creator) voidsetCreatorId(String creatorId) voidsetDescription(String description) voidvoidsetKeyWord(String keyWord) voidsetLastUpdateDate(Date lastUpdateDate) voidsetLastUpdatedBy(String lastUpdatedBy) voidsetLastUpdater(org.silverpeas.core.admin.user.model.User lastUpdater) voidsetMediaPK(MediaPK mediaPK) voidsetSilverpeasContentId(String silverpeasContentId) voidvoidsetToAlbums(String... albumIds) Sets the current media to the album represented by specified identifiers.voidsetVisibilityPeriod(org.silverpeas.core.date.period.Period visibilityPeriod) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.silverpeas.core.contribution.model.Contribution
getModel, getName, getResourcePath, isIndexableMethods inherited from interface org.silverpeas.core.Instance
getParentMethods inherited from interface org.silverpeas.core.security.Securable
canBeDeletedBy, canBeFiledInBy, canBeModifiedByMethods inherited from interface org.silverpeas.core.contribution.model.SilverpeasContent
getIdentifier
-
Field Details
-
BASE_PATH
public static final org.silverpeas.core.process.io.file.FileBasePath BASE_PATH
-
-
Constructor Details
-
Media
protected Media() -
Media
-
-
Method Details
-
getMediaPK
-
setMediaPK
-
setId
-
getId
- Specified by:
getIdin interfaceorg.silverpeas.core.Identifiable- Specified by:
getIdin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent
-
setComponentInstanceId
-
getComponentInstanceId
- Specified by:
getComponentInstanceIdin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent
-
getInstanceId
-
getContributionType
- Specified by:
getContributionTypein interfaceorg.silverpeas.core.contribution.model.Contribution
-
getType
-
getTitle
- Specified by:
getTitlein interfaceorg.silverpeas.core.contribution.model.Contribution
-
setTitle
-
getDescription
- Specified by:
getDescriptionin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
getDescriptionin interfaceorg.silverpeas.core.Nameable
-
setDescription
-
getAuthor
-
setAuthor
-
getKeyWord
-
setKeyWord
-
getVisibilityPeriod
public org.silverpeas.core.date.period.Period getVisibilityPeriod() -
setVisibilityPeriod
public void setVisibilityPeriod(org.silverpeas.core.date.period.Period visibilityPeriod) -
isVisible
public boolean isVisible() -
isVisible
-
getCreationDate
- Specified by:
getCreationDatein interfaceorg.silverpeas.core.SilverpeasResource
-
setCreationDate
-
getCreator
public org.silverpeas.core.admin.user.model.User getCreator()- Specified by:
getCreatorin interfaceorg.silverpeas.core.SilverpeasResource
-
setCreator
public void setCreator(org.silverpeas.core.admin.user.model.User creator) -
getCreatorId
-
setCreatorId
-
getCreatorName
-
getLastUpdateDate
- Specified by:
getLastUpdateDatein interfaceorg.silverpeas.core.SilverpeasResource
-
setLastUpdateDate
-
getLastUpdater
public org.silverpeas.core.admin.user.model.User getLastUpdater()- Specified by:
getLastUpdaterin interfaceorg.silverpeas.core.SilverpeasResource
-
setLastUpdater
public void setLastUpdater(org.silverpeas.core.admin.user.model.User lastUpdater) -
getLastUpdatedBy
-
setLastUpdatedBy
-
getLastUpdaterName
-
canBeAccessedBy
public boolean canBeAccessedBy(org.silverpeas.core.admin.user.model.User user) - Specified by:
canBeAccessedByin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
canBeAccessedByin interfaceorg.silverpeas.core.security.Securable
-
getWorkspaceSubFolderName
Gets the sub folder name of the media in the Silverpeas workspace.- Returns:
- the sub folder name of the media.
-
getPermalink
Gets the permalink of a media.- Specified by:
getPermalinkin interfaceorg.silverpeas.core.contribution.model.WithPermanentLink- Returns:
- the permalink string of a media.
-
isPreviewable
public boolean isPreviewable()Indicates if the media is previewable.- Returns:
- true if the media is previewable, false otherwise.
-
getApplicationThumbnailUrl
Gets the Application URL thumbnail of the media according the specified media resolution.- Parameters:
mediaResolution- resolution of the media- Returns:
- the URL of media thumbnail.
-
getApplicationEmbedUrl
Gets the Application URL thumbnail of the media according the specified media resolution.- Parameters:
mediaResolution- the media resolution- Returns:
- the URL of media thumbnail.
-
getApplicationOriginalUrl
Gets the original URL of a media with cache handling.- Returns:
- the URL of the media
-
getFile
Gets the Silverpeas file.- Parameters:
mediaResolution- the aimed resolution.- Returns:
- a
SilverpeasFileinstance which could represents also a non-existing file.
-
getFile
public abstract org.silverpeas.core.io.file.SilverpeasFile getFile(MediaResolution mediaResolution, String size) Gets the Silverpeas file.- Parameters:
mediaResolution- the aimed resolution.size- a specific size applied on the aimed resolution, ignored if not defined.- Returns:
- a
SilverpeasFileinstance which could represents also a non-existing file.
-
getSilverpeasContentId
- Specified by:
getSilverpeasContentIdin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent
-
setSilverpeasContentId
-
isDownloadable
public boolean isDownloadable()Indicated if the download is possible.- Returns:
- true if download is possible, false otherwise.
-
getURL
- Specified by:
getURLin interfaceorg.silverpeas.core.contribution.model.WithURL
-
toString
-
equals
-
hashCode
public int hashCode() -
getInternalMedia
Gets the internal media instance if type of the current media isMediaType.PhotoorMediaType.VideoorMediaType.Sound.- Returns:
- internal media instance, null if media type is not
MediaType.PhotoorMediaType.VideoorMediaType.Sound.
-
getPhoto
Gets the photo instance if type of the current media isMediaType.Photo.- Returns:
- photo instance, null if media type is not
MediaType.Photo.
-
getVideo
Gets the video instance if type of the current media isMediaType.Video.- Returns:
- video instance, null if media type is not
MediaType.Video.
-
getSound
Gets the sound instance if type of the current media isMediaType.Sound.- Returns:
- sound instance, null if media type is not
MediaType.Sound.
-
getStreaming
Gets the streaming instance if type of the current media isMediaType.Streaming.- Returns:
- streaming instance, null if media type is not
MediaType.Streaming.
-
removeFromAllAlbums
public void removeFromAllAlbums()Removes the current media from all albums which it is attached to. -
addToAlbums
Adds the current media to the album represented by specified identifiers.- Parameters:
albumIds- the identifier of albums.
-
setToAlbums
Sets the current media to the album represented by specified identifiers. (all not specified album attachments will be deleted)- Parameters:
albumIds- the identifier of albums.
-
getHighestUserRole
protected org.silverpeas.core.admin.user.model.SilverpeasRole getHighestUserRole(org.silverpeas.core.admin.user.model.User user) Retrieve the highest user role- Parameters:
user- the current user detail- Returns:
- the highest user role
-
getCopy
Creates a copy of the instance.- Returns:
- the new instance.
-