com.jalios.jcms.upload
Class UploadManager

java.lang.Object
  extended by com.jalios.jcms.upload.UploadManager

public class UploadManager
extends Object


Field Summary
static String REVISION
           
 
Method Summary
static UploadManager getInstance()
          Returns a UploadManager.
 String getUploadComponent(JcmsJspContext ctxt, String pfield)
          Returns a String HTML component for upload.
 String getUploadComponent(JcmsJspContext ctxt, String pfield, String pdrop, String pbrowse, boolean showFiles, boolean showLogs)
          Returns a String HTML component for upload.
 Object getUploadedFile(JcmsContext ctxt, String field, boolean isFileDocument, boolean override)
          Performs upload for the given field to JCMS upload directory.
 List<DocUploadInfo> getUploadedFileList(JcmsContext ctxt, String field, boolean isFileDocument, boolean override)
          Performs upload for the given field to JCMS upload directory.
 void removeAllFileItem(JcmsJspContext ctxt, String token, String field)
           
 org.apache.commons.fileupload.FileItem removeFileItem(JcmsJspContext ctxt, String token, String field, String filename)
          Remove from session the first FileItem with the given name
 Object retrieveFileItem(JcmsContext ctxt, String token, String field)
          Retrieve from session FileItem or List stored in session
 DocUploadInfo retrieveUploadedFile(org.apache.commons.fileupload.FileItem item, boolean isFileDocument, boolean override)
          Performs upload of a given FileItem to JCMS upload directory.
 void storeFileItem(JcmsJspContext ctxt, String token, String field, org.apache.commons.fileupload.FileItem fileItem)
          Store the given FileItem in session to be retrieved later by DocUpload mechanism.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Method Detail

getInstance

public static UploadManager getInstance()
Returns a UploadManager. Singleton method initalized by Channel (not synchronized)

Returns:
PluginManager the UploadManager

getUploadComponent

public String getUploadComponent(JcmsJspContext ctxt,
                                 String pfield)
Returns a String HTML component for upload. Declare required css/js code.

Parameters:
ctxt - the JcmsJspContext
pfield - the field name

getUploadComponent

public String getUploadComponent(JcmsJspContext ctxt,
                                 String pfield,
                                 String pdrop,
                                 String pbrowse,
                                 boolean showFiles,
                                 boolean showLogs)
Returns a String HTML component for upload. Declare required css/js code.

Parameters:
ctxt - the JcmsJspContext
pfield - the field name
pdrop - (optional) label of the drop box (set null to bypass)
pbrowse - (optional) label of the browse button (set null to bypass)
showFiles - boolean true to generate list of files
showLogs - boolean true to generate logs
Returns:
String HTML component

getUploadedFile

public Object getUploadedFile(JcmsContext ctxt,
                              String field,
                              boolean isFileDocument,
                              boolean override)
Performs upload for the given field to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.

Parameters:
ctxt - JcmsContext
field - the submited field
isFileDocument - upload to a FileDocument path upload/docs/...
override - If file already exists, override or rename with current timemillis
Returns:
Object a List of uploaded files (DocUploadInfo) or a DocUploadInfo
Since:
jcms-5.7.0

getUploadedFileList

public List<DocUploadInfo> getUploadedFileList(JcmsContext ctxt,
                                               String field,
                                               boolean isFileDocument,
                                               boolean override)
Performs upload for the given field to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.

Parameters:
ctxt - JcmsContext
field - the submited field
isFileDocument - upload to a FileDocument upload/docs/...
override - If file already exists, override or rename with current timemillis
Returns:
List a List of uploaded files
Since:
jcms-5.7.0

retrieveUploadedFile

public DocUploadInfo retrieveUploadedFile(org.apache.commons.fileupload.FileItem item,
                                          boolean isFileDocument,
                                          boolean override)
Performs upload of a given FileItem to JCMS upload directory. Calling method must handle job around file like creating or updating associated FileDocument.

Parameters:
item - the FileItem handling uploaded file information
isFileDocument - upload to a Filedocument path upload/docs/...
override - If file already exists, override or rename with current timemillis
Returns:
DocUploadInfo the uploaded DocUploadInfo
Since:
jcms-5.7.0

storeFileItem

public void storeFileItem(JcmsJspContext ctxt,
                          String token,
                          String field,
                          org.apache.commons.fileupload.FileItem fileItem)
Store the given FileItem in session to be retrieved later by DocUpload mechanism.

Parameters:
ctxt - the JcmsJspContext
token - String the token used to store the object in session. It identify the page request
field - String the field name
fileItem - the FileItem to store
Since:
jcms-7.0.0

removeFileItem

public org.apache.commons.fileupload.FileItem removeFileItem(JcmsJspContext ctxt,
                                                             String token,
                                                             String field,
                                                             String filename)
Remove from session the first FileItem with the given name

Parameters:
ctxt - the JcmsJspContext
token - String the token used to store the object in session. It identify the page request
field - String the field name
filename - String the name of the FileItem to remove
Returns:
FileItem the removed fileitem or null
Since:
jcms-7.0.0

removeAllFileItem

public void removeAllFileItem(JcmsJspContext ctxt,
                              String token,
                              String field)

retrieveFileItem

public Object retrieveFileItem(JcmsContext ctxt,
                               String token,
                               String field)
Retrieve from session FileItem or List stored in session

Parameters:
ctxt - the JcmsJspContext
token - String the token used to store the object in session. It identify the page request
field - String the field name
Returns:
Object FileItem, List or null
Since:
jcms-7.0.0


Copyright © 2001-2010 Jalios SA. All Rights Reserved.