org.silverpeas.upload
Class UploadedFile

java.lang.Object
  extended by org.silverpeas.upload.UploadedFile

public class UploadedFile
extends Object

Representation of an uploaded file.
Each UploadedFile is associated to a unique UploadSession instance. So, it can not be possible to get several UploadedFile from an UploadSession.

Author:
Yohann Chastagnier

Method Summary
static UploadedFile from(javax.servlet.http.HttpServletRequest request, String uploadSessionId, UserDetail uploader)
          Creates a representation of an uploaded file from HttpServletRequest and a given uploaded file identifier.
 String getDescription()
          Gets the description filled by the user for the uploaded file.
 File getFile()
          Gets the uploaded file.
 String getTitle()
          Gets the title filled by the user for the uploaded file.
 UploadSession getUploadSession()
          Gets the identifier of the uploaded file.
 void registerAttachment(WAPrimaryKey resourcePk, String contributionLanguage)
          Register an attachment attached in relation to the given contribution identifiers.
 void registerAttachment(WAPrimaryKey resourcePk, String contributionLanguage, boolean indexIt)
          Register an attachment in relation to the given contribution identifiers.
 SimpleDocument retrieveSimpleDocument(WAPrimaryKey resourcePk, String contributionLanguage)
          Retrieve the SimpleDocument in relation with uploaded file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

from

public static UploadedFile from(javax.servlet.http.HttpServletRequest request,
                                String uploadSessionId,
                                UserDetail uploader)
Creates a representation of an uploaded file from HttpServletRequest and a given uploaded file identifier.

Parameters:
request -
uploadSessionId -
uploader -
Returns:

getUploadSession

public UploadSession getUploadSession()
Gets the identifier of the uploaded file.

Returns:

getFile

public File getFile()
Gets the uploaded file.

Returns:

getTitle

public String getTitle()
Gets the title filled by the user for the uploaded file.

Returns:

getDescription

public String getDescription()
Gets the description filled by the user for the uploaded file.

Returns:

registerAttachment

public void registerAttachment(WAPrimaryKey resourcePk,
                               String contributionLanguage)
Register an attachment attached in relation to the given contribution identifiers. Please notice that the original 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 attachments ...

Parameters:
resourcePk -
contributionLanguage -

registerAttachment

public void registerAttachment(WAPrimaryKey resourcePk,
                               String contributionLanguage,
                               boolean indexIt)
Register an attachment in relation to the given contribution identifiers. Please notice that the original 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 attachments ...

Parameters:
resourcePk -
contributionLanguage -
indexIt -

retrieveSimpleDocument

public SimpleDocument retrieveSimpleDocument(WAPrimaryKey resourcePk,
                                             String contributionLanguage)
Retrieve the SimpleDocument in relation with uploaded file. 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 attachments ...

Parameters:
contributionLanguage - (be careful, not the user language ...)
Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.