Class UploadedFile

    • Method Detail

      • from

        public static UploadedFile from​(Map<String,​String[]> parameters,
                                        String uploadSessionId,
                                        User uploader)
        Creates a representation of an uploaded file from the specified file parameters, the upload session identifier and the user uploading the file. identifier.
        Parameters:
        parameters - upload parameters in which are provided data about the file (title, description, ...)
        uploadSessionId - the unique identifier of a files upload session.
        uploader - the user that has uploaded a file.
        Returns:
        an UploadedFile instance corresponding to a file that has been uploaded by a user.
      • getUploadSession

        public UploadSession getUploadSession()
        Gets the upload files session.
        Returns:
        the session in which this file has been uploaded.
      • getFile

        public File getFile()
        Gets the uploaded file.
        Returns:
        a File instance of the uploaded file.
      • getTitle

        public String getTitle()
        Gets the title filled by the user for the uploaded file.
        Returns:
        the title of the content of the file.
      • getDescription

        public String getDescription()
        Gets the description filled by the user for the uploaded file.
        Returns:
        a short description about the content of the file.
      • asFileItem

        public org.apache.commons.fileupload.FileItem asFileItem()
        Converts the current instance into a FileItem one.
        Returns:
        a FileItem instance.
      • registerAttachment

        public void registerAttachment​(ContributionIdentifier contributionId,
                                       String contributionLanguage,
                                       boolean indexIt)
        Registers in Silverpeas a document attached to the given contribution and for which this file stores its content. Please notice that the uploaded content is deleted from its original location. For now, as this method is exclusively used for contribution creations, the treatment doesn't search for existing attachments. In the future and if updates will be handled, the treatment must evolve to search for existing attachment related to the contribution.
        Parameters:
        contributionId - the identifier of a contribution in Silverpeas.
        contributionLanguage - the language in which the contribution is authored.
        indexIt - should the content of the file be indexed?