Class Document

    • Constructor Detail

      • Document

        public Document​(ContributionIdentifier id)
        Constructs a new document with the specified identifier.
        Parameters:
        id - a unique identifier of a document.
      • Document

        public Document​(SimpleDocument master)
        Constructs a new document from the specified document file to be used as the master of the document.
        Parameters:
        master - document file to use as master.
    • Method Detail

      • getTitle

        public String getTitle()
        Description copied from interface: Contribution
        Gets the title of this contribution if any. By default returns an empty String.
        Specified by:
        getTitle in interface Attachment
        Specified by:
        getTitle in interface Contribution
        Returns:
        the contribution's title in the specified language. Can be empty if no title was set or no title is defined for a such contribution.
      • getContentType

        public String getContentType()
        Description copied from interface: Attachment
        Gets the content type of this attached document file as a predefined MIME type.
        Specified by:
        getContentType in interface Attachment
        Returns:
        the MIME type of the document.
      • getDisplayIcon

        public String getDisplayIcon()
        Description copied from interface: Attachment
        Gets the path of the icon representing either the attachment itself or its content type.
        Specified by:
        getDisplayIcon in interface Attachment
        Returns:
        the path of the icon representing this attachment.
      • getFilename

        public String getFilename()
        Description copied from interface: Attachment
        Gets the name of the document file as stored in the filesystem. The filename can differ from the contribution name that is the title of the document.
        Specified by:
        getFilename in interface Attachment
        Returns:
        the name of the document file in the filesystem.
      • getSize

        public long getSize()
        Description copied from interface: Attachment
        Gets the size of the document file in the filesystem.
        Specified by:
        getSize in interface Attachment
        Returns:
        the size in bytes.
      • getAttachmentPath

        public String getAttachmentPath()
        Description copied from interface: Attachment
        Gets the absolute path of the document file in the filesystem.
        Specified by:
        getAttachmentPath in interface Attachment
        Returns:
        the path of the attachment in the filesystem.
      • isVersioned

        public boolean isVersioned()
        Description copied from interface: Attachment
        Is this attachment versioned? A document is versioned if each change is historized and comes to a new minor or major version.
        Specified by:
        isVersioned in interface Attachment
        Returns:
        true if this attachment is versioned, false otherwise.
      • getMinorVersion

        public int getMinorVersion()
        Description copied from interface: Attachment
        Gets the minor part of the document version. If the attachment isn't versioned, then zero value is returned.
        Specified by:
        getMinorVersion in interface Attachment
        Returns:
        the minor version part of the document.
      • getMajorVersion

        public int getMajorVersion()
        Description copied from interface: Attachment
        Gets the major part of the document version. If the attachment isn't versioned, then zero value is returned.
        Specified by:
        getMajorVersion in interface Attachment
        Returns:
        the major version part of the document.
      • getTranslation

        public SimpleDocument getTranslation​(String language)
        Description copied from interface: Translatable
        Gets a translation in the specified language about some textual properties of the object. If no such translation exists, then returns the default translation of the object.
        Specified by:
        getTranslation in interface LocalizedResource
        Specified by:
        getTranslation in interface Translatable
        Parameters:
        language - the ISO 631-1 code of a language.
        Returns:
        a translation of the object in the given language. Can be never null.
      • getAllTranslations

        public List<SimpleDocument> getAllTranslations()
        Gets all the translations available for this document.
        Returns:
        a list of SimpleDocument instances, each of them being a document file of this document written in a given language. If no translations exist, otherwise if this document doesn't exist yet, then an empty list is returned.
      • getLastUpdateDate

        public Date getLastUpdateDate()
        Description copied from interface: SilverpeasResource
        Gets the date at which the resource has been lastly updated. If the resource doesn't have such an information, then this method should return the date of the resource creation.
        Specified by:
        getLastUpdateDate in interface SilverpeasResource
        Returns:
        the date of the last update of the resource.
      • getLastUpdater

        public User getLastUpdater()
        Description copied from interface: SilverpeasResource
        Gets the user that has lastly updated the resource. If the resource doesn't have such an information, then this method should return the user that has created the resource.
        Specified by:
        getLastUpdater in interface SilverpeasResource
        Returns:
        a User in Silverpeas.
      • isReadOnly

        public boolean isReadOnly()
      • isEdited

        public boolean isEdited()
      • isEditedBy

        public boolean isEditedBy​(User user)
      • isSharingAllowedForRolesFrom

        public boolean isSharingAllowedForRolesFrom​(User user)
      • canBeAccessedBy

        public boolean canBeAccessedBy​(User user)
        Description copied from interface: Contribution
        Is the specified user can access this contribution?

        By default Securable.canBeAccessedBy(User) is implemented so that a user can access a contribution if it has enough rights to access the application instance in which is managed this contribution.
        Indeed, this behavior is mostly the common one.
        But In the case the application instance distributes its contribution along of a categorization tree and the nodes of this tree support access rights, then the user must have also the rights to access the node to which belongs the content.
        Of course it could exist other access rules...

        Specified by:
        canBeAccessedBy in interface Contribution
        Specified by:
        canBeAccessedBy in interface Securable
        Parameters:
        user - a user in Silverpeas.
        Returns:
        true if the user can access this content, false otherwise.
      • canBeModifiedBy

        public boolean canBeModifiedBy​(User user)
        Description copied from interface: Securable
        Checks the given user can modify this resource. By default, if the user can access this securable resource, then it can also modify it.
        Specified by:
        canBeModifiedBy in interface Securable
        Parameters:
        user - a user in Silverpeas.
        Returns:
        true if the user can modify the data managed by this instance, false otherwise.
      • isDownloadAllowedForRolesFrom

        public boolean isDownloadAllowedForRolesFrom​(User user)
      • isDownloadAllowedForRoles

        public boolean isDownloadAllowedForRoles​(Set<SilverpeasRole> roles)
      • isDownloadAllowedForReaders

        public boolean isDownloadAllowedForReaders()