org.exoplatform.calendar
Class CalendarUtils

java.lang.Object
  extended by org.exoplatform.calendar.CalendarUtils

public class CalendarUtils
extends Object

Created by The eXo Platform SARL Author : Hung Nguyen Quang hung.nguyen@exoplatform.com Jul 11, 2007


Nested Class Summary
static class CalendarUtils.ContactComparator
           
static class CalendarUtils.SelectComparator
           
 
Field Summary
static String AND
           
static String ANY
           
static String ANY_OF
           
static String AT
           
static String BACKSLASH
           
static String BREAK_LINE
           
static String CLOSE_PARENTHESIS
           
static String CLOSE_SHARP_BRACKET
           
static String CLOSE_SQUARE_BRACKET
           
static String COLON
           
static String COLON_SLASH
           
static String COMMA
           
static String contactRegex
           
static String DATEFORMAT
           
static String DATEFORMAT1
           
static String DATEFORMAT2
           
static String DATEFORMAT3
           
static String DATEFORMAT4
           
static String[] DATEFORMATS
           
static String DATETIMEFORMAT
           
static int DEFAULT_TIMEITERVAL
           
static int DEFAULT_VALUE_UPLOAD_PORTAL
           
static String DETAILS_URL
           
static String DOT
           
static String DOUBLESCORE
           
static String emailRegex
           
static String EXCLAMATION
           
static String EXO_INVITATION
           
static String EXPONENT
           
static String[] EXTENDEDCHARACTER
           
static String[] EXTENDEDKEYWORD
           
static String FIELD_SEND
           
static String FORMATPATTERN1
           
static String FORMATPATTERN2
           
static String FORMATPATTERN3
           
static String FORMATPATTERN4
           
static String[] FORMATPATTERNS
           
static String GREATER_THAN
           
static String INVITATION_DETAIL_URL
           
static String INVITATION_IMPORT_URL
           
static String INVITATION_URL
           
static String ITEM_ALWAYS
           
static String ITEM_ASK
           
static String ITEM_NERVER
           
static long MILISECONS_OF_DAY
           
static String MINUS
           
static String MONEY_MARK
           
static String OPEN_PARENTHESIS
           
static String OPEN_SHARP_BRACKET
           
static String OPEN_SQUARE_BRACKET
           
static String OR
           
static String PERCENT
           
static String PLUS
           
static String PRIVATE_CALENDARS
           
static String PRIVATE_TYPE
           
static String PUBLIC_CALENDARS
           
static String PUBLIC_TYPE
           
static String QUESTION_MARK
           
static String QUOTE
           
static String SEMICOLON
           
static String SHARED_CALENDARS
           
static String SHARED_TYPE
           
static String SHARP
           
static String[] SIMPLECHARACTER
           
static String SINGLE_QUOTE
           
static String SLASH
           
static String SLASH_COLON
           
static String SMALLER_THAN
           
static String[] SPECIALCHARACTER
           
static String STAR
           
static String TIMEFORMAT
           
static String[] TIMEFORMATPATTERNS
           
static String TWELVE_HOURS
           
static String TWENTY_FOUR_HOURS
           
static String UNDERSCORE
           
 
Constructor Summary
CalendarUtils()
           
 
Method Summary
static boolean canEdit(org.exoplatform.services.organization.OrganizationService oService, String[] savePerms, String username)
           
static String cleanValue(String values)
           
static String convertSize(long size)
           
static String encodeHTML(String htmlContent)
           
static String encodeJCRText(String str)
           
static String enCodeTitle(String s)
           
static String generateTimeZoneLabel(String timeZoneID)
          render time zone label for a time zone.
static String[] getAllGroups()
           
static List<org.exoplatform.calendar.service.Calendar> getAllOfCalendars(String username)
           
static List<org.exoplatform.calendar.service.Calendar> getAllOfCurrentUserCalendars()
           
static Calendar getBeginDay(Calendar cal)
           
static Calendar getBeginDay(Date date)
           
static org.exoplatform.calendar.service.Calendar getCalendar(String calType, String calendarId)
           
static List<org.exoplatform.webui.core.model.SelectItem> getCalendarCategoryOption()
           
static Calendar getCalendarInstanceBySetting(org.exoplatform.calendar.service.CalendarSetting calendarSetting)
          get calendar by user setting (timezone, first day of week)
static List<org.exoplatform.webui.core.model.SelectItem> getCalendarOption()
           
static org.exoplatform.calendar.service.CalendarService getCalendarService()
           
static String getCalendarURL()
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getCategory()
           
static String getCheckPermissionString()
           
static org.exoplatform.ws.frameworks.cometd.ContinuationService getContinuationService()
           
static String getCurrentTime(org.exoplatform.webui.core.UIComponent uiCompo)
           
static String getCurrentUser()
           
static org.exoplatform.calendar.service.CalendarSetting getCurrentUserCalendarSetting()
           
static String getDataSource(org.exoplatform.calendar.service.Attachment attach, org.exoplatform.download.DownloadService dservice)
           
static Calendar getEndDay(Calendar cal)
           
static Calendar getEndDay(Date date)
           
static String getGroupCalendarName(String groupName, String calendarName)
           
static Calendar getInstanceOfCurrentCalendar()
           
static Calendar getInstanceTempCalendar()
          Deprecated.  
static String getLabel(String componentid, String id)
           
static int getLimitUploadSize()
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getLocaleSelectBoxOptions(Locale[] locale)
           
static String getLocationDisplayString(String locationName)
          render display string for an ISO3 location name.
static org.exoplatform.services.mail.MailService getMailService()
           
static org.exoplatform.services.organization.OrganizationService getOrganizationService()
           
static String getResourceBundle(String key, String defaultValue)
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getSendValue(String more)
           
static String getServerBaseUrl()
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String timeFormat)
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String timeFormat, int timeInteval)
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String labelFormat, String valueFormat)
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String labelFormat, String valueFormat, long timeInteval)
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String labelFormat, String valueFormat, long timeInteval, Locale locale)
           
static String getTimeZone(String timezone)
           
static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimeZoneSelectBoxOptions(String[] timeZoneIds)
           
static String[] getUserGroups(String username)
           
static boolean hasEditPermission(String[] savePerms, String[] checkPerms)
           
static String invalidEmailAddresses(String addressList)
           
static String invalidUsers(String userList)
           
static boolean isAllDayEvent(org.exoplatform.calendar.service.CalendarEvent eventCalendar)
           
static boolean isAllEmailValid(String addressList)
           
static boolean isEmailValid(String value)
           
static boolean isEmpty(String value)
           
static boolean isMemberShipType(Collection<org.exoplatform.services.organization.Membership> mbsh, String value)
           
static boolean isNameEmpty(String name)
           
static boolean isSameDate(Calendar date1, Calendar date2)
           
static boolean isSameDate(Date value1, Date value2)
           
static boolean isUserExisted(org.exoplatform.services.organization.OrganizationService orgSevice, String value)
           
static boolean isValidEmailAddresses(String addressList)
           
static String parse(Date date, String timeFormat)
           
static String parse(Date date, String timeFormat, Locale locale)
           
static String parseEmailAddress(String address)
           
static String reduceSpace(String s)
           
static org.exoplatform.calendar.service.CalendarSetting removeCurrentCalendarSetting()
          remove current calendar setting from registry.
static void setCurrentCalendarSetting(org.exoplatform.calendar.service.CalendarSetting setting)
          change value of calendar setting of user in registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIVATE_CALENDARS

public static final String PRIVATE_CALENDARS

SHARED_CALENDARS

public static final String SHARED_CALENDARS

PUBLIC_CALENDARS

public static final String PUBLIC_CALENDARS

PRIVATE_TYPE

public static final String PRIVATE_TYPE

SHARED_TYPE

public static final String SHARED_TYPE

PUBLIC_TYPE

public static final String PUBLIC_TYPE

SEMICOLON

public static final String SEMICOLON

COLON

public static final String COLON

COMMA

public static final String COMMA

STAR

public static final String STAR

PLUS

public static final String PLUS

AND

public static final String AND

OR

public static final String OR

PERCENT

public static final String PERCENT

QUESTION_MARK

public static final String QUESTION_MARK

SINGLE_QUOTE

public static final String SINGLE_QUOTE

QUOTE

public static final String QUOTE

AT

public static final String AT

EXCLAMATION

public static final String EXCLAMATION

SHARP

public static final String SHARP

OPEN_PARENTHESIS

public static final String OPEN_PARENTHESIS

CLOSE_PARENTHESIS

public static final String CLOSE_PARENTHESIS

OPEN_SQUARE_BRACKET

public static final String OPEN_SQUARE_BRACKET

CLOSE_SQUARE_BRACKET

public static final String CLOSE_SQUARE_BRACKET

OPEN_SHARP_BRACKET

public static final String OPEN_SHARP_BRACKET

CLOSE_SHARP_BRACKET

public static final String CLOSE_SHARP_BRACKET

MONEY_MARK

public static final String MONEY_MARK

EXPONENT

public static final String EXPONENT

MINUS

public static final String MINUS

SLASH

public static final String SLASH

BACKSLASH

public static final String BACKSLASH

DOUBLESCORE

public static final String DOUBLESCORE

UNDERSCORE

public static final String UNDERSCORE

SLASH_COLON

public static final String SLASH_COLON

COLON_SLASH

public static final String COLON_SLASH

GREATER_THAN

public static final String GREATER_THAN

SMALLER_THAN

public static final String SMALLER_THAN

ANY

public static final String ANY

ANY_OF

public static final String ANY_OF

DOT

public static final String DOT

TIMEFORMAT

public static final String TIMEFORMAT

DATEFORMAT

public static final String DATEFORMAT

TIMEFORMATPATTERNS

public static final String[] TIMEFORMATPATTERNS

DATEFORMAT1

public static final String DATEFORMAT1

DATEFORMAT2

public static final String DATEFORMAT2

DATEFORMAT3

public static final String DATEFORMAT3

DATEFORMAT4

public static final String DATEFORMAT4

DATEFORMATS

public static final String[] DATEFORMATS

FORMATPATTERN1

public static final String FORMATPATTERN1

FORMATPATTERN2

public static final String FORMATPATTERN2

FORMATPATTERN3

public static final String FORMATPATTERN3

FORMATPATTERN4

public static final String FORMATPATTERN4

FORMATPATTERNS

public static final String[] FORMATPATTERNS

TWELVE_HOURS

public static final String TWELVE_HOURS

TWENTY_FOUR_HOURS

public static final String TWENTY_FOUR_HOURS

DEFAULT_VALUE_UPLOAD_PORTAL

public static final int DEFAULT_VALUE_UPLOAD_PORTAL
See Also:
Constant Field Values

BREAK_LINE

public static final String BREAK_LINE

DATETIMEFORMAT

public static final String DATETIMEFORMAT

DEFAULT_TIMEITERVAL

public static final int DEFAULT_TIMEITERVAL
See Also:
Constant Field Values

MILISECONS_OF_DAY

public static final long MILISECONS_OF_DAY
See Also:
Constant Field Values

EXO_INVITATION

public static final String EXO_INVITATION

SPECIALCHARACTER

public static final String[] SPECIALCHARACTER

EXTENDEDCHARACTER

public static final String[] EXTENDEDCHARACTER

EXTENDEDKEYWORD

public static final String[] EXTENDEDKEYWORD

SIMPLECHARACTER

public static final String[] SIMPLECHARACTER

FIELD_SEND

public static final String FIELD_SEND

ITEM_ALWAYS

public static final String ITEM_ALWAYS

ITEM_NERVER

public static final String ITEM_NERVER

ITEM_ASK

public static final String ITEM_ASK

emailRegex

public static final String emailRegex
See Also:
Constant Field Values

contactRegex

public static final String contactRegex
See Also:
Constant Field Values

INVITATION_URL

public static final String INVITATION_URL

INVITATION_IMPORT_URL

public static final String INVITATION_IMPORT_URL

INVITATION_DETAIL_URL

public static final String INVITATION_DETAIL_URL

DETAILS_URL

public static final String DETAILS_URL
See Also:
Constant Field Values
Constructor Detail

CalendarUtils

public CalendarUtils()
Method Detail

getUserGroups

public static final String[] getUserGroups(String username)
                                    throws Exception
Throws:
Exception

getAllGroups

public static String[] getAllGroups()
                             throws Exception
Throws:
Exception

isEmpty

public static boolean isEmpty(String value)

getCalendarService

public static org.exoplatform.calendar.service.CalendarService getCalendarService()
                                                                           throws Exception
Throws:
Exception

getOrganizationService

public static org.exoplatform.services.organization.OrganizationService getOrganizationService()
                                                                                        throws Exception
Throws:
Exception

removeCurrentCalendarSetting

public static org.exoplatform.calendar.service.CalendarSetting removeCurrentCalendarSetting()
remove current calendar setting from registry.

Returns:

setCurrentCalendarSetting

public static void setCurrentCalendarSetting(org.exoplatform.calendar.service.CalendarSetting setting)
change value of calendar setting of user in registry.

Parameters:
setting - = null means that current calendar setting will be removed.

getCurrentUserCalendarSetting

public static org.exoplatform.calendar.service.CalendarSetting getCurrentUserCalendarSetting()
Returns:
calendar setting of current user. return null if any exception is thrown.

getInstanceTempCalendar

public static Calendar getInstanceTempCalendar()
Deprecated. 

Returns:

getCalendarInstanceBySetting

public static Calendar getCalendarInstanceBySetting(org.exoplatform.calendar.service.CalendarSetting calendarSetting)
get calendar by user setting (timezone, first day of week)

Parameters:
calendarSetting -
Returns:
calendar object

getInstanceOfCurrentCalendar

public static Calendar getInstanceOfCurrentCalendar()
Returns:
return an instance of Calendar class which contains user's setting, such as, time zone, first day of week.

getTimesSelectBoxOptions

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String timeFormat)

getTimesSelectBoxOptions

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String labelFormat,
                                                                                                       String valueFormat)

getTimesSelectBoxOptions

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String labelFormat,
                                                                                                       String valueFormat,
                                                                                                       long timeInteval)

getTimesSelectBoxOptions

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String labelFormat,
                                                                                                       String valueFormat,
                                                                                                       long timeInteval,
                                                                                                       Locale locale)

getTimesSelectBoxOptions

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimesSelectBoxOptions(String timeFormat,
                                                                                                       int timeInteval)

generateTimeZoneLabel

public static String generateTimeZoneLabel(String timeZoneID)
render time zone label for a time zone.

Parameters:
timeZoneID -
Returns:
display string for the time zone id, which contains value of GMT offset and time zone id. For example, display string for "Asia/Ho_Chi_Minh" would be "(GMT +07:00) Asia/Ho_Chi_Minh".

getTimeZoneSelectBoxOptions

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getTimeZoneSelectBoxOptions(String[] timeZoneIds)

getLocationDisplayString

public static String getLocationDisplayString(String locationName)
render display string for an ISO3 location name.

Parameters:
locationName - - ISO3 location name
Returns:
display string that contains display country name and display language name. For example, output for "VNM" would be "Vietnam(Vietnamese)".

getLocaleSelectBoxOptions

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getLocaleSelectBoxOptions(Locale[] locale)

parse

public static String parse(Date date,
                           String timeFormat)
                    throws Exception
Throws:
Exception

parse

public static String parse(Date date,
                           String timeFormat,
                           Locale locale)
                    throws Exception
Throws:
Exception

getCurrentUser

public static String getCurrentUser()
                             throws Exception
Throws:
Exception

isAllDayEvent

public static boolean isAllDayEvent(org.exoplatform.calendar.service.CalendarEvent eventCalendar)

isSameDate

public static boolean isSameDate(Calendar date1,
                                 Calendar date2)

isSameDate

public static boolean isSameDate(Date value1,
                                 Date value2)

getBeginDay

public static Calendar getBeginDay(Calendar cal)

getEndDay

public static Calendar getEndDay(Calendar cal)

getBeginDay

public static Calendar getBeginDay(Date date)

getEndDay

public static Calendar getEndDay(Date date)

getDataSource

public static String getDataSource(org.exoplatform.calendar.service.Attachment attach,
                                   org.exoplatform.download.DownloadService dservice)
                            throws Exception
Throws:
Exception

isNameEmpty

public static boolean isNameEmpty(String name)

getServerBaseUrl

public static String getServerBaseUrl()

getTimeZone

public static String getTimeZone(String timezone)

getCalendarURL

public static String getCalendarURL()
                             throws Exception
Returns:
the base URL to the current calendar application
Throws:
Exception

hasEditPermission

public static boolean hasEditPermission(String[] savePerms,
                                        String[] checkPerms)

canEdit

public static boolean canEdit(org.exoplatform.services.organization.OrganizationService oService,
                              String[] savePerms,
                              String username)
                       throws Exception
Throws:
Exception

getCheckPermissionString

public static String getCheckPermissionString()
                                       throws Exception
Throws:
Exception

isMemberShipType

public static boolean isMemberShipType(Collection<org.exoplatform.services.organization.Membership> mbsh,
                                       String value)

getCalendarOption

public static List<org.exoplatform.webui.core.model.SelectItem> getCalendarOption()
                                                                           throws Exception
Throws:
Exception

getGroupCalendarName

public static String getGroupCalendarName(String groupName,
                                          String calendarName)

getCalendarCategoryOption

public static List<org.exoplatform.webui.core.model.SelectItem> getCalendarCategoryOption()
                                                                                   throws Exception
Throws:
Exception

getAllOfCurrentUserCalendars

public static List<org.exoplatform.calendar.service.Calendar> getAllOfCurrentUserCalendars()
                                                                                    throws Exception
Throws:
Exception

encodeJCRText

public static String encodeJCRText(String str)

encodeHTML

public static String encodeHTML(String htmlContent)
                         throws Exception
Throws:
Exception

getMailService

public static org.exoplatform.services.mail.MailService getMailService()
                                                                throws Exception
Throws:
Exception

convertSize

public static String convertSize(long size)
                          throws Exception
Throws:
Exception

isValidEmailAddresses

public static boolean isValidEmailAddresses(String addressList)

invalidEmailAddresses

public static String invalidEmailAddresses(String addressList)

invalidUsers

public static String invalidUsers(String userList)
                           throws Exception
Throws:
Exception

parseEmailAddress

public static String parseEmailAddress(String address)

isEmailValid

public static boolean isEmailValid(String value)

isAllEmailValid

public static boolean isAllEmailValid(String addressList)

isUserExisted

public static boolean isUserExisted(org.exoplatform.services.organization.OrganizationService orgSevice,
                                    String value)

getCurrentTime

public static String getCurrentTime(org.exoplatform.webui.core.UIComponent uiCompo)
                             throws Exception
Throws:
Exception

getSendValue

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getSendValue(String more)

reduceSpace

public static String reduceSpace(String s)

cleanValue

public static String cleanValue(String values)
                         throws Exception
Throws:
Exception

getResourceBundle

public static String getResourceBundle(String key,
                                       String defaultValue)

getContinuationService

public static org.exoplatform.ws.frameworks.cometd.ContinuationService getContinuationService()

getAllOfCalendars

public static List<org.exoplatform.calendar.service.Calendar> getAllOfCalendars(String username)
                                                                         throws Exception
Throws:
Exception

getLabel

public static String getLabel(String componentid,
                              String id)
                       throws Exception
Throws:
Exception

enCodeTitle

public static String enCodeTitle(String s)

getCalendar

public static org.exoplatform.calendar.service.Calendar getCalendar(String calType,
                                                                    String calendarId)
                                                             throws Exception
Throws:
Exception

getCategory

public static List<org.exoplatform.webui.core.model.SelectItemOption<String>> getCategory()
                                                                                   throws Exception
Throws:
Exception

getLimitUploadSize

public static int getLimitUploadSize()


Copyright © 2013 eXo Platform SAS. All Rights Reserved.