fr.paris.lutece.plugins.form.utils
Class FormUtils

java.lang.Object
  extended by fr.paris.lutece.plugins.form.utils.FormUtils

public final class FormUtils
extends java.lang.Object

class FormUtils


Field Summary
static java.lang.String CONSTANT_GROUP_BY_DAY
           
static java.lang.String CONSTANT_GROUP_BY_MONTH
           
static java.lang.String CONSTANT_GROUP_BY_WEEK
           
static java.lang.String EMPTY_STRING
           
 
Method Summary
static void addHeaderResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String strFileName, java.lang.String strFileExtension)
          write the http header in the response
static java.sql.Timestamp addStatisticInterval(java.sql.Timestamp timestamp, java.lang.String strTimesUnit, int nDecal)
          return a timestamp Object which correspond to the timestamp in parameter add with a number of times unit (day,week,month)specify in strTimesUnit .
static IEntry createEntryByType(javax.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          return an instance of IEntry function of type entry
static org.jfree.chart.JFreeChart createXYGraph(java.util.List<StatisticFormSubmit> listStatistic, java.lang.String strLabelX, java.lang.String strLableY, java.lang.String strTimesUnit)
          create a JFreeChart Graph function of the statistic form submit
static Field findFieldByIdInTheList(int nIdField, java.util.List<Field> listField)
          return the field which key is specified in parameter
static java.util.Date getCurrentDate()
          return current date without hours, minutes and milliseconds
static java.sql.Timestamp getCurrentTimestamp()
          return current Timestamp
static java.sql.Timestamp getDateFirstMinute(java.util.Date date, java.util.Locale locale)
          return a timestamp Object which correspond with the string specified in parameter.
static java.sql.Timestamp getDateLastMinute(java.util.Date date, java.util.Locale locale)
          return a timestamp Object which correspond with the string specified in parameter.
static java.lang.String getDateString(java.sql.Timestamp date, java.util.Locale locale)
          Deprecated.  
static int getDay(java.sql.Timestamp timestamp)
          return the day of the timestamp in parameter
static fr.paris.lutece.util.ReferenceList getFormList(fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.business.user.AdminUser user)
          Load the data of all form that the user is authorized to see depends workgroups user
static void getHtmlEntry(int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin, java.lang.StringBuffer stringBuffer, java.util.Locale locale)
          insert in the string buffer the content of the html code of the entry
static java.lang.String getHtmlForm(Form form, java.lang.String strUrlAction, fr.paris.lutece.portal.service.plugin.Plugin plugin, java.util.Locale locale)
          return the html code of the form
static int getIndexEntryInTheEntryList(int nIdEntry, java.util.List<IEntry> listEntry)
          return the index in the list of the entry whose key is specified in parameter
static int getIndexFieldInTheFieldList(int nIdField, java.util.List<Field> listField)
          return the index in the list of the field whose key is specified in parameter
static int getMonth(java.sql.Timestamp timestamp)
          return the month of the timestamp in parameter
static FormError getResponseEntry(javax.servlet.http.HttpServletRequest request, int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin, FormSubmit formSubmit, boolean bResponseNull, java.util.Locale locale)
          perform in the object formSubmit the responses associates with a entry specify in parameter.
static int getWeek(java.sql.Timestamp timestamp)
          return the week of the timestamp in parameter
static java.lang.String getXmlResponses(javax.servlet.http.HttpServletRequest request, Form form, java.util.List<FormSubmit> listFormSubmit, java.util.Locale locale, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          return the xml of form's response
static int getYear(java.sql.Timestamp timestamp)
          return the year of the timestamp in parameter
static java.lang.Boolean isFieldInTheResponseList(int nIdField, java.util.List<Response> listResponse)
          return true if the field which key is specified in parameter is in the response list
static boolean sameDate(java.sql.Timestamp timestamp1, java.sql.Timestamp timestamp2, java.lang.String strTimesUnit)
          Compare two timestamp and return true if they have the same times unit(Day,week,month)
static void sendNotificationMailEndDisponibility(Form form, java.util.Locale locale)
          sendMail to the mailing list associate to the form a mail of end disponibility
static void sendNotificationMailFormSubmit(Form form, java.util.Locale locale)
          sendMail to the mailing list associate to the form a mail of new form submit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT_GROUP_BY_DAY

public static final java.lang.String CONSTANT_GROUP_BY_DAY
See Also:
Constant Field Values

CONSTANT_GROUP_BY_WEEK

public static final java.lang.String CONSTANT_GROUP_BY_WEEK
See Also:
Constant Field Values

CONSTANT_GROUP_BY_MONTH

public static final java.lang.String CONSTANT_GROUP_BY_MONTH
See Also:
Constant Field Values

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values
Method Detail

sendNotificationMailEndDisponibility

public static void sendNotificationMailEndDisponibility(Form form,
                                                        java.util.Locale locale)
sendMail to the mailing list associate to the form a mail of end disponibility

Parameters:
form - the form
locale - the locale

sendNotificationMailFormSubmit

public static void sendNotificationMailFormSubmit(Form form,
                                                  java.util.Locale locale)
sendMail to the mailing list associate to the form a mail of new form submit

Parameters:
form - the form
locale - the locale

getDateLastMinute

public static java.sql.Timestamp getDateLastMinute(java.util.Date date,
                                                   java.util.Locale locale)
return a timestamp Object which correspond with the string specified in parameter.

Parameters:
date - the date who must convert
locale - the locale
Returns:
a timestamp Object which correspond with the string specified in parameter.

getDateFirstMinute

public static java.sql.Timestamp getDateFirstMinute(java.util.Date date,
                                                    java.util.Locale locale)
return a timestamp Object which correspond with the string specified in parameter.

Parameters:
date - the date who must convert
locale - the locale
Returns:
a timestamp Object which correspond with the string specified in parameter.

getDay

public static int getDay(java.sql.Timestamp timestamp)
return the day of the timestamp in parameter

Parameters:
timestamp - date
Returns:
the day of the timestamp in parameter

getWeek

public static int getWeek(java.sql.Timestamp timestamp)
return the week of the timestamp in parameter

Parameters:
timestamp - date
Returns:
the week of the timestamp in parameter

getMonth

public static int getMonth(java.sql.Timestamp timestamp)
return the month of the timestamp in parameter

Parameters:
timestamp - date
Returns:
the month of the timestamp in parameter

getYear

public static int getYear(java.sql.Timestamp timestamp)
return the year of the timestamp in parameter

Parameters:
timestamp - date
Returns:
the year of the timestamp in parameter

addStatisticInterval

public static java.sql.Timestamp addStatisticInterval(java.sql.Timestamp timestamp,
                                                      java.lang.String strTimesUnit,
                                                      int nDecal)
return a timestamp Object which correspond to the timestamp in parameter add with a number of times unit (day,week,month)specify in strTimesUnit .

Parameters:
timestamp - date
strTimesUnit - (day,week,month)
nDecal - the number of timesUnit
Returns:
a timestamp Object which correspond with the string specified in parameter add with a number of times unit (day,week,month)specify in strTimesUnit.

sameDate

public static boolean sameDate(java.sql.Timestamp timestamp1,
                               java.sql.Timestamp timestamp2,
                               java.lang.String strTimesUnit)
Compare two timestamp and return true if they have the same times unit(Day,week,month)

Parameters:
timestamp1 - timestamp1
timestamp2 - timestamp2
strTimesUnit - (day,week,month)
Returns:
Compare two timestamp and return true if they have the same times unit(Day,week,month)

getDateString

public static java.lang.String getDateString(java.sql.Timestamp date,
                                             java.util.Locale locale)
Deprecated. 

Converts une java.sql.Timestamp date in a String date in a "jj/mm/aaaa" format

Parameters:
date - java.sql.Timestamp date to convert
locale - the locale
Returns:
strDate The String date in the short locale format or the emmpty String if the date is null

getCurrentTimestamp

public static java.sql.Timestamp getCurrentTimestamp()
return current Timestamp

Returns:
return current Timestamp

getCurrentDate

public static java.util.Date getCurrentDate()
return current date without hours, minutes and milliseconds

Returns:
return current date

createEntryByType

public static IEntry createEntryByType(javax.servlet.http.HttpServletRequest request,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
return an instance of IEntry function of type entry

Parameters:
request - the request
plugin - the plugin
Returns:
an instance of IEntry function of type entry

getIndexEntryInTheEntryList

public static int getIndexEntryInTheEntryList(int nIdEntry,
                                              java.util.List<IEntry> listEntry)
return the index in the list of the entry whose key is specified in parameter

Parameters:
nIdEntry - the key of the entry
listEntry - the list of the entry
Returns:
the index in the list of the entry whose key is specified in parameter

getIndexFieldInTheFieldList

public static int getIndexFieldInTheFieldList(int nIdField,
                                              java.util.List<Field> listField)
return the index in the list of the field whose key is specified in parameter

Parameters:
nIdField - the key of the field
listField - the list of field
Returns:
the index in the list of the field whose key is specified in parameter

getHtmlForm

public static java.lang.String getHtmlForm(Form form,
                                           java.lang.String strUrlAction,
                                           fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                           java.util.Locale locale)
return the html code of the form

Parameters:
form - the form which html code must be return
strUrlAction - the url who must be call after the form submit
plugin - the plugin
locale - the locale
Returns:
the html code of the form

getHtmlEntry

public static void getHtmlEntry(int nIdEntry,
                                fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                java.lang.StringBuffer stringBuffer,
                                java.util.Locale locale)
insert in the string buffer the content of the html code of the entry

Parameters:
nIdEntry - the key of the entry which html code must be insert in the stringBuffer
plugin - the plugin
stringBuffer - the buffer which contains the html code
locale - the locale

getResponseEntry

public static FormError getResponseEntry(javax.servlet.http.HttpServletRequest request,
                                         int nIdEntry,
                                         fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                         FormSubmit formSubmit,
                                         boolean bResponseNull,
                                         java.util.Locale locale)
perform in the object formSubmit the responses associates with a entry specify in parameter. return null if there is no error in the response else return a FormError Object

Parameters:
request - the request
nIdEntry - the key of the entry
plugin - the plugin
formSubmit - Form Submit Object
bResponseNull - true if the response create must be null
locale - the locale
Returns:
null if there is no error in the response else return a FormError Object

findFieldByIdInTheList

public static Field findFieldByIdInTheList(int nIdField,
                                           java.util.List<Field> listField)
return the field which key is specified in parameter

Parameters:
nIdField - the id of the field who is search
listField - the list of field
Returns:
the field which key is specified in parameter

isFieldInTheResponseList

public static java.lang.Boolean isFieldInTheResponseList(int nIdField,
                                                         java.util.List<Response> listResponse)
return true if the field which key is specified in parameter is in the response list

Parameters:
nIdField - the id of the field who is search
listResponse - the list of object Response
Returns:
true if the field which key is specified in parameter is in the response list

getXmlResponses

public static java.lang.String getXmlResponses(javax.servlet.http.HttpServletRequest request,
                                               Form form,
                                               java.util.List<FormSubmit> listFormSubmit,
                                               java.util.Locale locale,
                                               fr.paris.lutece.portal.service.plugin.Plugin plugin)
return the xml of form's response

Parameters:
request - the request
form - the form
listFormSubmit - the form submit list
locale - the locale
plugin - the plugin
Returns:
the xml of the response of a form

addHeaderResponse

public static void addHeaderResponse(javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.String strFileName,
                                     java.lang.String strFileExtension)
write the http header in the response

Parameters:
request - the httpServletRequest
response - the http response
strFileName - the name of the file who must insert in the response
strFileExtension - the file extension

createXYGraph

public static org.jfree.chart.JFreeChart createXYGraph(java.util.List<StatisticFormSubmit> listStatistic,
                                                       java.lang.String strLabelX,
                                                       java.lang.String strLableY,
                                                       java.lang.String strTimesUnit)
create a JFreeChart Graph function of the statistic form submit

Parameters:
listStatistic - the list of statistic of form submit
strLabelX - the label of axis x
strLableY - the label of axis x
strTimesUnit - the times unit of axis x(Day,Week,Month)
Returns:
a JFreeChart Graph function of the statistic form submit

getFormList

public static fr.paris.lutece.util.ReferenceList getFormList(fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                                             fr.paris.lutece.portal.business.user.AdminUser user)
Load the data of all form that the user is authorized to see depends workgroups user

Parameters:
plugin - the plugin
user - the current user
Returns:
a reference list of form


Copyright © 2008 Mairie de Paris. All Rights Reserved.