Class Media

  • All Implemented Interfaces:
    Serializable, org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface, org.silverpeas.core.contribution.model.Contribution, org.silverpeas.core.contribution.model.SilverpeasContent, org.silverpeas.core.contribution.model.WithPermanentLink, 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.contentcontainer.content.SilverContentInterface, Serializable, org.silverpeas.core.contribution.model.WithPermanentLink
    This class represents a Media and provides all the common data.
    See Also:
    Serialized Form
    • Field Detail

      • BASE_PATH

        public static final org.silverpeas.core.process.io.file.FileBasePath BASE_PATH
    • Constructor Detail

      • Media

        public Media()
      • Media

        protected Media​(Media other)
    • Method Detail

      • getMediaPK

        public MediaPK getMediaPK()
      • setMediaPK

        public void setMediaPK​(MediaPK mediaPK)
      • setId

        public void setId​(String mediaId)
      • getId

        public String getId()
        Specified by:
        getId in interface org.silverpeas.core.Identifiable
        Specified by:
        getId in interface org.silverpeas.core.contribution.model.SilverpeasContent
      • setComponentInstanceId

        public void setComponentInstanceId​(String instanceId)
      • getInstanceId

        public String getInstanceId()
        Specified by:
        getInstanceId in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • getContributionType

        public String getContributionType()
        Specified by:
        getContributionType in interface org.silverpeas.core.contribution.model.Contribution
      • getType

        public abstract MediaType getType()
      • getTitle

        public String getTitle()
        Specified by:
        getTitle in interface org.silverpeas.core.contribution.model.Contribution
      • setTitle

        public void setTitle​(String title)
      • getDescription

        public String getDescription()
        Specified by:
        getDescription in interface org.silverpeas.core.contribution.model.Contribution
        Specified by:
        getDescription in interface org.silverpeas.core.Nameable
      • setDescription

        public void setDescription​(String description)
      • getAuthor

        public String getAuthor()
      • setAuthor

        public void setAuthor​(String author)
      • getKeyWord

        public String getKeyWord()
      • setKeyWord

        public void setKeyWord​(String keyWord)
      • 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

        protected boolean isVisible​(Date today)
      • getCreationDate

        public Date getCreationDate()
        Specified by:
        getCreationDate in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
        Specified by:
        getCreationDate in interface org.silverpeas.core.SilverpeasResource
      • setCreationDate

        public void setCreationDate​(Date createDate)
      • getCreator

        public org.silverpeas.core.admin.user.model.User getCreator()
        Specified by:
        getCreator in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
        Specified by:
        getCreator in interface org.silverpeas.core.SilverpeasResource
      • setCreator

        public void setCreator​(org.silverpeas.core.admin.user.model.User creator)
      • getCreatorId

        public String getCreatorId()
        Specified by:
        getCreatorId in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • setCreatorId

        public void setCreatorId​(String creatorId)
      • getCreatorName

        public String getCreatorName()
      • getLastUpdateDate

        public Date getLastUpdateDate()
        Specified by:
        getLastUpdateDate in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
        Specified by:
        getLastUpdateDate in interface org.silverpeas.core.SilverpeasResource
      • setLastUpdateDate

        public void setLastUpdateDate​(Date lastUpdateDate)
      • getLastUpdater

        public org.silverpeas.core.admin.user.model.User getLastUpdater()
        Specified by:
        getLastUpdater in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
        Specified by:
        getLastUpdater in interface org.silverpeas.core.SilverpeasResource
      • setLastUpdater

        public void setLastUpdater​(org.silverpeas.core.admin.user.model.User lastUpdater)
      • getLastUpdatedBy

        public String getLastUpdatedBy()
      • setLastUpdatedBy

        public void setLastUpdatedBy​(String lastUpdatedBy)
      • getLastUpdaterName

        public String getLastUpdaterName()
      • canBeAccessedBy

        public boolean canBeAccessedBy​(org.silverpeas.core.admin.user.model.User user)
        Specified by:
        canBeAccessedBy in interface org.silverpeas.core.contribution.model.Contribution
        Specified by:
        canBeAccessedBy in interface org.silverpeas.core.security.Securable
      • getWorkspaceSubFolderName

        public String getWorkspaceSubFolderName()
        Gets the sub folder name of the media in the Silverpeas workspace.
        Returns:
        the sub folder name of the media.
      • getPermalink

        public String getPermalink()
        Gets the permalink of a media.
        Specified by:
        getPermalink in interface org.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

        public String getApplicationThumbnailUrl​(MediaResolution mediaResolution)
        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

        public String getApplicationEmbedUrl​(MediaResolution mediaResolution)
        Gets the Application URL thumbnail of the media according the specified media resolution.
        Parameters:
        mediaResolution -
        Returns:
        the URL of media thumbnail.
      • getApplicationOriginalUrl

        public String getApplicationOriginalUrl()
        Gets the original URL of a media with cache handling.
        Returns:
        the URL of the media
      • getFile

        public org.silverpeas.core.io.file.SilverpeasFile getFile​(MediaResolution mediaResolution)
        Gets the Silverpeas file.
        Parameters:
        mediaResolution - the aimed resolution.
        Returns:
        a SilverpeasFile instance which could represents also an 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 SilverpeasFile instance which could represents also an non existing file.
      • getSilverpeasContentId

        public String getSilverpeasContentId()
        Specified by:
        getSilverpeasContentId in interface org.silverpeas.core.contribution.model.SilverpeasContent
      • setSilverpeasContentId

        public void setSilverpeasContentId​(String silverpeasContentId)
      • setIconUrl

        public void setIconUrl​(String iconUrl)
      • getIconUrl

        public String getIconUrl()
        Specified by:
        getIconUrl in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • isDownloadable

        public boolean isDownloadable()
        Indicated if the download is possible.
        Returns:
        true if download is possible, false otherwise.
      • getURL

        public String getURL()
        Specified by:
        getURL in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • getDate

        public String getDate()
        Specified by:
        getDate in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • getSilverCreationDate

        public String getSilverCreationDate()
        Specified by:
        getSilverCreationDate in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • getName

        public String getName()
        Specified by:
        getName in interface org.silverpeas.core.contribution.model.Contribution
        Specified by:
        getName in interface org.silverpeas.core.Nameable
        Specified by:
        getName in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • getName

        public String getName​(String language)
        Specified by:
        getName in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • getDescription

        public String getDescription​(String language)
        Specified by:
        getDescription in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • getLanguages

        public Collection<String> getLanguages()
        Specified by:
        getLanguages in interface org.silverpeas.core.contribution.contentcontainer.content.SilverContentInterface
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getPhoto

        public Photo getPhoto()
        Gets the photo instance if type of the current media is MediaType.Photo.
        Returns:
        photo instance, null if media type is not MediaType.Photo.
      • getVideo

        public Video getVideo()
        Gets the video instance if type of the current media is MediaType.Video.
        Returns:
        video instance, null if media type is not MediaType.Video.
      • getSound

        public Sound getSound()
        Gets the sound instance if type of the current media is MediaType.Sound.
        Returns:
        sound instance, null if media type is not MediaType.Sound.
      • removeFromAllAlbums

        public void removeFromAllAlbums()
        Removes the current media from all albums which it is attached to.
      • addToAlbums

        public void addToAlbums​(String... albumIds)
        Adds the current media to the album represented by specified identifiers.
        Parameters:
        albumIds - the identifier of albums.
      • setToAlbums

        public void setToAlbums​(String... albumIds)
        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 highest user role
        Parameters:
        user - the current user detail
        Returns:
        the highest user role
      • getCopy

        public abstract Media getCopy()
        Creates a copy of the instance.
        Returns:
        the new instance.