fr.paris.lutece.plugins.genericattributes.service.entrytype
Class AbstractEntryTypeUpload

java.lang.Object
  extended by fr.paris.lutece.plugins.genericattributes.service.entrytype.EntryTypeService
      extended by fr.paris.lutece.plugins.genericattributes.service.entrytype.AbstractEntryTypeUpload
All Implemented Interfaces:
IEntryTypeService

public abstract class AbstractEntryTypeUpload
extends EntryTypeService

Abstract entry type for uploads


Field Summary
protected static String ALL
           
protected static String COMMA
           
protected static String CONSTANT_EXPORT_BINARY
           
protected static String CONSTANT_FILE_MAX_SIZE
           
protected static String CONSTANT_MAX_FILES
           
protected static String PARAMETER_EXPORT_BINARY
           
protected static String PARAMETER_FILE_MAX_SIZE
           
protected static String PARAMETER_ID_RESPONSE
           
protected static String PARAMETER_MAX_FILES
           
 
Fields inherited from interface fr.paris.lutece.plugins.genericattributes.service.entrytype.IEntryTypeService
FIELD_COMMENT, FIELD_CONFIRM_FIELD_TITLE, FIELD_HEIGHT, FIELD_INSERT_GROUP, FIELD_MAX_SIZE_ENTER, FIELD_TITLE, FIELD_WIDTH, 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_CSS_CLASS, PARAMETER_ERROR_MESSAGE, PARAMETER_FIELD_IN_LINE, PARAMETER_HEIGHT, PARAMETER_HELP_MESSAGE, PARAMETER_MANDATORY, PARAMETER_MAX_SIZE_ENTER, PARAMETER_TITLE, PARAMETER_UNIQUE, PARAMETER_VALUE, PARAMETER_WIDTH, PREFIX_ATTRIBUTE, SUFFIX_CONFIRM_FIELD
 
Constructor Summary
AbstractEntryTypeUpload()
           
 
Method Summary
 GenericAttributeError canUploadFiles(Entry entry, List<org.apache.commons.fileupload.FileItem> listUploadedFileItems, List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload, Locale locale)
          Check if the file can be uploaded or not.
protected  String checkEntryData(javax.servlet.http.HttpServletRequest request, Locale locale)
          Check the entry data
protected  GenericAttributeError checkResponseData(Entry entry, List<org.apache.commons.fileupload.FileItem> listFilesSource, Locale locale, javax.servlet.http.HttpServletRequest request)
          Check the record field data
abstract  IGAAsyncUploadHandler getAsynchronousUploadHandler()
          Get the asynchronous upload handler to use for entries of this type
protected  List<org.apache.commons.fileupload.FileItem> getFileSources(Entry entry, javax.servlet.http.HttpServletRequest request)
          Get the file source from the session
 fr.paris.lutece.util.html.Paginator<?> getPaginator(Entry entry, int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex)
          The paginator who is use in the template modify of the entry
 fr.paris.lutece.portal.web.util.LocalizedPaginator<?> getPaginator(Entry entry, int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex, Locale locale)
          The paginator who is use in the template modify of the entry
 fr.paris.lutece.util.ReferenceList getReferenceListRegularExpression(Entry entry, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of regular expression who is use in the template modify of the entry
 String getRequestData(Entry entry, javax.servlet.http.HttpServletRequest request, Locale locale)
          Get the request data
 String getResponseValueForExport(Entry entry, javax.servlet.http.HttpServletRequest request, Response response, Locale locale)
          Get the response value associate to the entry to export in the file export
 String getResponseValueForRecap(Entry entry, javax.servlet.http.HttpServletRequest request, Response response, Locale locale)
          Get the response value associate to the entry to write in the recap
abstract  String getUrlDownloadFile(int nResponseId, String strBaseUrl)
          Get the URL to download the file of a response
protected  void setFields(Entry entry, javax.servlet.http.HttpServletRequest request)
          Set the list of fields
 void setResponseToStringValue(Entry entry, Response response, Locale locale)
          toStringValue should stay null.
 
Methods inherited from class fr.paris.lutece.plugins.genericattributes.service.entrytype.EntryTypeService
getResponseData
 
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.plugins.genericattributes.service.entrytype.IEntryTypeService
getHtmlCode, getTemplateCreate, getTemplateModify
 

Field Detail

PARAMETER_ID_RESPONSE

protected static final String PARAMETER_ID_RESPONSE
See Also:
Constant Field Values

PARAMETER_MAX_FILES

protected static final String PARAMETER_MAX_FILES
See Also:
Constant Field Values

PARAMETER_FILE_MAX_SIZE

protected static final String PARAMETER_FILE_MAX_SIZE
See Also:
Constant Field Values

PARAMETER_EXPORT_BINARY

protected static final String PARAMETER_EXPORT_BINARY
See Also:
Constant Field Values

CONSTANT_MAX_FILES

protected static final String CONSTANT_MAX_FILES
See Also:
Constant Field Values

CONSTANT_FILE_MAX_SIZE

protected static final String CONSTANT_FILE_MAX_SIZE
See Also:
Constant Field Values

CONSTANT_EXPORT_BINARY

protected static final String CONSTANT_EXPORT_BINARY
See Also:
Constant Field Values

ALL

protected static final String ALL
See Also:
Constant Field Values

COMMA

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

AbstractEntryTypeUpload

public AbstractEntryTypeUpload()
Method Detail

getAsynchronousUploadHandler

public abstract IGAAsyncUploadHandler getAsynchronousUploadHandler()
Get the asynchronous upload handler to use for entries of this type

Returns:
The asynchronous upload handler to use for entries of this type

getUrlDownloadFile

public abstract String getUrlDownloadFile(int nResponseId,
                                          String strBaseUrl)
Get the URL to download the file of a response

Parameters:
nResponseId - The id of the response to download the file of
strBaseUrl - The base URL
Returns:
The URL to redirect the user to download the file

canUploadFiles

public GenericAttributeError canUploadFiles(Entry entry,
                                            List<org.apache.commons.fileupload.FileItem> listUploadedFileItems,
                                            List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload,
                                            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 IEntryTypeService
Overrides:
canUploadFiles in class EntryTypeService
Parameters:
entry - The entry
listUploadedFileItems - the list of uploaded files
listFileItemsToUpload - the list of files to upload
locale - the locale
Returns:
The error if there is any

getResponseValueForExport

public String getResponseValueForExport(Entry entry,
                                        javax.servlet.http.HttpServletRequest request,
                                        Response response,
                                        Locale locale)
Get the response value associate to the entry to export in the file export

Specified by:
getResponseValueForExport in interface IEntryTypeService
Overrides:
getResponseValueForExport in class EntryTypeService
Parameters:
entry - The entry
request - the request
response - the response associate to the entry
locale - the locale
Returns:
the response value associate to the entry to export in the file export

checkEntryData

protected String checkEntryData(javax.servlet.http.HttpServletRequest request,
                                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 GenericAttributeError checkResponseData(Entry entry,
                                                  List<org.apache.commons.fileupload.FileItem> listFilesSource,
                                                  Locale locale,
                                                  javax.servlet.http.HttpServletRequest request)
Check the record field data

Parameters:
entry - The entry
listFilesSource - the list of source files to upload
locale - the locale
request - the HTTP request
Returns:
The error if there is any

getFileSources

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

Parameters:
entry - The entry
request - the HttpServletRequest
Returns:
the file item

setFields

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

Parameters:
entry - The entry
request - the HTTP request

getRequestData

public String getRequestData(Entry entry,
                             javax.servlet.http.HttpServletRequest request,
                             Locale locale)
Get the request data

Specified by:
getRequestData in interface IEntryTypeService
Overrides:
getRequestData in class EntryTypeService
Parameters:
entry - The entry
request - HttpRequest
locale - the locale
Returns:
null if all data required are in the request else the url of jsp error

getPaginator

public fr.paris.lutece.util.html.Paginator<?> getPaginator(Entry entry,
                                                           int nItemPerPage,
                                                           String strBaseUrl,
                                                           String strPageIndexParameterName,
                                                           String strPageIndex)
The paginator who is use in the template modify of the entry

Specified by:
getPaginator in interface IEntryTypeService
Overrides:
getPaginator in class EntryTypeService
Parameters:
entry - The entry
nItemPerPage - Number of items to display per page
strBaseUrl - The base Url for build links on each page link
strPageIndexParameterName - The parameter name for the page index
strPageIndex - The current page index
Returns:
the paginator who is use in the template modify of the entry

getPaginator

public fr.paris.lutece.portal.web.util.LocalizedPaginator<?> getPaginator(Entry entry,
                                                                          int nItemPerPage,
                                                                          String strBaseUrl,
                                                                          String strPageIndexParameterName,
                                                                          String strPageIndex,
                                                                          Locale locale)
The paginator who is use in the template modify of the entry

Specified by:
getPaginator in interface IEntryTypeService
Overrides:
getPaginator in class EntryTypeService
Parameters:
entry - The entry
nItemPerPage - Number of items to display per page
strBaseUrl - The base Url for build links on each page link
strPageIndexParameterName - The parameter name for the page index
strPageIndex - The current page index
locale - Locale
Returns:
the paginator who is use in the template modify of the entry

getReferenceListRegularExpression

public fr.paris.lutece.util.ReferenceList getReferenceListRegularExpression(Entry entry,
                                                                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of regular expression who is use in the template modify of the entry

Specified by:
getReferenceListRegularExpression in interface IEntryTypeService
Overrides:
getReferenceListRegularExpression in class EntryTypeService
Parameters:
entry - the entry
plugin - the plugin
Returns:
the regular expression list who is use in the template modify of the entry

setResponseToStringValue

public void setResponseToStringValue(Entry entry,
                                     Response response,
                                     Locale locale)
toStringValue should stay null.

Specified by:
setResponseToStringValue in interface IEntryTypeService
Overrides:
setResponseToStringValue in class EntryTypeService
Parameters:
entry - The entry
response - The response
locale - the locale - will use a default one if not specified

getResponseValueForRecap

public String getResponseValueForRecap(Entry entry,
                                       javax.servlet.http.HttpServletRequest request,
                                       Response response,
                                       Locale locale)
Get the response value associate to the entry to write in the recap

Specified by:
getResponseValueForRecap in interface IEntryTypeService
Overrides:
getResponseValueForRecap in class EntryTypeService
Parameters:
entry - The entry
request - the request
response - the response associate to the entry
locale - the locale
Returns:
the response value associate to the entry to write in the recap


Copyright © 2014 Mairie de Paris. All Rights Reserved.