public final class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkTime(String strTime)
Return a boolean: if the time is well formed return true, else return
false
|
static List<AgendaResource> |
getAgendaResourcesWithEvents()
Get the multi agenda from database
|
static List<AgendaResource> |
getAgendaResourcesWithOccurrences()
Get the multi agenda from database
|
static List<AgendaResource> |
getAgendaResourcesWithOccurrences(javax.servlet.http.HttpServletRequest request)
Get all agendas from database checkin the security
|
static List<AgendaResource> |
getAgendaResourcesWithOccurrencesIds()
Get the multi agenda from database with occurrences ordered by id
|
static Agenda |
getAgendaWithEvents(String strAgenda,
javax.servlet.http.HttpServletRequest request)
Get a specified agenda from database with events
|
static Agenda |
getAgendaWithOccurrences(String strAgenda,
javax.servlet.http.HttpServletRequest request)
Get a specified agenda from database with occurrences
|
static Agenda |
getAgendaWithOccurrencesOrderedbyId(String strAgenda,
javax.servlet.http.HttpServletRequest request)
Get a specified agenda from database with occurrences
|
static String[] |
getCalendarIds(javax.servlet.http.HttpServletRequest request)
Get all calendar ids that the user is authorized to visualize
|
static String |
getDate(Calendar calendar)
Constructs a 8 digits date string YYYYMMDD
|
static String |
getDate(Date dateDigit)
Constructs a digit string from a date object
|
static String |
getDate(int nYear,
int nMonth,
int nDay)
Constructs a 8 digits date string code YYYYMMDD
|
static Date |
getDate(String strDate)
Constructs a Date object from YYYYMMDD
|
static Date |
getDateForward(Date dateDay,
int nPeriodicity,
int nOccurrence,
String[] arrayExcludedDays)
Returns a date code corresponding to a calendar roll of n days forward
|
static String |
getDateToday()
Returns a the date code of today
|
static int |
getDay(String strDate)
Returns the day of month from a date code
|
static Date |
getDayAfter(Date dateDayAfter,
int n)
Returns a date code corresponding to a calendar roll of n days forward
|
static String |
getDayAfter(String strDate,
int n)
Returns a date code corresponding to a calendar roll of n days forward
|
static String |
getDayLabel(String strDate,
Locale locale)
Returns the day as an international formatted string corresponding to the
date code
|
static int |
getDayOfWeek(String strDate)
Get the day of week of a given date using the pattern
DATE_PATTERN |
static Calendar |
getFirstDayOfWeek(String strDate)
Returns the first monday of a week as a formatted string corresponding to
the date code
|
static int |
getMonth(String strDate)
Returns the month from a date code
|
static String |
getMonthLabel(String strDate,
Locale locale)
Returns the month as a formatted string corresponding to the date code
|
static String |
getNextDay(String strDate)
Returns a date code corresponding to a calendar roll of one day forward
|
static String |
getNextMonth(String strDate)
Returns a date code corresponding to a calendar roll of one month
|
static String |
getNextMonth(String strDateRef,
int nCptDate)
Returns a date code corresponding to a calendar roll of one month
|
static String |
getNextWeek(String strDate)
Returns a date code corresponding to a calendar roll of one week forward
|
static int |
getOccurrenceWithinTwoDates(Date dateStart,
Date dateEnd,
String[] arrayExcludedDays)
Returns a date code corresponding to a calendar roll of one month
|
static String |
getPreviousDay(String strDate)
Returns a date code corresponding to a calendar roll of one day backward
|
static String |
getPreviousMonth(String strDate)
Returns a date code corresponding to a calendar roll of one month
backward
|
static String |
getPreviousWeek(String strDate)
Returns a date code corresponding to a calendar roll of one week backward
|
static String |
getWeekDayLabel(String strDate,
Locale locale)
Returns the day as an international formatted string corresponding to the
date code
|
static String |
getWeekLabel(String strDate,
Locale locale)
Returns the Week as a formatted string corresponding to the date code
|
static int |
getYear(String strDate)
Returns the year from a date code
|
static boolean |
isDayExcluded(int nDayOfWeek,
String[] arrayExcludedDays)
Check if a day is in the list of excluded days
|
static boolean |
isDayOff(Calendar calendar)
Checks if the day if Off (ie: Sunday) or not
|
static boolean |
isValid(String strDate)
Checks a date code
|
static boolean |
isValidDate(Date dateEvent)
Checks a date code
|
static void |
loadAgendaEvents(AgendaResource agenda,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Return the agenda
|
static void |
loadAgendaOccurrences(AgendaResource agenda,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Return the agenda
|
static void |
loadAgendaOccurrencesOrderedById(AgendaResource agenda,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Return the occurrences of an agenda ordered by id
|
static String |
parseHtmlToPlainTextString(String strHTML)
Parse a HTML string into plain text
|
public static String getDate(int nYear, int nMonth, int nDay)
nYear - The YearnMonth - The month index (0-11)nDay - The day of the month (1-31)public static String getDate(Calendar calendar)
calendar - A calendar positionned on the datepublic static String getDateToday()
public static int getYear(String strDate)
strDate - The date codepublic static int getMonth(String strDate)
strDate - The date codepublic static int getDay(String strDate)
strDate - The date codepublic static String getMonthLabel(String strDate, Locale locale)
locale - The locale used for display settingsstrDate - The date codepublic static String getWeekLabel(String strDate, Locale locale)
locale - The locale used for display settingsstrDate - The date codepublic static Calendar getFirstDayOfWeek(String strDate)
strDate - The date codepublic static String getDayLabel(String strDate, Locale locale)
locale - The locale used for display settingsstrDate - The date codepublic static String getWeekDayLabel(String strDate, Locale locale)
locale - The locale used for display settingsstrDate - The date codepublic static String getNextMonth(String strDate)
strDate - The date codepublic static String getPreviousMonth(String strDate)
strDate - The date codepublic static String getPreviousWeek(String strDate)
strDate - The date codepublic static String getNextWeek(String strDate)
strDate - The date codepublic static String getNextDay(String strDate)
strDate - The date codepublic static String getPreviousDay(String strDate)
strDate - The date codepublic static boolean isValid(String strDate)
strDate - The date codepublic static boolean isDayOff(Calendar calendar)
calendar - A calendar object positionned on the day to checkpublic static boolean checkTime(String strTime)
strTime - The timepublic static String getDayAfter(String strDate, int n)
n - number of days to rollstrDate - The date codepublic static Date getDayAfter(Date dateDayAfter, int n)
n - number of days to rolldateDayAfter - The datepublic static Date getDateForward(Date dateDay, int nPeriodicity, int nOccurrence, String[] arrayExcludedDays)
dateDay - the reference datenPeriodicity - the frequence of an occurrence day, week, monthnOccurrence - the number of occurrencesarrayExcludedDays - list of excluded dayspublic static Date getDate(String strDate)
strDate - a 8 digits date string YYYYMMDDpublic static String getDate(Date dateDigit)
dateDigit - The date codepublic static String getNextMonth(String strDateRef, int nCptDate)
strDateRef - The date referencenCptDate - The number of month to addpublic static int getOccurrenceWithinTwoDates(Date dateStart, Date dateEnd, String[] arrayExcludedDays)
dateStart - The date startdateEnd - The date endarrayExcludedDays - list of excluded dayspublic static Agenda getAgendaWithEvents(String strAgenda, javax.servlet.http.HttpServletRequest request)
strAgenda - The name of the agenda to getrequest - The HTTP requestpublic static Agenda getAgendaWithOccurrences(String strAgenda, javax.servlet.http.HttpServletRequest request)
strAgenda - The agenda to getrequest - The HTTP requestpublic static Agenda getAgendaWithOccurrencesOrderedbyId(String strAgenda, javax.servlet.http.HttpServletRequest request)
strAgenda - The agenda to getrequest - The HTTP requestpublic static List<AgendaResource> getAgendaResourcesWithOccurrences(javax.servlet.http.HttpServletRequest request)
request - The requestpublic static List<AgendaResource> getAgendaResourcesWithOccurrences()
public static List<AgendaResource> getAgendaResourcesWithEvents()
public static List<AgendaResource> getAgendaResourcesWithOccurrencesIds()
public static void loadAgendaOccurrences(AgendaResource agenda, fr.paris.lutece.portal.service.plugin.Plugin plugin)
agenda - The agendaplugin - The pluginpublic static void loadAgendaOccurrencesOrderedById(AgendaResource agenda, fr.paris.lutece.portal.service.plugin.Plugin plugin)
agenda - The agendaplugin - The pluginpublic static void loadAgendaEvents(AgendaResource agenda, fr.paris.lutece.portal.service.plugin.Plugin plugin)
agenda - The agendaplugin - The pluginpublic static boolean isValidDate(Date dateEvent)
dateEvent - The date codepublic static String parseHtmlToPlainTextString(String strHTML)
strHTML - The HTMl to parsepublic static String[] getCalendarIds(javax.servlet.http.HttpServletRequest request)
request - HttpServletRequestpublic static int getDayOfWeek(String strDate)
DATE_PATTERNstrDate - The date to parsepublic static boolean isDayExcluded(int nDayOfWeek,
String[] arrayExcludedDays)
nDayOfWeek - the day to checkarrayExcludedDays - the array of excluded daysCopyright © 2015 City of Paris. All rights reserved.