Class WbeFile

  • All Implemented Interfaces:
    Securable
    Direct Known Subclasses:
    SimpleWbeFile, WbeFileWrapper, WebdavWbeFile

    public abstract class WbeFile
    extends Object
    implements Securable
    Representation of a Silverpeas's file exposed to the Office infrastructure.

    The instance is not immutable and data returned by different signatures of a same instance MAY not the same during the time.

    Author:
    silveryocha
    • Constructor Detail

      • WbeFile

        public WbeFile()
    • Method Detail

      • silverpeasId

        public abstract String silverpeasId()
        Silverpeas's identifier identifies the file from point of view of Silverpeas's platform.

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

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

        Returns:
        a unique identifier as string.
      • id

        public String id()
        A File ID is a string that represents a file being operated on via WBE operations. A host must issue a unique ID for any file used by a WBE client. The client will, in turn, include the file ID when making requests to the WBE 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
        • 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.

        Returns:
        a unique identifier as string.
      • owner

        public abstract User owner()
        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.
        Returns:
        the User which is the owner.
      • name

        public abstract String name()
        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.
        Returns:
        a string representing a file name.
      • ext

        public String ext()
        Gets the extension of the file.
        Returns:
        a string representing a mime-type.
      • mimeType

        public abstract String mimeType()
        Gets the mime type of the file.
        Returns:
        a string representing a mime-type.
      • size

        public abstract long size()
        Gets the size of the file in bytes.
        Returns:
        a long representing a file content length.
      • version

        public String version()
        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.
        Returns:
        a version value as string.
      • updateFrom

        public abstract void updateFrom​(InputStream input)
                                 throws IOException
        Updates the content of underlying Silverpeas's file from data provided by the given InputStream.
        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 abstract void loadInto​(OutputStream output)
                               throws IOException
        Loads the content of the underlying Silverpeas's file into the given OutputStream.
        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 WbeFileLock lock()
        Gets the current lock identifier.
        Returns:
        a string.
      • setLastEditionDateAtNow

        public void setLastEditionDateAtNow()
        Updates the last edition date with the current date and time.