Class FormUtils
java.lang.Object
fr.paris.lutece.plugins.form.utils.FormUtils
class FormUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddHeaderResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String strFileName, String strFileExtension) write the http header in the responsestatic TimestampaddStatisticInterval(Timestamp timestamp, 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 StringbuildRequestWithFilter(String strSelect, List<String> listStrFilter, List<String> listStrGroupBy, String strOrder) Builds a query with filters placed in parametersstatic IEntrycreateEntryByType(javax.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.service.plugin.Plugin plugin) return an instance of IEntry function of type entrystatic org.jfree.chart.JFreeChartcreateXYGraph(List<StatisticFormSubmit> listStatistic, String strLabelX, String strLableY, String strTimesUnit) create a JFreeChart Graph function of the statistic form submitstatic FieldfindFieldByIdInTheList(int nIdField, List<Field> listField) return the field which key is specified in parametergetAllQuestionList(int nIdForm, fr.paris.lutece.portal.service.plugin.Plugin plugin) return the questions liststatic Datereturn current date without hours, minutes and millisecondsstatic Timestampreturn current Timestampstatic TimestampgetDateFirstMinute(Date date, Locale locale) return a timestamp Object which correspond with the string specified in parameter.static TimestampgetDateLastMinute(Date date, Locale locale) return a timestamp Object which correspond with the string specified in parameter.static StringgetDateString(Timestamp date, Locale locale) Deprecated.static intreturn the day of the timestamp in parametergetEntriesList(int nIdForm, fr.paris.lutece.portal.service.plugin.Plugin plugin) return all entries of formstatic fr.paris.lutece.util.ReferenceListgetFormList(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 userstatic voidgetHtmlEntry(int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin, StringBuffer stringBuffer, Locale locale) insert in the string buffer the content of the html code of the entrystatic StringgetHtmlForm(Form form, String strUrlAction, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale) return the html code of the formstatic intgetIndexEntryInTheEntryList(int nIdEntry, List<IEntry> listEntry) return the index in the list of the entry whose key is specified in parameterstatic intgetIndexFieldInTheFieldList(int nIdField, List<Field> listField) return the index in the list of the field whose key is specified in parameterstatic intreturn the month of the timestamp in parameterstatic fr.paris.lutece.util.ReferenceListgetRefListAllQuestions(int nIdForm, fr.paris.lutece.portal.service.plugin.Plugin plugin) static FormErrorgetResponseEntry(javax.servlet.http.HttpServletRequest request, int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin, FormSubmit formSubmit, boolean bResponseNull, Locale locale) perform in the object formSubmit the responses associates with a entry specify in parameter.static intreturn the week of the timestamp in parameterstatic StringgetXmlResponses(javax.servlet.http.HttpServletRequest request, Form form, List<FormSubmit> listFormSubmit, Locale locale, fr.paris.lutece.portal.service.plugin.Plugin plugin) return the xml of form's responsestatic intreturn the year of the timestamp in parameterstatic BooleanisFieldInTheResponseList(int nIdField, List<Response> listResponse) return true if the field which key is specified in parameter is in the response liststatic booleanCompare two timestamp and return true if they have the same times unit(Day,week,month)static voidsendNotificationMailEndDisponibility(Form form, Locale locale) sendMail to the mailing list associate to the form a mail of end disponibilitystatic voidsendNotificationMailFormSubmit(Form form, Locale locale) sendMail to the mailing list associate to the form a mail of new form submit
-
Field Details
-
CONSTANT_GROUP_BY_DAY
- See Also:
-
CONSTANT_GROUP_BY_WEEK
- See Also:
-
CONSTANT_GROUP_BY_MONTH
- See Also:
-
EMPTY_STRING
- See Also:
-
-
Method Details
-
sendNotificationMailEndDisponibility
sendMail to the mailing list associate to the form a mail of end disponibility- Parameters:
form- the formlocale- the locale
-
sendNotificationMailFormSubmit
sendMail to the mailing list associate to the form a mail of new form submit- Parameters:
form- the formlocale- the locale
-
getDateLastMinute
return a timestamp Object which correspond with the string specified in parameter.- Parameters:
date- the date who must convertlocale- the locale- Returns:
- a timestamp Object which correspond with the string specified in parameter.
-
getDateFirstMinute
return a timestamp Object which correspond with the string specified in parameter.- Parameters:
date- the date who must convertlocale- the locale- Returns:
- a timestamp Object which correspond with the string specified in parameter.
-
getDay
return the day of the timestamp in parameter- Parameters:
timestamp- date- Returns:
- the day of the timestamp in parameter
-
getWeek
return the week of the timestamp in parameter- Parameters:
timestamp- date- Returns:
- the week of the timestamp in parameter
-
getMonth
return the month of the timestamp in parameter- Parameters:
timestamp- date- Returns:
- the month of the timestamp in parameter
-
getYear
return the year of the timestamp in parameter- Parameters:
timestamp- date- Returns:
- the year of the timestamp in parameter
-
addStatisticInterval
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- datestrTimesUnit- (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
Compare two timestamp and return true if they have the same times unit(Day,week,month)- Parameters:
timestamp1- timestamp1timestamp2- timestamp2strTimesUnit- (day,week,month)- Returns:
- Compare two timestamp and return true if they have the same times unit(Day,week,month)
-
getDateString
Deprecated.Converts une java.sql.Timestamp date in a String date in a "jj/mm/aaaa" format- Parameters:
date- java.sql.Timestamp date to convertlocale- the locale- Returns:
- strDate The String date in the short locale format or the emmpty String if the date is null
-
getCurrentTimestamp
return current Timestamp- Returns:
- return current Timestamp
-
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 requestplugin- the plugin- Returns:
- an instance of IEntry function of type entry
-
getIndexEntryInTheEntryList
return the index in the list of the entry whose key is specified in parameter- Parameters:
nIdEntry- the key of the entrylistEntry- the list of the entry- Returns:
- the index in the list of the entry whose key is specified in parameter
-
getIndexFieldInTheFieldList
return the index in the list of the field whose key is specified in parameter- Parameters:
nIdField- the key of the fieldlistField- the list of field- Returns:
- the index in the list of the field whose key is specified in parameter
-
getHtmlForm
public static String getHtmlForm(Form form, String strUrlAction, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale) return the html code of the form- Parameters:
form- the form which html code must be returnstrUrlAction- the url who must be call after the form submitplugin- the pluginlocale- the locale- Returns:
- the html code of the form
-
getHtmlEntry
public static void getHtmlEntry(int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin, StringBuffer stringBuffer, 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 stringBufferplugin- the pluginstringBuffer- the buffer which contains the html codelocale- 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, 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 requestnIdEntry- the key of the entryplugin- the pluginformSubmit- Form Submit ObjectbResponseNull- true if the response create must be nulllocale- the locale- Returns:
- null if there is no error in the response else return a FormError Object
-
findFieldByIdInTheList
return the field which key is specified in parameter- Parameters:
nIdField- the id of the field who is searchlistField- the list of field- Returns:
- the field which key is specified in parameter
-
isFieldInTheResponseList
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 searchlistResponse- the list of object Response- Returns:
- true if the field which key is specified in parameter is in the response list
-
getXmlResponses
public static String getXmlResponses(javax.servlet.http.HttpServletRequest request, Form form, List<FormSubmit> listFormSubmit, Locale locale, fr.paris.lutece.portal.service.plugin.Plugin plugin) return the xml of form's response- Parameters:
request- the requestform- the formlistFormSubmit- the form submit listlocale- the localeplugin- 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, String strFileName, String strFileExtension) write the http header in the response- Parameters:
request- the httpServletRequestresponse- the http responsestrFileName- the name of the file who must insert in the responsestrFileExtension- the file extension
-
createXYGraph
public static org.jfree.chart.JFreeChart createXYGraph(List<StatisticFormSubmit> listStatistic, String strLabelX, String strLableY, String strTimesUnit) create a JFreeChart Graph function of the statistic form submit- Parameters:
listStatistic- the list of statistic of form submitstrLabelX- the label of axis xstrLableY- the label of axis xstrTimesUnit- 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 pluginuser- the current user- Returns:
- a reference list of form
-
getRefListAllQuestions
public static fr.paris.lutece.util.ReferenceList getRefListAllQuestions(int nIdForm, fr.paris.lutece.portal.service.plugin.Plugin plugin) -
getAllQuestionList
public static List<IEntry> getAllQuestionList(int nIdForm, fr.paris.lutece.portal.service.plugin.Plugin plugin) return the questions list- Parameters:
nIdForm- the form idplugin- the plugin- Returns:
- the questions list
-
getEntriesList
public static List<IEntry> getEntriesList(int nIdForm, fr.paris.lutece.portal.service.plugin.Plugin plugin) return all entries of form- Parameters:
nIdForm- the form idplugin- the plugin- Returns:
- the all entries of form
-
buildRequestWithFilter
public static String buildRequestWithFilter(String strSelect, List<String> listStrFilter, List<String> listStrGroupBy, String strOrder) Builds a query with filters placed in parameters- Parameters:
strSelect- the select of the querylistStrFilter- the list of filter to add in the querylistStrGroupBy- the list of group by to add in the querystrOrder- the order by of the query- Returns:
- a query
-