fr.paris.lutece.plugins.form.business
Class AbstractEntryTypeUpload

java.lang.Object
  extended by fr.paris.lutece.plugins.form.business.Entry
      extended by fr.paris.lutece.plugins.form.business.AbstractEntryTypeUpload
All Implemented Interfaces:
IEntry
Direct Known Subclasses:
EntryTypeFile, EntryTypeImage

public abstract class AbstractEntryTypeUpload
extends Entry

AbstractEntryTypeUpload


Field Summary
protected static java.lang.String ALL
           
protected static java.lang.String COMMA
           
protected static java.lang.String CONSTANT_FILE_MAX_SIZE
           
protected static java.lang.String CONSTANT_MAX_FILES
           
protected static java.lang.String PARAMETER_FILE_MAX_SIZE
           
protected static java.lang.String PARAMETER_MAX_FILES
           
 
Fields inherited from class fr.paris.lutece.plugins.form.business.Entry
EMPTY_STRING, FIELD_COMMENT, FIELD_CONFIRM_FIELD, FIELD_CONFIRM_FIELD_TITLE, FIELD_HEIGHT, FIELD_HELP_MESSAGE, FIELD_INSERT_GROUP, FIELD_MANDATORY, FIELD_MAX_SIZE_ENTER, FIELD_PRESENTATION, FIELD_TITLE, FIELD_VALUE, FIELD_WIDTH, JSP_DOWNLOAD_FILE, MARK_ENTRY, MESSAGE_CONFIRM_FIELD, MESSAGE_MANDATORY_FIELD, MESSAGE_MAXLENGTH, MESSAGE_MYLUTECE_AUTHENTIFICATION_REQUIRED, MESSAGE_NUMERIC_FIELD, MESSAGE_UNIQUE_FIELD, MESSAGE_XSS_FIELD, PARAMETER_COMMENT, PARAMETER_CONFIRM_FIELD, PARAMETER_CONFIRM_FIELD_TITLE, PARAMETER_FIELD_IN_LINE, PARAMETER_HEIGHT, PARAMETER_HELP_MESSAGE, PARAMETER_MANDATORY, PARAMETER_MAX_SIZE_ENTER, PARAMETER_TITLE, PARAMETER_UNIQUE, PARAMETER_VALUE, PARAMETER_WIDTH, SUFFIX_CONFIRM_FIELD
 
Constructor Summary
AbstractEntryTypeUpload()
           
 
Method Summary
 FormError canUploadFiles(java.util.List<org.apache.commons.fileupload.FileItem> listUploadedFileItems, java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload, java.util.Locale locale)
          Check if the file can be uploaded or not.
protected  java.lang.String checkEntryData(javax.servlet.http.HttpServletRequest request, java.util.Locale locale)
          Check the entry data
protected abstract  FormError checkResponseData(org.apache.commons.fileupload.FileItem fileItem, java.util.Locale locale)
          Check the response data for a single file item
protected  FormError checkResponseData(java.util.List<org.apache.commons.fileupload.FileItem> listFilesSource, java.util.Locale locale, javax.servlet.http.HttpServletRequest request)
          Check the record field data
protected  java.util.List<org.apache.commons.fileupload.FileItem> getFileSources(javax.servlet.http.HttpServletRequest request)
          Get the file source from the session
protected  void setFields(javax.servlet.http.HttpServletRequest request)
          Set the list of fields
protected abstract  void setFields(javax.servlet.http.HttpServletRequest request, java.util.List<Field> listFields)
          Set the fields
 
Methods inherited from class fr.paris.lutece.plugins.form.business.Entry
getChildren, getComment, getConfirmFieldTitle, getEntryType, getFieldDepend, getFields, getForm, getFormError, getHelpMessage, getHtmlCode, getIdEntry, getMapProvider, getNumberConditionalQuestion, getPaginator, getPaginator, getParent, getPosition, getReferenceListRegularExpression, getRequestData, getResponseData, getResponseValueForExport, getResponseValueForRecap, getTemplateCreate, getTemplateModify, getTitle, isConfirmField, isFieldInLine, isFile, isFirstInTheList, isLastInTheList, isMandatory, isUnique, setChildren, setComment, setConfirmField, setConfirmFieldTitle, setEntryType, setFieldDepend, setFieldInLine, setFields, setFirstInTheList, setForm, setFormError, setHelpMessage, setIdEntry, setLastInTheList, setMandatory, setMapProvider, setNumberConditionalQuestion, setParent, setPosition, setResponseToStringValue, setTitle, setUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_MAX_FILES

protected static final java.lang.String PARAMETER_MAX_FILES
See Also:
Constant Field Values

PARAMETER_FILE_MAX_SIZE

protected static final java.lang.String PARAMETER_FILE_MAX_SIZE
See Also:
Constant Field Values

CONSTANT_MAX_FILES

protected static final java.lang.String CONSTANT_MAX_FILES
See Also:
Constant Field Values

CONSTANT_FILE_MAX_SIZE

protected static final java.lang.String CONSTANT_FILE_MAX_SIZE
See Also:
Constant Field Values

ALL

protected static final java.lang.String ALL
See Also:
Constant Field Values

COMMA

protected static final java.lang.String COMMA
See Also:
Constant Field Values
Constructor Detail

AbstractEntryTypeUpload

public AbstractEntryTypeUpload()
Method Detail

setFields

protected abstract void setFields(javax.servlet.http.HttpServletRequest request,
                                  java.util.List<Field> listFields)
Set the fields

Parameters:
request - the HTTP request
listFields - the list of fields to set

checkResponseData

protected abstract FormError checkResponseData(org.apache.commons.fileupload.FileItem fileItem,
                                               java.util.Locale locale)
Check the response data for a single file item

Parameters:
fileItem - the file item
locale - the locale
Returns:
form error if there is an error

canUploadFiles

public FormError canUploadFiles(java.util.List<org.apache.commons.fileupload.FileItem> listUploadedFileItems,
                                java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload,
                                java.util.Locale locale)
Check if the file can be uploaded or not. This method will check the size of each file and the number max of files that can be uploaded.

Specified by:
canUploadFiles in interface IEntry
Overrides:
canUploadFiles in class Entry
Parameters:
listUploadedFileItems - the list of uploaded files
listFileItemsToUpload - the list of files to upload
locale - the locale
Returns:
form error if there is an error

checkEntryData

protected java.lang.String checkEntryData(javax.servlet.http.HttpServletRequest request,
                                          java.util.Locale locale)
Check the entry data

Parameters:
request - the HTTP request
locale - the locale
Returns:
the error message url if there is an error, an empty string otherwise

checkResponseData

protected FormError checkResponseData(java.util.List<org.apache.commons.fileupload.FileItem> listFilesSource,
                                      java.util.Locale locale,
                                      javax.servlet.http.HttpServletRequest request)
Check the record field data

Parameters:
fileSource - the file source to upload
locale - the locale
request - the HTTP request
Returns:
form error exception if there is an error

getFileSources

protected java.util.List<org.apache.commons.fileupload.FileItem> getFileSources(javax.servlet.http.HttpServletRequest request)
Get the file source from the session

Parameters:
request - the HttpServletRequest
session - the HttpSession
Returns:
the file item

setFields

protected void setFields(javax.servlet.http.HttpServletRequest request)
Set the list of fields

Parameters:
request - the HTTP request


Copyright © 2012 Mairie de Paris. All Rights Reserved.