Class SilverpeasFileDescriptor


  • public class SilverpeasFileDescriptor
    extends Object
    A reference to a SilverpeasFile. It defines some properties about a SilverpeasFile from which it can be located.
    Author:
    mmoquillon
    • Constructor Detail

      • SilverpeasFileDescriptor

        public SilverpeasFileDescriptor​(String componentId)
        Constructs a new reference to a Silverpeas file that belonging to the specified component instance.
        Parameters:
        componentId - the unique identifier of a component instance.
      • SilverpeasFileDescriptor

        public SilverpeasFileDescriptor()
        Constructs a new reference to a Silverpeas file that belonging to no component instance.
    • Method Detail

      • parentDirectory

        public SilverpeasFileDescriptor parentDirectory​(String directory)
        The Silverpeas file referred by this instance is located into the specified directory.
        Parameters:
        directory - the parent directory of the Silverpeas file.
        Returns:
        itself.
      • fileName

        public SilverpeasFileDescriptor fileName​(String fileName)
        The Silverpeas file referred by this instance has the specified name.
        Parameters:
        fileName - the name of the Silverpeas file.
        Returns:
        itself.
      • mimeType

        public SilverpeasFileDescriptor mimeType​(String mimeType)
        The content of the Silverpeas file referred by this instance is of the given MIME type.
        Parameters:
        mimeType - the MIME type of the content of the Silverpeas file.
        Returns:
        itself.
      • temporaryFile

        public SilverpeasFileDescriptor temporaryFile()
        The Silverpeas file is in fact a temporary one and then isn't located among the data of Silverpeas. In this case, the location of the file is computed from the temporary directory of Silverpeas.
        Returns:
        itself.
      • absolutePath

        public SilverpeasFileDescriptor absolutePath()
        The path of the Silverpeas file referred by this descriptor is given as absolute. In this case, either the parent directory is given as an absolute path or, in the case it is not defined, the file name is given as an absolute path.
        Returns:
        itself.
      • getComponentInstanceId

        public String getComponentInstanceId()
        Gets the unique identifier of the component instance that manages the file referred by this descriptor.
        Returns:
        the component instance identifier or null if the file doesn't belong to any Silverpeas component instance.
      • getParentDirectory

        public String getParentDirectory()
        Gets the parent directory to the file as specified in the descriptor.
        Returns:
        the parent directory path or null if no such information is defined in the descriptor.
      • getFileName

        public String getFileName()
        Gets the name of the file referred by this descriptor.
        Returns:
        the filename of the descriptor. The filename can an absolute path of the file (see isAbsolutePath() to know if the descriptor referes an absolute or a relative path).
      • getFilePath

        public String getFilePath()
        Gets the path of the file by taking into account both the parent directory and the filename.
        Returns:
        the relative or absolute path of the described file (see the method isAbsolutePath() to known if the returned path is absolute or relative).
      • getMimeType

        public String getMimeType()
        Gets the MIME type of the file content.
        Returns:
        the MIME type of the file content.
      • isTemporaryFile

        public boolean isTemporaryFile()
        Is the file referred by this descriptor is a temporary one. In a such case, the location of the file is computed from the temporary directory of Silverpeas; the path of the file is then considered as relative to the temporary directory of Silverpeas, whatever the returned value of the isAbsolutePath() method.
        Returns:
        true of the file referred by this descriptor is a temporary one.
      • isAbsolutePath

        public boolean isAbsolutePath()
        Is the parent directory or the file name is provided as an absolute path?
        Returns:
        true of the path of the file referred by this descriptor is provided as absolute, false otherwise.