public final class DiggUtils 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,
DiggUserInfo 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 digg submit
|
static Map<String,Object> |
depopulate(Digg digg)
Depopulate the digg into a map of key - value
|
static void |
doReportDiggSubmit(DiggSubmit diggSubmit,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Perform the report on a digg submit
|
static void |
doVoteDiggSubmit(int nIdDiggSubmit,
int nScore,
String strLuteceUserKey,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Perform the vote on a digg submit
|
static FormError |
getAllResponsesData(javax.servlet.http.HttpServletRequest request,
DiggSubmit diggSubmit,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Locale locale)
perform in the object diggSubmit the responses associates to the
diggsubmit
|
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 SubmitFilter |
getDiggSubmitFilter(DigglikeAdminSearchFields searchFields) |
static SubmitFilter |
getDiggSubmitFilter(DigglikeAdminSearchFields searchFields,
Integer nDefaultIdSort) |
static String |
getDiggSubmitTitle(DiggSubmit diggSubmit,
Locale locale)
return the title of the digg submit
|
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 String |
getHtmlDiggSubmitValue(DiggSubmit diggSubmit,
Locale locale)
return the content of the html code of the digg submit
|
static String |
getHtmlDiggSubmitValueShowInTheList(DiggSubmit diggSubmit,
Locale locale)
return the content of the html code of the digg submit show in the list
of digg submit
|
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 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(Digg digg,
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 |
getRefListDigg(List<Digg> listDiggs,
boolean bIncludeDefault)
Init reference list with the different categories
|
static fr.paris.lutece.util.ReferenceList |
getRefListDiggSort(Locale locale)
Init reference list width the different sort
|
static fr.paris.lutece.util.ReferenceList |
getRefListDiggSort(Locale locale,
boolean bFront)
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 |
getRefListType(List<DiggSubmitType> 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,
DiggSubmit diggSubmit,
boolean bResponseNull,
Locale locale)
perform in the object diggSubmit the responses associates with a entry
specify in parameter.
|
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(Digg digg,
CommentSubmit commentSubmit,
Locale locale,
javax.servlet.http.HttpServletRequest request)
sendMail of notification for new comment submit
|
static void |
sendNotificationNewDiggSubmit(Digg digg,
DiggSubmit diggSubmit,
Locale locale,
javax.servlet.http.HttpServletRequest request)
sendMail of notification for new digg submit
|
static void |
sendNotificationNewDiggSubmitDisable(Digg digg,
DiggSubmit diggSubmit,
Locale locale)
sendMail of notification for new digg submit disable
|
static void |
sendNotificationNewReportedMessage(Digg digg,
ReportedMessage reportedMessage,
Locale locale,
javax.servlet.http.HttpServletRequest request)
sendMail of notification for new reported message
|
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 sendNotificationNewDiggSubmit(Digg digg, DiggSubmit diggSubmit, Locale locale, javax.servlet.http.HttpServletRequest request)
digg
- the diggdiggSubmit
- the new diggSubmitlocale
- the localerequest
- the requestpublic static void sendNotificationNewDiggSubmitDisable(Digg digg, DiggSubmit diggSubmit, Locale locale)
digg
- the diggdiggSubmit
- the digg submit disablelocale
- the localepublic static void sendNotificationNewCommentSubmit(Digg digg, CommentSubmit commentSubmit, Locale locale, javax.servlet.http.HttpServletRequest request)
digg
- the diggcommentSubmit
- the new comment submitlocale
- the localerequest
- the requestpublic static void sendNotificationNewReportedMessage(Digg digg, ReportedMessage reportedMessage, Locale locale, javax.servlet.http.HttpServletRequest request)
digg
- the diggreportedMessage
- 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(Digg digg, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale, int nIdDefaultCategory, boolean bBackOffice)
digg
- 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 getHtmlDiggSubmitValue(DiggSubmit diggSubmit, Locale locale)
diggSubmit
- the diggsubmitlocale
- the localepublic static String getHtmlDiggSubmitValueShowInTheList(DiggSubmit diggSubmit, Locale locale)
diggSubmit
- the diggsubmitlocale
- the localepublic static String getDiggSubmitTitle(DiggSubmit diggSubmit, Locale locale)
diggSubmit
- the diggsubmitlocale
- the localepublic static FormError getAllResponsesData(javax.servlet.http.HttpServletRequest request, DiggSubmit diggSubmit, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale)
request
- diggSubmit
- plugin
- locale
- fr.paris.lutece.portal.service.message.SiteMessageException
public static FormError getResponseEntry(javax.servlet.http.HttpServletRequest request, int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin, DiggSubmit diggSubmit, boolean bResponseNull, Locale locale)
request
- the requestnIdEntry
- the key of the entryplugin
- the plugindiggSubmit
- digg 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 doVoteDiggSubmit(int nIdDiggSubmit, int nScore, String strLuteceUserKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
nIdDiggSubmit
- the id of the digg submitstrLuteceUserKey
- the key of the lutece user who have votenScore
- the score of the voteplugin
- the pluginpublic static void doReportDiggSubmit(DiggSubmit diggSubmit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
diggSubmit
- the digg 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<DiggSubmitType> listTypes)
listTypes
- the list of typespublic static fr.paris.lutece.util.ReferenceList getRefListDigg(List<Digg> listDiggs, boolean bIncludeDefault)
listDiggs
- the list of categoriesbIncludeDefault
- true if a default item must be insertpublic static fr.paris.lutece.util.ReferenceList getRefListDiggSort(Locale locale)
locale
- the localepublic static fr.paris.lutece.util.ReferenceList getRefListDiggSort(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(Digg digg)
digg
- the diggpublic static SubmitFilter createPinnedFilter(SubmitFilter filter)
filter
- the init filterpublic static SubmitFilter getDiggSubmitFilter(DigglikeAdminSearchFields searchFields)
searchFields
- the search fieldspublic static SubmitFilter getDiggSubmitFilter(DigglikeAdminSearchFields searchFields, Integer nDefaultIdSort)
searchFields
- the search fieldsnDefaultIdSort
- the defautlt sortpublic static void addAvatarToModel(Map<String,Object> model, DiggUserInfo luteceUserInfo)
model
- luteceUserInfo
- Copyright © 2016 Mairie de Paris. All Rights Reserved.