fr.paris.lutece.plugins.genericattributes.service.upload
Class AbstractAsynchronousUploadHandler

java.lang.Object
  extended by fr.paris.lutece.plugins.genericattributes.service.upload.AbstractAsynchronousUploadHandler
All Implemented Interfaces:
IGAAsyncUploadHandler, fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler

public abstract class AbstractAsynchronousUploadHandler
extends Object
implements IGAAsyncUploadHandler

AbstractAsynchronousUploadHandler.

See Also:
getFileItems(String, String), removeFileItem(String, String, int)

Constructor Summary
AbstractAsynchronousUploadHandler()
           
 
Method Summary
 void addFileItemToUploadedFile(org.apache.commons.fileupload.FileItem fileItem, String strIdEntry, String strSessionId)
          Add file item to the list of uploaded files
 String buildFieldName(String strIdEntry)
          Build the field name from a given id entry i.e. : form_1
 void doRemoveFile(javax.servlet.http.HttpServletRequest request, String strIdEntry)
          Do remove a file of a given entry if a flag is present in the request.
 void doUploadAction(javax.servlet.http.HttpServletRequest request, String strUploadAction)
          Performs an upload action.
 List<org.apache.commons.fileupload.FileItem> getFileItems(String strIdEntry, String strSessionId)
          Gets the fileItem for the entry and the given session.
 String getUploadAction(javax.servlet.http.HttpServletRequest request)
          Checks the request parameters to see if an upload submit has been called.
abstract  String getUploadCheckboxPrefix()
          Get the upload checkbox prefix
abstract  String getUploadDeletePrefix()
          Get the upload delete prefix
abstract  String getUploadSubmitPrefix()
          Get the upload submit prefix
 boolean hasAddFileFlag(javax.servlet.http.HttpServletRequest request, String strIdEntry)
          Check if the request has the flag to submit a file without submitting the form.
 boolean hasRemoveFlag(javax.servlet.http.HttpServletRequest request, String strIdEntry)
          Check if the request has a remove flag for a given entry.
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.sf.json.JSONObject mainObject, List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)
          
 void removeFileItem(String strIdEntry, String strSessionId, int nIndex)
          Remove file Item
 void removeSessionFiles(String strSessionId)
          Removes all files associated to the session
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler
isInvoked
 

Constructor Detail

AbstractAsynchronousUploadHandler

public AbstractAsynchronousUploadHandler()
Method Detail

getUploadSubmitPrefix

public abstract String getUploadSubmitPrefix()
Get the upload submit prefix

Returns:
The upload submit prefix

getUploadDeletePrefix

public abstract String getUploadDeletePrefix()
Get the upload delete prefix

Returns:
The upload delete prefix

getUploadCheckboxPrefix

public abstract String getUploadCheckboxPrefix()
Get the upload checkbox prefix

Returns:
The upload checkbox prefix

process

public void process(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response,
                    net.sf.json.JSONObject mainObject,
                    List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)

Specified by:
process in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler

getFileItems

public List<org.apache.commons.fileupload.FileItem> getFileItems(String strIdEntry,
                                                                 String strSessionId)
Gets the fileItem for the entry and the given session.

Specified by:
getFileItems in interface IGAAsyncUploadHandler
Parameters:
strIdEntry - the entry
strSessionId - The id of the session of the current user
Returns:
the fileItem found, null otherwise.

removeFileItem

public void removeFileItem(String strIdEntry,
                           String strSessionId,
                           int nIndex)
Remove file Item

Specified by:
removeFileItem in interface IGAAsyncUploadHandler
Parameters:
strIdEntry - the id entry
strSessionId - The id of the session of the current user
nIndex - the index

removeSessionFiles

public void removeSessionFiles(String strSessionId)
Removes all files associated to the session

Parameters:
strSessionId - the session id

getUploadAction

public String getUploadAction(javax.servlet.http.HttpServletRequest request)
Checks the request parameters to see if an upload submit has been called.

Parameters:
request - the HTTP request
Returns:
the name of the upload action, if any. Null otherwise.

doUploadAction

public void doUploadAction(javax.servlet.http.HttpServletRequest request,
                           String strUploadAction)
Performs an upload action.

Parameters:
request - the HTTP request
strUploadAction - the name of the upload action

doRemoveFile

public void doRemoveFile(javax.servlet.http.HttpServletRequest request,
                         String strIdEntry)
Do remove a file of a given entry if a flag is present in the request. Files are selected from the request.

Specified by:
doRemoveFile in interface IGAAsyncUploadHandler
Parameters:
request - The request
strIdEntry - The id of the entry

addFileItemToUploadedFile

public void addFileItemToUploadedFile(org.apache.commons.fileupload.FileItem fileItem,
                                      String strIdEntry,
                                      String strSessionId)
Add file item to the list of uploaded files

Specified by:
addFileItemToUploadedFile in interface IGAAsyncUploadHandler
Parameters:
fileItem - the file item
strIdEntry - the id entry
strSessionId - the session id

hasRemoveFlag

public boolean hasRemoveFlag(javax.servlet.http.HttpServletRequest request,
                             String strIdEntry)
Check if the request has a remove flag for a given entry.

Specified by:
hasRemoveFlag in interface IGAAsyncUploadHandler
Parameters:
request - The request
strIdEntry - The id of the entry
Returns:
True if the request has a remove flag for the given entry, false otherwise

hasAddFileFlag

public boolean hasAddFileFlag(javax.servlet.http.HttpServletRequest request,
                              String strIdEntry)
Check if the request has the flag to submit a file without submitting the form.

Parameters:
request - The request
strIdEntry - The id of the entry
Returns:
True if the flag is present in the request, false otherwise

buildFieldName

public String buildFieldName(String strIdEntry)
Build the field name from a given id entry i.e. : form_1

Parameters:
strIdEntry - the id entry
Returns:
the field name


Copyright © 2014 Mairie de Paris. All Rights Reserved.