Class WopiFileWrapper

  • All Implemented Interfaces:
    Securable

    public class WopiFileWrapper
    extends WopiFile
    This WRAPPER is used by WOPI host and gives the possibility to add functionality contextualized to a WopiFile.
    Author:
    silveryocha
    • Method Detail

      • silverpeasId

        public String silverpeasId()
        Description copied from class: WopiFile
        Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.

        In most of case, WopiFile.id() will return same identifier as WopiFile.silverpeasId() returns.

        But sometimes, when a temporary view exists for a file and that the temporary view is the content exposed for modifications, WopiFile.silverpeasId() returns the identifier of the document and WopiFile.id() returns the identifier of the view (the one used by WOPI exchanges).

        Specified by:
        silverpeasId in class WopiFile
        Returns:
        a unique identifier as string.
      • id

        public String id()
        Description copied from class: WopiFile
        A File ID is a string that represents a file being operated on via WOPI operations. A host must issue a unique ID for any file used by a WOPI client. The client will, in turn, include the file ID when making requests to the WOPI host. Thus, a host must be able to use the file ID to locate a particular file.

        A file ID must:

        • Represent a single file.
        • Be an URL-safe string because IDs are passed in URLs, principally via the WOPISrc parameter.
        • Remain the same when the file is edited.
        • Remain the same when the file is moved or renamed.
        • Remain the same when any ancestor container, including the parent container, is renamed .
        • In the case of shared files, the ID for a given file must be the same for every user that accesses the file.

        Overrides:
        id in class WopiFile
        Returns:
        a unique identifier as string.
      • owner

        public User owner()
        Description copied from class: WopiFile
        A string that uniquely identifies the owner of the file. In most cases, the user who uploaded or created the file should be considered the owner.
        Specified by:
        owner in class WopiFile
        Returns:
        the User which is the owner.
      • name

        public String name()
        Description copied from class: WopiFile
        Gets the string name of the file, including extension, without a path. Used for display in user interface (UI), and determining the extension of the file.
        Specified by:
        name in class WopiFile
        Returns:
        a string representing a file name.
      • ext

        public String ext()
        Description copied from class: WopiFile
        Gets the extension of the file.
        Overrides:
        ext in class WopiFile
        Returns:
        a string representing a mime-type.
      • mimeType

        public String mimeType()
        Description copied from class: WopiFile
        Gets the mime type of the file.
        Specified by:
        mimeType in class WopiFile
        Returns:
        a string representing a mime-type.
      • size

        public long size()
        Description copied from class: WopiFile
        Gets the size of the file in bytes.
        Specified by:
        size in class WopiFile
        Returns:
        a long representing a file content length.
      • version

        public String version()
        Description copied from class: WopiFile
        The current version of the file based on the server’s file version schema, as a string. This value must change when the file changes, and version values must never repeat for a given file.
        Overrides:
        version in class WopiFile
        Returns:
        a version value as string.
      • updateFrom

        public void updateFrom​(InputStream input)
                        throws IOException
        Description copied from class: WopiFile
        Updates the content of underlying Silverpeas's file from data provided by the given InputStream.
        Specified by:
        updateFrom in class WopiFile
        Parameters:
        input - an InputStream from which the data are written.
        Throws:
        IOException - when it is not possible to write into the physical file.
      • loadInto

        public void loadInto​(OutputStream output)
                      throws IOException
        Description copied from class: WopiFile
        Loads the content of the underlying Silverpeas's file into the given OutputStream.
        Specified by:
        loadInto in class WopiFile
        Parameters:
        output - the stream into which content file MUST be loaded.
        Throws:
        IOException - when it is not possible to read the physical file.
      • lock

        public WopiFileLock lock()
        Description copied from class: WopiFile
        Gets the current lock identifier.
        Overrides:
        lock in class WopiFile
        Returns:
        a string.
      • canBeAccessedBy

        public boolean canBeAccessedBy​(User user)
        Description copied from interface: Securable
        Indicates if the given user can access this resource.
        Parameters:
        user - a user in Silverpeas.
        Returns:
        true if the user can access the data managed by this instance, false otherwise.
      • canBeModifiedBy

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

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