public final class SuggestUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CONSTANT_ID_NULL |
static int |
CONSTANT_SUBMIT_FILTER_MONTH |
static int |
CONSTANT_SUBMIT_FILTER_TO_DAY |
static int |
CONSTANT_SUBMIT_FILTER_WEEK |
static int |
CONSTANT_SUBMIT_FILTER_YESTERDAY |
static String |
EMPTY_STRING |
static String |
PROPERTY_FILTER_ALL |
static String |
PROPERTY_FILTER_MONTH |
static String |
PROPERTY_FILTER_TO_DAY |
static String |
PROPERTY_FILTER_WEEK |
static String |
PROPERTY_FILTER_YESTERDAY |
static String |
SERVLET_IMAGE_PATH |
| Modifier and Type | Method and Description |
|---|---|
static void |
addAvatarToModel(Map<String,Object> model,
SuggestUserInfo luteceUserInfo)
Add Avatar to model
|
static void |
addEmptyItem(fr.paris.lutece.util.ReferenceList refList)
Add an empty element to a reference list
|
static void |
addHeaderResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String strFileName)
write the http header in the response
|
static String |
buildRequestWithFilter(String strSelect,
List<String> listStrFilter,
String strOrder)
Builds a query with filters placed in parameters
|
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 SubmitFilter |
createPinnedFilter(SubmitFilter filter)
create a filter for getting the list of pinned suggest submit
|
static Map<String,Object> |
depopulate(Suggest suggest)
Depopulate the suggest into a map of key - value
|
static void |
doReportSuggestSubmit(SuggestSubmit suggestSubmit,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Perform the report on a suggest submit
|
static void |
doVoteSuggestSubmit(int nIdSuggestSubmit,
int nScore,
String strLuteceUserKey,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Perform the vote on a suggest submit
|
static FormError |
getAllResponsesData(javax.servlet.http.HttpServletRequest request,
SuggestSubmit suggestSubmit,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Locale locale)
perform in the object suggestSubmit the responses associates to the
suggestsubmit
|
static Timestamp |
getCurrentDate()
return current date
|
static Timestamp |
getDateAfterNDay(Timestamp date,
int nDay)
Return a date corresponding to the date provides in parameter add with a
number of day
|
static String |
getDateString(Timestamp date,
Locale locale)
Converts une java.sql.Timestamp date in a String date in a "jj/mm/aaaa"
format
|
static Timestamp |
getFirstDayOfMonth(Timestamp date)
return the first day of month function of the date .
|
static Timestamp |
getFirstDayOfWeek(Timestamp date)
return the first day of week function of the date .
|
static Timestamp |
getFirstMinute(String strDate,
Locale locale)
return a timestamp Object which correspond with the string specified in
parameter.
|
static Timestamp |
getFirstMinute(Timestamp date)
return a timestamp Object which correspond at the fist minute of the date
.
|
static void |
getHtmlFormEntry(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
|
static void |
getHtmlResponseEntry(Response response,
StringBuffer stringBuffer,
Locale locale,
boolean bTitle)
return the content of the html code response
|
static String |
getHtmlSuggestSubmitValue(SuggestSubmit suggestSubmit,
Locale locale)
return the content of the html code of the suggest submit
|
static String |
getHtmlSuggestSubmitValueShowInTheList(SuggestSubmit suggestSubmit,
Locale locale)
return the content of the html code of the suggest submit show in the list
of suggest submit
|
static int |
getIndexEntryInTheEntryList(int nIdEntry,
List<IEntry> listEntry)
return the index in the list of the entry whose key is specified in
parameter
|
static int |
getIntegerParameter(String strParameter)
convert a string to int
|
static Timestamp |
getLastDayOfMonth(Timestamp date)
return the last day of month function of the date .
|
static Timestamp |
getLastDayOfWeek(Timestamp date)
return the last day of week function of the date .
|
static Timestamp |
getLastMinute(String strDate,
Locale locale)
return a timestamp Object which correspond with the string specified in
parameter.
|
static Timestamp |
getLastMinute(Timestamp date)
return a timestamp Object which correspond at the last minute of the date
.
|
static Map<String,Object> |
getModelHtmlForm(Suggest suggest,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Locale locale,
int nIdDefaultCategory,
boolean bBackOffice) |
static fr.paris.lutece.util.ReferenceList |
getRefListCategory(List<Category> listCategories)
Init reference list with the different categories
|
static fr.paris.lutece.util.ReferenceList |
getRefListCommentSort(Locale locale)
Init reference list width the different sort
|
static fr.paris.lutece.util.ReferenceList |
getRefListCommentState(Locale locale)
Init reference list width the different sort
|
static fr.paris.lutece.util.ReferenceList |
getRefListFilterByPeriod(Locale locale)
Init reference list width the different sort
|
static fr.paris.lutece.util.ReferenceList |
getRefListSuggest(List<Suggest> listSuggests,
boolean bIncludeDefault)
Init reference list with the different categories
|
static fr.paris.lutece.util.ReferenceList |
getRefListSuggestSort(Locale locale)
Init reference list width the different sort
|
static fr.paris.lutece.util.ReferenceList |
getRefListSuggestSort(Locale locale,
boolean bFront)
Init reference list width the different sort
|
static fr.paris.lutece.util.ReferenceList |
getRefListType(List<SuggestSubmitType> listTypes)
Init reference list with the different types
|
static FormError |
getResponseEntry(javax.servlet.http.HttpServletRequest request,
int nIdEntry,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
SuggestSubmit suggestSubmit,
boolean bResponseNull,
Locale locale)
perform in the object suggestSubmit the responses associates with a entry
specify in parameter.
|
static SubmitFilter |
getSuggestSubmitFilter(SuggestAdminSearchFields searchFields) |
static SubmitFilter |
getSuggestSubmitFilter(SuggestAdminSearchFields searchFields,
Integer nDefaultIdSort) |
static String |
getSuggestSubmitTitle(SuggestSubmit suggestSubmit,
Locale locale)
return the title of the suggest submit
|
static void |
initCommentFilterBySort(SubmitFilter submitFilter,
int nIdSort)
initialized the submit filter object with the sort specified in parameter
|
static void |
initSubmitFilterByPeriod(SubmitFilter submitFilter,
int nIdPeriod)
initialized the submit filter object with the period specified in
parameter
|
static void |
initSubmitFilterBySort(SubmitFilter submitFilter,
int nIdSort)
initialized the submit filter object with the sort specified in parameter
|
static void |
moveElement(int nOldPosistion,
int nNewPosition,
ArrayList<Integer> list)
move a element in the list
|
static List<Integer> |
retainAllIdsKeepingFirstOrder(List<Integer> list1,
List<Integer> list2)
Like
List.retainAll(java.util.Collection), keeping first list
order. |
static void |
sendNotificationNewCommentSubmit(Suggest suggest,
CommentSubmit commentSubmit,
Locale locale,
javax.servlet.http.HttpServletRequest request)
sendMail of notification for new comment submit
|
static void |
sendNotificationNewReportedMessage(Suggest suggest,
ReportedMessage reportedMessage,
Locale locale,
javax.servlet.http.HttpServletRequest request)
sendMail of notification for new reported message
|
static void |
sendNotificationNewSuggestSubmit(Suggest suggest,
SuggestSubmit suggestSubmit,
Locale locale,
javax.servlet.http.HttpServletRequest request)
sendMail of notification for new suggest submit
|
static void |
sendNotificationNewSuggestSubmitDisable(Suggest suggest,
SuggestSubmit suggestSubmit,
Locale locale)
sendMail of notification for new suggest submit disable
|
static String |
substituteSpecialCaractersForExport(String strSource)
replace special characters in the string passed as a parameter
|
static String |
trim(String strParameter)
Returns a copy of the string , with leading and trailing whitespace
omitted.
|
public static final int CONSTANT_ID_NULL
public static final int CONSTANT_SUBMIT_FILTER_TO_DAY
public static final int CONSTANT_SUBMIT_FILTER_WEEK
public static final int CONSTANT_SUBMIT_FILTER_MONTH
public static final int CONSTANT_SUBMIT_FILTER_YESTERDAY
public static final String SERVLET_IMAGE_PATH
public static final String EMPTY_STRING
public static final String PROPERTY_FILTER_ALL
public static final String PROPERTY_FILTER_TO_DAY
public static final String PROPERTY_FILTER_WEEK
public static final String PROPERTY_FILTER_MONTH
public static final String PROPERTY_FILTER_YESTERDAY
public static void sendNotificationNewSuggestSubmit(Suggest suggest, SuggestSubmit suggestSubmit, Locale locale, javax.servlet.http.HttpServletRequest request)
suggest - the suggestsuggestSubmit - the new suggestSubmitlocale - the localerequest - the requestpublic static void sendNotificationNewSuggestSubmitDisable(Suggest suggest, SuggestSubmit suggestSubmit, Locale locale)
suggest - the suggestsuggestSubmit - the suggest submit disablelocale - the localepublic static void sendNotificationNewCommentSubmit(Suggest suggest, CommentSubmit commentSubmit, Locale locale, javax.servlet.http.HttpServletRequest request)
suggest - the suggestcommentSubmit - the new comment submitlocale - the localerequest - the requestpublic static void sendNotificationNewReportedMessage(Suggest suggest, ReportedMessage reportedMessage, Locale locale, javax.servlet.http.HttpServletRequest request)
suggest - the suggestreportedMessage - the reported Messagelocale - the localerequest - the requestpublic static Timestamp getLastMinute(String strDate, Locale locale)
strDate - the date who must convertlocale - the localepublic static Timestamp getFirstMinute(String strDate, Locale locale)
strDate - the date who must convertlocale - the localepublic static Timestamp getFirstDayOfWeek(Timestamp date)
date - the datepublic static Timestamp getLastDayOfWeek(Timestamp date)
date - the datepublic static Timestamp getFirstMinute(Timestamp date)
date - the datepublic static Timestamp getLastMinute(Timestamp date)
date - the datepublic static Timestamp getFirstDayOfMonth(Timestamp date)
date - the datepublic static Timestamp getLastDayOfMonth(Timestamp date)
date - the datepublic static String getDateString(Timestamp date, Locale locale)
date - java.sql.Timestamp date to convertlocale - the localepublic static Timestamp getCurrentDate()
public static Timestamp getDateAfterNDay(Timestamp date, int nDay)
date - the datenDay - the number of day to addpublic static IEntry createEntryByType(javax.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.service.plugin.Plugin plugin)
request - the requestplugin - the pluginpublic static int getIndexEntryInTheEntryList(int nIdEntry,
List<IEntry> listEntry)
nIdEntry - the key of the entrylistEntry - the list of the entrypublic static Map<String,Object> getModelHtmlForm(Suggest suggest, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale, int nIdDefaultCategory, boolean bBackOffice)
suggest - plugin - locale - nIdDefaultCategory - bBackOffice - public static void getHtmlFormEntry(int nIdEntry,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
StringBuffer stringBuffer,
Locale locale)
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 localepublic static void getHtmlResponseEntry(Response response, StringBuffer stringBuffer, Locale locale, boolean bTitle)
response - the response which html code must be generatestringBuffer - the stringBufferbTitle - true if the response is a titlelocale - the localepublic static String getHtmlSuggestSubmitValue(SuggestSubmit suggestSubmit, Locale locale)
suggestSubmit - the suggestsubmitlocale - the localepublic static String getHtmlSuggestSubmitValueShowInTheList(SuggestSubmit suggestSubmit, Locale locale)
suggestSubmit - the suggestsubmitlocale - the localepublic static String getSuggestSubmitTitle(SuggestSubmit suggestSubmit, Locale locale)
suggestSubmit - the suggestsubmitlocale - the localepublic static FormError getAllResponsesData(javax.servlet.http.HttpServletRequest request, SuggestSubmit suggestSubmit, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale)
request - suggestSubmit - plugin - locale - fr.paris.lutece.portal.service.message.SiteMessageExceptionpublic static FormError getResponseEntry(javax.servlet.http.HttpServletRequest request, int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin, SuggestSubmit suggestSubmit, boolean bResponseNull, Locale locale)
request - the requestnIdEntry - the key of the entryplugin - the pluginsuggestSubmit - suggest Submit ObjectbResponseNull - true if the response create must be nulllocale - the localepublic static int getIntegerParameter(String strParameter)
strParameter - the string parameter to convertpublic static String trim(String strParameter)
strParameter - the string parameter to convertpublic static void initSubmitFilterByPeriod(SubmitFilter submitFilter, int nIdPeriod)
submitFilter - the filter to initializednIdPeriod - the id of the period (DAY,WEEK,MONTH)public static void initSubmitFilterBySort(SubmitFilter submitFilter, int nIdSort)
submitFilter - the filter to initializednIdSort - the id of the sort(date response, score)public static void initCommentFilterBySort(SubmitFilter submitFilter, int nIdSort)
submitFilter - the filter to initializednIdSort - the id of the sort(date response, score)public static void doVoteSuggestSubmit(int nIdSuggestSubmit,
int nScore,
String strLuteceUserKey,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
nIdSuggestSubmit - the id of the suggest submitstrLuteceUserKey - the key of the lutece user who have votenScore - the score of the voteplugin - the pluginpublic static void doReportSuggestSubmit(SuggestSubmit suggestSubmit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
suggestSubmit - the suggest submitplugin - the pluginpublic static fr.paris.lutece.util.ReferenceList getRefListCategory(List<Category> listCategories)
listCategories - the list of categoriespublic static fr.paris.lutece.util.ReferenceList getRefListType(List<SuggestSubmitType> listTypes)
listTypes - the list of typespublic static fr.paris.lutece.util.ReferenceList getRefListSuggest(List<Suggest> listSuggests, boolean bIncludeDefault)
listSuggests - the list of categoriesbIncludeDefault - true if a default item must be insertpublic static fr.paris.lutece.util.ReferenceList getRefListSuggestSort(Locale locale)
locale - the localepublic static fr.paris.lutece.util.ReferenceList getRefListSuggestSort(Locale locale, boolean bFront)
locale - the localebFront - yes if the refList is display in front officepublic static fr.paris.lutece.util.ReferenceList getRefListFilterByPeriod(Locale locale)
locale - the localepublic static fr.paris.lutece.util.ReferenceList getRefListCommentSort(Locale locale)
locale - the localepublic static fr.paris.lutece.util.ReferenceList getRefListCommentState(Locale locale)
locale - the localepublic static void addHeaderResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String strFileName)
request - the httpServletRequestresponse - the http responsestrFileName - the name of the file who must insert in the responsepublic static String buildRequestWithFilter(String strSelect, List<String> listStrFilter, String strOrder)
strSelect - the select of the querylistStrFilter - the list of filter to add in the querystrOrder - the order by of the querypublic static List<Integer> retainAllIdsKeepingFirstOrder(List<Integer> list1, List<Integer> list2)
List.retainAll(java.util.Collection), keeping first list
order. This method is based on the fact that list1 and list2 have unique
elements.list1 - the first listlist2 - the other listpublic static void moveElement(int nOldPosistion,
int nNewPosition,
ArrayList<Integer> list)
nOldPosistion - the old positionnNewPosition - the new positionlist - The listpublic static String substituteSpecialCaractersForExport(String strSource)
strSource - the stringpublic static void addEmptyItem(fr.paris.lutece.util.ReferenceList refList)
refList - The reference list to add the empty element topublic static Map<String,Object> depopulate(Suggest suggest)
suggest - the suggestpublic static SubmitFilter createPinnedFilter(SubmitFilter filter)
filter - the init filterpublic static SubmitFilter getSuggestSubmitFilter(SuggestAdminSearchFields searchFields)
searchFields - the search fieldspublic static SubmitFilter getSuggestSubmitFilter(SuggestAdminSearchFields searchFields, Integer nDefaultIdSort)
searchFields - the search fieldsnDefaultIdSort - the defautlt sortpublic static void addAvatarToModel(Map<String,Object> model, SuggestUserInfo luteceUserInfo)
model - luteceUserInfo - Copyright © 2016 City of Paris. All rights reserved.