org.exoplatform.calendar.service.impl
Class CalendarServiceImpl

java.lang.Object
  extended by org.exoplatform.calendar.service.impl.CalendarServiceImpl
All Implemented Interfaces:
CalendarService, org.picocontainer.Startable

public class CalendarServiceImpl
extends Object
implements CalendarService, org.picocontainer.Startable

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


Field Summary
protected  List<CalendarEventListener> eventListeners_
           
protected  List<CalendarUpdateEventListener> listeners_
           
 
Fields inherited from interface org.exoplatform.calendar.service.CalendarService
CALDAV, EXPORTEDCSV, ICALENDAR
 
Constructor Summary
CalendarServiceImpl(org.exoplatform.container.xml.InitParams params, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, org.exoplatform.services.jcr.RepositoryService reposervice, org.exoplatform.services.resources.ResourceBundleService rbs)
           
 
Method Summary
 void addEventListenerPlugin(CalendarEventListener listener)
           
 void addListenerPlugin(CalendarUpdateEventListener listener)
          
 void assignGroupTask(String taskId, String calendarId, String assignee)
          assign a user as delegator for a group task.
 Map<String,String> checkFreeBusy(EventQuery eventQuery)
          The method will check the time free or busy of the user, it depents on events and tasks of this user now it only check on one day and if the events and tasks marked with busy, out side status will be checked
 void confirmInvitation(String fromUserId, String toUserId, int calType, String calendarId, String eventId, int answer)
          The method calls when the user use exomail product only, when user receives an invitation (in the same data system), the user will congfirme that do they want to take part in or not
 void confirmInvitation(String fromUserId, String confirmingEmail, String confirmingUser, int calType, String calendarId, String eventId, int answer)
          
 org.quartz.JobDetail findSynchronizeRemoteCalendarJob(org.exoplatform.services.scheduler.JobSchedulerService schedulerService, String username)
           
 int generateRss(String username, LinkedHashMap<String,Calendar> calendars, RssData rssData)
          The menthod uses to make url to contants links to subcribe calendar folows RSS stand
 int generateRss(String username, List<String> calendarIds, RssData rssData)
          The menthod uses to make url to contants links to subcribe calendar folows RSS stand
 String getCalDavResourceEtag(String username, String calendarId, String eventId)
           
 String getCalDavResourceHref(String username, String calendarId, String eventId)
           
 CalendarImportExport getCalendarImportExports(String type)
          The method gets Import/Export implement class to import or export ics,csv
 CalendarSetting getCalendarSetting(String username)
          This method gets infomations of current user's setting
 CalendarEvent getEvent(String username, String eventId)
          Get a personal event for a given owner
 CalendarEvent getEventById(String eventId)
           
 List<EventCategory> getEventCategories(String username)
          The method gets all categories of event
 EventCategory getEventCategory(String username, String eventCategoryId)
          The method gets category of event by given id
 EventCategory getEventCategoryByName(String username, String eventCategoryName)
          The method gets category of event by given id
 List<CalendarEvent> getEvents(String username, EventQuery eventQuery, String[] publicCalendarIds)
          The method selects all the events and tasks by given conditions, it includes events of private, public and share calendars
 List<CalendarEvent> getExceptionEvents(String username, CalendarEvent recurEvent)
          Get all exception occurrences from a original recurrence event, the exception event always belong to same calendar with original recurrence event
 String[] getExportImportType()
          The method gets types of data will be imported and exported
 List<FeedData> getFeeds(String username)
          It gets data form server and show the url to view contents of RSS
 Calendar getGroupCalendar(String calendarId)
          The method gets all calendar of a group user, we called it is group calendar it means the calendar for group of users and depen on the permission the user will have right to view or edit that calendar
 List<GroupCalendarData> getGroupCalendars(String[] groupIds, boolean isShowAll, String username)
          The method gets all the group calendar data of current user and list of calendars belong to that group with group calendar data it will classify calendar to each group
 CalendarEvent getGroupEvent(String eventId)
          Get a group event from eventID
 CalendarEvent getGroupEvent(String calendarId, String eventId)
          The method gets event or task form group calendar by given calendar id
 List<CalendarEvent> getGroupEventByCalendar(List<String> calendarIds)
          The method gets events and tasks by given public calendar ids
 Map<String,CalendarEvent> getOccurrenceEvents(CalendarEvent recurEvent, Calendar from, Calendar to, String timezone)
          Get all virtual occurrences from an original recurrence event in a period of time
The result will be depended on the recurrence rule, the start date of recurrence event and the period of time to view.
 List<CalendarEvent> getOriginalRecurrenceEvents(String username, Calendar from, Calendar to, String[] publicCalendarIds)
          Get all original recurrence events of an user in period of time
 List<CalendarEvent> getPublicEvents(EventQuery eventQuery)
          The method gets events and tasks by given event query
 RemoteCalendar getRemoteCalendar(String owner, String calendarId)
          
 Calendar getRemoteCalendar(String owner, String remoteUrl, String remoteType)
           
 int getRemoteCalendarCount(String username)
           
 RemoteCalendarService getRemoteCalendarService()
          Get the RemoteCalendarService object
 ResourceBundle getResourceBundle()
           
 javax.jcr.Node getRssHome(String username)
          The method return root of rss data store area
 GroupCalendarData getSharedCalendars(String username, boolean isShowAll)
          The method gets all shared calendars of the current user
 CalendarEvent getSharedEvent(String username, String calendarId, String eventId)
          Get a shared event of user from user name, id of shared calendar, id of shared event
 List<CalendarEvent> getSharedEventByCalendars(String username, List<String> calendarIds)
           
 int getTypeOfCalendar(String userName, String calendarId)
           
 Calendar getUserCalendar(String username, String calendarId)
          The method get private calendar by given calendarId, and all calendar related to this category will be removed
 List<Calendar> getUserCalendars(String username, boolean isShowAll)
          The method queries all private calendars of current user
 List<CalendarEvent> getUserEventByCalendar(String username, List<String> calendarIds)
          The method gets list events and tasks of given private calendar ids
 List<CalendarEvent> getUserEvents(String username, EventQuery eventQuery)
          The method gets all events and tasks by given conditions in event query
 Calendar importRemoteCalendar(RemoteCalendar remoteCalendar)
          Import an online .ics or through CalDav access to local calendar
 void initNewUser(String userName, CalendarSetting defaultCalendarSetting_)
           
 boolean isGroupBeingShared(String group, org.exoplatform.services.scheduler.impl.JobSchedulerServiceImpl schedulerService_)
          checks if a group is belong to a list of groups that's being shared
 boolean isRemoteCalendar(String username, String calendarId)
          Check if the calendar with given calendarId is a remote calendar
 boolean isValidRemoteUrl(String url, String type, String remoteUser, String remotePassword)
          Check if the remote url is valid, in 2 cases of iCalendar url or CalDav url, with authentication
 void loadSynchronizeRemoteCalendarJob(String username)
           
 void moveEvent(String fromCalendar, String toCalendar, String fromType, String toType, List<CalendarEvent> calEvents, String username)
          The method move and save events form private calendars share calendars public calendars each other
 Calendar refreshRemoteCalendar(String username, String remoteCalendarId)
          Reload remote calendar data
 void removeEventCategory(String username, String eventCategoryId)
          Remove event category, all events and tasks belong to this category will be destroyed
 void removeFeedData(String username, String title)
           
 void removeOccurrenceInstance(String username, CalendarEvent occurrence)
          Remove only an occurrence instance from recurrence series, this function will get the original event node of the occurrence and then put the recurrence id of the need-to-delete occurrence to excludeId list of original node.
 Calendar removePublicCalendar(String calendarId)
          Remove the group calendar form data base, every events, tasks inside this calendar will be removed too
 CalendarEvent removePublicEvent(String calendarId, String eventId)
          Remove event or task, all attachments and reminders item will be removed
 void removeRecurrenceSeries(String username, CalendarEvent originalEvent)
          Remove all occurrence from an recurrence series.
 void removeSharedCalendar(String username, String calendarId)
          Removed shared calendar, but not the orloginal calendar
 void removeSharedCalendarByJob(String username, List<String> unsharedGroups, String calendarId)
          unsharing a calendar with a group will run in background
 void removeSharedCalendarFolder(String username)
          This method removes the shared calendar folder of this user and all references (from shared calendars) to this folder.
 void removeSharedEvent(String username, String calendarId, String eventId)
          The method removes the events or tasks form shared calendar, orloginal item will be removed
 Calendar removeUserCalendar(String username, String calendarId)
          Remove private calendar by given id, all events and tasks belong to this calendar will be removed
 CalendarEvent removeUserEvent(String username, String calendarId, String eventId)
          Remove given event or task in private calendar with calendar id, all attachments and reminders will be removed
 void saveCalendarSetting(String username, CalendarSetting setting)
          This menthod stores individual setting of each user, with setting you can configue many things like Default view date, time formating, time inteval
 void saveEventCategory(String username, EventCategory eventCategory, boolean isNew)
          Save event category to data base, every user will have their own category to classify events, and it will use unique name in data base
 void saveEventCategory(String username, EventCategory eventCategory, String[] values, boolean isNew)
          
 void saveEventToSharedCalendar(String username, String calendarId, CalendarEvent event, boolean isNew)
          Add event to shared calendar, mean add event to orloginal calendar too
 void savePublicCalendar(Calendar calendar, boolean isNew)
          The method save calendar to public area (group calendar)
 void savePublicEvent(String calendarId, CalendarEvent event, boolean isNew)
          Save event or task by given group calendar id
 void saveSharedCalendar(String username, Calendar calendar)
          The method save all infomations about shared calendar, it will be updated original calendar
 void saveUserCalendar(String username, Calendar calendar, boolean isNew)
          The method saves private calendar infomations in to data base
 void saveUserEvent(String username, String calendarId, CalendarEvent event, boolean isNew)
          The method save infomation to an event or a task by given private calendar id to data
 EventPageList searchEvent(String username, EventQuery query, String[] publicCalendarIds)
          The method query events and tasks form given coditions, the coditions know by set value for eventquery
 Map<Integer,String> searchHighlightRecurrenceEvent(String username, EventQuery eventQuery, String[] publicCalendarIds, String timezone)
          Find all days of month or year that have event/task to highlight from all personal, shared and public calendar of an user
This function is much same like searchHightLightEvent() function but it only counts for recurrence event
 Map<Integer,String> searchHightLightEvent(String username, EventQuery eventQuery, String[] publicCalendarIds)
          The method query all events, tasks and mark to hightlight the date have events or tasks
 void setCalDavResourceEtag(String username, String calendarId, String eventId, String etag)
           
 void setCalDavResourceHref(String username, String calendarId, String eventId, String href)
           
 void setGroupTaskStatus(String taskId, String calendarId, String status)
          set status value of a group task.
 void shareCalendar(String username, String calendarId, List<String> receiverUsers)
          The method share the private calendar to other user, it can share for one or many users
 void shareCalendarByRunJob(String username, String calendarId, List<String> sharedGroups)
          sharing a calendar with a group will run in background add jobs for sharing and unsharing calendar with group
 void start()
           
 void stop()
           
 void stopSynchronizeRemoteCalendarJob(String username)
           
 void updateOccurrenceEvent(String fromCalendar, String toCalendar, String fromType, String toType, List<CalendarEvent> calEvents, String username)
          Update an occurrence event, there are two cases: if this occurrence is virtual occurrence, convert it to exception,
if this occurrence is exception, update it as a normal event
 void updateRecurrenceSeries(String fromCalendar, String toCalendar, String fromType, String toType, CalendarEvent occurrence, String username)
          Update recurrence series from an occurrence, this function is only called if the occurrence event is not changed the from date property.
 Calendar updateRemoteCalendarInfo(RemoteCalendar remoteCalendar)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners_

protected List<CalendarUpdateEventListener> listeners_

eventListeners_

protected List<CalendarEventListener> eventListeners_
Constructor Detail

CalendarServiceImpl

public CalendarServiceImpl(org.exoplatform.container.xml.InitParams params,
                           org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator,
                           org.exoplatform.services.jcr.RepositoryService reposervice,
                           org.exoplatform.services.resources.ResourceBundleService rbs)
                    throws Exception
Throws:
Exception
Method Detail

getUserCalendar

public Calendar getUserCalendar(String username,
                                String calendarId)
                         throws Exception
The method get private calendar by given calendarId, and all calendar related to this category will be removed

Specified by:
getUserCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
Returns:
Calendar object returned contants details of a calendar
Throws:
Exception
See Also:
Calendar

getUserCalendars

public List<Calendar> getUserCalendars(String username,
                                       boolean isShowAll)
                                throws Exception
The method queries all private calendars of current user

Specified by:
getUserCalendars in interface CalendarService
Parameters:
username - current user name(or user id)
isShowAll - boolean value if equals true will get all private calendars, equals false it will take only the calendars in current user's setting
Returns:
List of calendar object
Throws:
Exception
See Also:
Calendar

saveUserCalendar

public void saveUserCalendar(String username,
                             Calendar calendar,
                             boolean isNew)
                      throws Exception
The method saves private calendar infomations in to data base

Specified by:
saveUserCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendar - object contants infomations
isNew - Boolean value to know add new calendar or update infomations only
Throws:
Exception

removeUserCalendar

public Calendar removeUserCalendar(String username,
                                   String calendarId)
                            throws Exception
Remove private calendar by given id, all events and tasks belong to this calendar will be removed

Specified by:
removeUserCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
Returns:
Throws:
Exception

getGroupCalendar

public Calendar getGroupCalendar(String calendarId)
                          throws Exception
The method gets all calendar of a group user, we called it is group calendar it means the calendar for group of users and depen on the permission the user will have right to view or edit that calendar

Specified by:
getGroupCalendar in interface CalendarService
Parameters:
calendarId - given calendar id
Returns:
Calendar object contains information
Throws:
Exception
See Also:
Calendar

getGroupCalendars

public List<GroupCalendarData> getGroupCalendars(String[] groupIds,
                                                 boolean isShowAll,
                                                 String username)
                                          throws Exception
The method gets all the group calendar data of current user and list of calendars belong to that group with group calendar data it will classify calendar to each group

Specified by:
getGroupCalendars in interface CalendarService
Parameters:
groupIds - The group ids that current user belong
isShowAll - Gets all calendar or use setting from calendar setting
username - current user name(or user id)
Returns:
List of GroupCalendarData and each GroupCalendarData contains List of calendar object too
Throws:
Exception
See Also:
GroupCalendarData

savePublicCalendar

public void savePublicCalendar(Calendar calendar,
                               boolean isNew)
                        throws Exception
The method save calendar to public area (group calendar)

Specified by:
savePublicCalendar in interface CalendarService
isNew - Boolean value will be checked is it add new or update information only
Throws:
Exception

removePublicCalendar

public Calendar removePublicCalendar(String calendarId)
                              throws Exception
Remove the group calendar form data base, every events, tasks inside this calendar will be removed too

Specified by:
removePublicCalendar in interface CalendarService
Returns:
Throws:
Exception

getEventCategories

public List<EventCategory> getEventCategories(String username)
                                       throws Exception
The method gets all categories of event

Specified by:
getEventCategories in interface CalendarService
Parameters:
username - current user name(or user id)
Returns:
List event category object
Throws:
Exception
See Also:
EventCategory

saveEventCategory

public void saveEventCategory(String username,
                              EventCategory eventCategory,
                              boolean isNew)
                       throws Exception
Save event category to data base, every user will have their own category to classify events, and it will use unique name in data base

Specified by:
saveEventCategory in interface CalendarService
Parameters:
username - current user name(or user id)
Throws:
Exception

saveEventCategory

public void saveEventCategory(String username,
                              EventCategory eventCategory,
                              String[] values,
                              boolean isNew)
                       throws Exception

Throws:
Exception

removeEventCategory

public void removeEventCategory(String username,
                                String eventCategoryId)
                         throws Exception
Remove event category, all events and tasks belong to this category will be destroyed

Specified by:
removeEventCategory in interface CalendarService
Parameters:
username - current user name(or user id)
eventCategoryId - The unique name of category
Throws:
Exception

getUserEventByCalendar

public List<CalendarEvent> getUserEventByCalendar(String username,
                                                  List<String> calendarIds)
                                           throws Exception
The method gets list events and tasks of given private calendar ids

Specified by:
getUserEventByCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendarIds - given calendar ids
Returns:
List of events and tasks
Throws:
Exception

getUserEvents

public List<CalendarEvent> getUserEvents(String username,
                                         EventQuery eventQuery)
                                  throws Exception
The method gets all events and tasks by given conditions in event query

Specified by:
getUserEvents in interface CalendarService
Parameters:
username - current user name(or user id)
eventQuery - given coditons
Returns:
List of CalendarEvent object (events and tasks)
Throws:
Exception
See Also:
CalendarEvent

getEvent

public CalendarEvent getEvent(String username,
                              String eventId)
                       throws Exception
Description copied from interface: CalendarService
Get a personal event for a given owner

Specified by:
getEvent in interface CalendarService
Parameters:
username - user id of the event owner
eventId - id of event to get
Returns:
CalendarEvent in the personal events of owner
Throws:
Exception

saveUserEvent

public void saveUserEvent(String username,
                          String calendarId,
                          CalendarEvent event,
                          boolean isNew)
                   throws Exception
The method save infomation to an event or a task by given private calendar id to data

Specified by:
saveUserEvent in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
event - object contants infomations
isNew - boolean value, is update or add new event
Throws:
Exception

removeUserEvent

public CalendarEvent removeUserEvent(String username,
                                     String calendarId,
                                     String eventId)
                              throws Exception
Remove given event or task in private calendar with calendar id, all attachments and reminders will be removed

Specified by:
removeUserEvent in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
eventId - given event id
Returns:
Throws:
Exception

getGroupEvent

public CalendarEvent getGroupEvent(String eventId)
                            throws Exception
Get a group event from eventID

Specified by:
getGroupEvent in interface CalendarService
Returns:
CalendarEvent object or null if event was not found
Throws:
Exception

getGroupEvent

public CalendarEvent getGroupEvent(String calendarId,
                                   String eventId)
                            throws Exception
The method gets event or task form group calendar by given calendar id

Specified by:
getGroupEvent in interface CalendarService
Parameters:
calendarId - given calendar id
eventId - given event id
Returns:
CalendarEvent object contains information and attachments, reminders
Throws:
Exception
See Also:
CalendarEvent

getGroupEventByCalendar

public List<CalendarEvent> getGroupEventByCalendar(List<String> calendarIds)
                                            throws Exception
The method gets events and tasks by given public calendar ids

Specified by:
getGroupEventByCalendar in interface CalendarService
Parameters:
calendarIds - public calendar ids
Returns:
List calendar event object
Throws:
Exception
See Also:
CalendarEvent

getPublicEvents

public List<CalendarEvent> getPublicEvents(EventQuery eventQuery)
                                    throws Exception
The method gets events and tasks by given event query

Specified by:
getPublicEvents in interface CalendarService
Parameters:
eventQuery - object contants given conditions
Returns:
List calendar event object
Throws:
Exception
See Also:
CalendarEvent

savePublicEvent

public void savePublicEvent(String calendarId,
                            CalendarEvent event,
                            boolean isNew)
                     throws Exception
Save event or task by given group calendar id

Specified by:
savePublicEvent in interface CalendarService
Parameters:
calendarId - given calendar id
event - object contants infomation about event
isNew - boolean value to check update or add new event
Throws:
Exception

removePublicEvent

public CalendarEvent removePublicEvent(String calendarId,
                                       String eventId)
                                throws Exception
Remove event or task, all attachments and reminders item will be removed

Specified by:
removePublicEvent in interface CalendarService
Parameters:
calendarId - given calendar id
eventId - given event or task id
Returns:
Throws:
Exception

getCalendarImportExports

public CalendarImportExport getCalendarImportExports(String type)
The method gets Import/Export implement class to import or export ics,csv

Specified by:
getCalendarImportExports in interface CalendarService
Parameters:
type - type of import, export, it supports two types, ICS and CSV
Returns:
CalendarImportExport
See Also:
CalendarImportExport

getExportImportType

public String[] getExportImportType()
                             throws Exception
The method gets types of data will be imported and exported

Specified by:
getExportImportType in interface CalendarService
Returns:
types of inport/export
Throws:
Exception

saveCalendarSetting

public void saveCalendarSetting(String username,
                                CalendarSetting setting)
                         throws Exception
This menthod stores individual setting of each user, with setting you can configue many things like Default view date, time formating, time inteval

Specified by:
saveCalendarSetting in interface CalendarService
Parameters:
username - current user name(or user id)
setting - Obicject containts infomations about setting
Throws:
Exception

getCalendarSetting

public CalendarSetting getCalendarSetting(String username)
                                   throws Exception
This method gets infomations of current user's setting

Specified by:
getCalendarSetting in interface CalendarService
Parameters:
username - current user name(or user id)
Returns:
Throws:
Exception
See Also:
CalendarSetting

generateRss

public int generateRss(String username,
                       LinkedHashMap<String,Calendar> calendars,
                       RssData rssData)
                throws Exception
The menthod uses to make url to contants links to subcribe calendar folows RSS stand

Specified by:
generateRss in interface CalendarService
Parameters:
username - current user name(or user id)
rssData - object contants infomations about the rss feed
Returns:
Throws:
Exception
See Also:
RssData

getFeeds

public List<FeedData> getFeeds(String username)
                        throws Exception
It gets data form server and show the url to view contents of RSS

Specified by:
getFeeds in interface CalendarService
Parameters:
username - current user name(or user id)
Returns:
List of FeedData
Throws:
Exception
See Also:
FeedData

getRssHome

public javax.jcr.Node getRssHome(String username)
                          throws Exception
The method return root of rss data store area

Specified by:
getRssHome in interface CalendarService
Parameters:
username - current user name(or user id)
Returns:
Throws:
Exception

searchEvent

public EventPageList searchEvent(String username,
                                 EventQuery query,
                                 String[] publicCalendarIds)
                          throws Exception
The method query events and tasks form given coditions, the coditions know by set value for eventquery

Specified by:
searchEvent in interface CalendarService
Parameters:
username - current user name(or user id)
query - object contants coditions to query
publicCalendarIds - pulic calendar ids
Returns:
Throws:
Exception
See Also:
EventPageList

getEventCategory

public EventCategory getEventCategory(String username,
                                      String eventCategoryId)
                               throws Exception
The method gets category of event by given id

Specified by:
getEventCategory in interface CalendarService
Parameters:
username - current user name(or user id)
eventCategoryId - given event category id
Returns:
event category object contents infomations
Throws:
Exception
See Also:
EventCategory

searchHightLightEvent

public Map<Integer,String> searchHightLightEvent(String username,
                                                 EventQuery eventQuery,
                                                 String[] publicCalendarIds)
                                          throws Exception
The method query all events, tasks and mark to hightlight the date have events or tasks

Specified by:
searchHightLightEvent in interface CalendarService
Parameters:
username - current user name(or user id)
eventQuery - object contants coditions to query
publicCalendarIds - publicCalendarIds pulic calendar ids
Returns:
Throws:
Exception

shareCalendar

public void shareCalendar(String username,
                          String calendarId,
                          List<String> receiverUsers)
                   throws Exception
The method share the private calendar to other user, it can share for one or many users

Specified by:
shareCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
receiverUsers - List receive user username or id
Throws:
Exception

getSharedCalendars

public GroupCalendarData getSharedCalendars(String username,
                                            boolean isShowAll)
                                     throws Exception
The method gets all shared calendars of the current user

Specified by:
getSharedCalendars in interface CalendarService
Parameters:
username - current user name(or user id)
isShowAll - boolean value to point out that it will get all calendars or use user's clendar setting
Returns:
Throws:
Exception
See Also:
GroupCalendarData

getEvents

public List<CalendarEvent> getEvents(String username,
                                     EventQuery eventQuery,
                                     String[] publicCalendarIds)
                              throws Exception
The method selects all the events and tasks by given conditions, it includes events of private, public and share calendars

Specified by:
getEvents in interface CalendarService
Parameters:
username - current user name(or user id)
eventQuery - given coditions
publicCalendarIds - public calendar ids
Returns:
Throws:
Exception
See Also:
CalendarEvent

removeSharedCalendar

public void removeSharedCalendar(String username,
                                 String calendarId)
                          throws Exception
Removed shared calendar, but not the orloginal calendar

Specified by:
removeSharedCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
Throws:
Exception

removeSharedCalendarFolder

public void removeSharedCalendarFolder(String username)
                                throws Exception
Description copied from interface: CalendarService
This method removes the shared calendar folder of this user and all references (from shared calendars) to this folder.

Specified by:
removeSharedCalendarFolder in interface CalendarService
Parameters:
username - the username
Throws:
Exception

saveEventToSharedCalendar

public void saveEventToSharedCalendar(String username,
                                      String calendarId,
                                      CalendarEvent event,
                                      boolean isNew)
                               throws Exception
Add event to shared calendar, mean add event to orloginal calendar too

Specified by:
saveEventToSharedCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
event - object contants infomations about event
isNew - boolean value to check that add new or update event
Throws:
Exception

checkFreeBusy

public Map<String,String> checkFreeBusy(EventQuery eventQuery)
                                 throws Exception
The method will check the time free or busy of the user, it depents on events and tasks of this user now it only check on one day and if the events and tasks marked with busy, out side status will be checked

Specified by:
checkFreeBusy in interface CalendarService
Parameters:
eventQuery - The query object it containts query statement to look up the data
Returns:
Map data with key is user name (or user id), and value is the a pair of from time and to time by miliseconds and sperate by coma(,)
Throws:
Exception
See Also:
EventQuery

saveSharedCalendar

public void saveSharedCalendar(String username,
                               Calendar calendar)
                        throws Exception
The method save all infomations about shared calendar, it will be updated original calendar

Specified by:
saveSharedCalendar in interface CalendarService
Parameters:
username - current user name(or user id)
calendar - the oject contants infomations
Throws:
Exception

removeSharedEvent

public void removeSharedEvent(String username,
                              String calendarId,
                              String eventId)
                       throws Exception
The method removes the events or tasks form shared calendar, orloginal item will be removed

Specified by:
removeSharedEvent in interface CalendarService
Parameters:
username - current user name(or user id)
calendarId - given calendar id
eventId - given event id
Throws:
Exception

moveEvent

public void moveEvent(String fromCalendar,
                      String toCalendar,
                      String fromType,
                      String toType,
                      List<CalendarEvent> calEvents,
                      String username)
               throws Exception
The method move and save events form private calendars share calendars public calendars each other

Specified by:
moveEvent in interface CalendarService
Parameters:
fromCalendar - the source calendar id
toCalendar - destination calendar id
fromType - type of source calendar
toType - type of destination calendar
calEvents - List of object contant infomations
username - current user name(or user id)
Throws:
Exception

confirmInvitation

public void confirmInvitation(String fromUserId,
                              String toUserId,
                              int calType,
                              String calendarId,
                              String eventId,
                              int answer)
The method calls when the user use exomail product only, when user receives an invitation (in the same data system), the user will congfirme that do they want to take part in or not

Specified by:
confirmInvitation in interface CalendarService
Parameters:
fromUserId - id or user name of the user, who make the invitation
toUserId - receiver user's id or name
calType - type of calendar contants the event
calendarId - given calendar id
eventId - given event id
answer - The answer of the receive user

confirmInvitation

public void confirmInvitation(String fromUserId,
                              String confirmingEmail,
                              String confirmingUser,
                              int calType,
                              String calendarId,
                              String eventId,
                              int answer)
                       throws Exception

Specified by:
confirmInvitation in interface CalendarService
Throws:
Exception

start

public void start()
Specified by:
start in interface org.picocontainer.Startable

stop

public void stop()
Specified by:
stop in interface org.picocontainer.Startable

addListenerPlugin

public void addListenerPlugin(CalendarUpdateEventListener listener)
                       throws Exception

Specified by:
addListenerPlugin in interface CalendarService
Throws:
Exception

getTypeOfCalendar

public int getTypeOfCalendar(String userName,
                             String calendarId)
                      throws Exception
Specified by:
getTypeOfCalendar in interface CalendarService
Throws:
Exception

generateRss

public int generateRss(String username,
                       List<String> calendarIds,
                       RssData rssData)
                throws Exception
Description copied from interface: CalendarService
The menthod uses to make url to contants links to subcribe calendar folows RSS stand

Specified by:
generateRss in interface CalendarService
Parameters:
username - current user name(or user id)
rssData - object contants infomations about the rss feed
Returns:
Throws:
Exception
See Also:
RssData

getResourceBundle

public ResourceBundle getResourceBundle()
                                 throws Exception
Specified by:
getResourceBundle in interface CalendarService
Throws:
Exception

getEventCategoryByName

public EventCategory getEventCategoryByName(String username,
                                            String eventCategoryName)
                                     throws Exception
Description copied from interface: CalendarService
The method gets category of event by given id

Specified by:
getEventCategoryByName in interface CalendarService
Parameters:
username - current user name(or user id)
eventCategoryName - given event category name
Returns:
event category object contents infomations
Throws:
Exception
See Also:
EventCategory

getSharedEventByCalendars

public List<CalendarEvent> getSharedEventByCalendars(String username,
                                                     List<String> calendarIds)
                                              throws Exception
Specified by:
getSharedEventByCalendars in interface CalendarService
Throws:
Exception

removeFeedData

public void removeFeedData(String username,
                           String title)
Specified by:
removeFeedData in interface CalendarService

initNewUser

public void initNewUser(String userName,
                        CalendarSetting defaultCalendarSetting_)
                 throws Exception
Specified by:
initNewUser in interface CalendarService
Throws:
Exception

addEventListenerPlugin

public void addEventListenerPlugin(CalendarEventListener listener)
                            throws Exception
Specified by:
addEventListenerPlugin in interface CalendarService
Throws:
Exception

assignGroupTask

public void assignGroupTask(String taskId,
                            String calendarId,
                            String assignee)
                     throws Exception
Description copied from interface: CalendarService
assign a user as delegator for a group task.

Specified by:
assignGroupTask in interface CalendarService
Throws:
Exception

setGroupTaskStatus

public void setGroupTaskStatus(String taskId,
                               String calendarId,
                               String status)
                        throws Exception
Description copied from interface: CalendarService
set status value of a group task.

Specified by:
setGroupTaskStatus in interface CalendarService
Throws:
Exception

isRemoteCalendar

public boolean isRemoteCalendar(String username,
                                String calendarId)
                         throws Exception
Check if the calendar with given calendarId is a remote calendar

Specified by:
isRemoteCalendar in interface CalendarService
Parameters:
username - the owner of calendar
calendarId - the Id of calendar
Returns:
true if this calendar is remote, otherwise false
Throws:
Exception

isValidRemoteUrl

public boolean isValidRemoteUrl(String url,
                                String type,
                                String remoteUser,
                                String remotePassword)
                         throws Exception
Check if the remote url is valid, in 2 cases of iCalendar url or CalDav url, with authentication

Specified by:
isValidRemoteUrl in interface CalendarService
Parameters:
url - the remote url
type - the type of remote calendar, iCalendar or CalDav
remoteUser - the remote username used to authenticate
remotePassword - the remote password used to authenticate
Returns:
true if remote url is available in case of iCalendar and CalDav access support in case of CalDav
Throws:
Exception

updateRemoteCalendarInfo

public Calendar updateRemoteCalendarInfo(RemoteCalendar remoteCalendar)
                                  throws Exception

Specified by:
updateRemoteCalendarInfo in interface CalendarService
Parameters:
remoteCalendar - object content all properties for remote calendar.
Returns:
Throws:
Exception

refreshRemoteCalendar

public Calendar refreshRemoteCalendar(String username,
                                      String remoteCalendarId)
                               throws Exception
Reload remote calendar data

Specified by:
refreshRemoteCalendar in interface CalendarService
Parameters:
username - owner of the calendar
remoteCalendarId - object content all properties for remote calendar.Id id of the calendar
Returns:
the remote Calendar object
Throws:
Exception

importRemoteCalendar

public Calendar importRemoteCalendar(RemoteCalendar remoteCalendar)
                              throws Exception
Import an online .ics or through CalDav access to local calendar

Specified by:
importRemoteCalendar in interface CalendarService
Parameters:
remoteCalendar - object content all properties for remote calendar.
Throws:
Exception

getRemoteCalendar

public RemoteCalendar getRemoteCalendar(String owner,
                                        String calendarId)
                                 throws Exception

Specified by:
getRemoteCalendar in interface CalendarService
Parameters:
owner - the owner of this calendar
calendarId - the Id of calendar
Returns:
RemoteCalendar
Throws:
Exception

getRemoteCalendarService

public RemoteCalendarService getRemoteCalendarService()
                                               throws Exception
Get the RemoteCalendarService object

Specified by:
getRemoteCalendarService in interface CalendarService
Returns:
Throws:
Exception

getRemoteCalendar

public Calendar getRemoteCalendar(String owner,
                                  String remoteUrl,
                                  String remoteType)
                           throws Exception
Specified by:
getRemoteCalendar in interface CalendarService
Throws:
Exception

getCalDavResourceHref

public String getCalDavResourceHref(String username,
                                    String calendarId,
                                    String eventId)
                             throws Exception
Specified by:
getCalDavResourceHref in interface CalendarService
Throws:
Exception

getCalDavResourceEtag

public String getCalDavResourceEtag(String username,
                                    String calendarId,
                                    String eventId)
                             throws Exception
Specified by:
getCalDavResourceEtag in interface CalendarService
Throws:
Exception

setCalDavResourceHref

public void setCalDavResourceHref(String username,
                                  String calendarId,
                                  String eventId,
                                  String href)
                           throws Exception
Throws:
Exception

setCalDavResourceEtag

public void setCalDavResourceEtag(String username,
                                  String calendarId,
                                  String eventId,
                                  String etag)
                           throws Exception
Throws:
Exception

loadSynchronizeRemoteCalendarJob

public void loadSynchronizeRemoteCalendarJob(String username)
                                      throws Exception
Specified by:
loadSynchronizeRemoteCalendarJob in interface CalendarService
Throws:
Exception

stopSynchronizeRemoteCalendarJob

public void stopSynchronizeRemoteCalendarJob(String username)
                                      throws Exception
Specified by:
stopSynchronizeRemoteCalendarJob in interface CalendarService
Throws:
Exception

findSynchronizeRemoteCalendarJob

public org.quartz.JobDetail findSynchronizeRemoteCalendarJob(org.exoplatform.services.scheduler.JobSchedulerService schedulerService,
                                                             String username)
                                                      throws Exception
Specified by:
findSynchronizeRemoteCalendarJob in interface CalendarService
Throws:
Exception

getRemoteCalendarCount

public int getRemoteCalendarCount(String username)
                           throws Exception
Specified by:
getRemoteCalendarCount in interface CalendarService
Throws:
Exception

getOccurrenceEvents

public Map<String,CalendarEvent> getOccurrenceEvents(CalendarEvent recurEvent,
                                                     Calendar from,
                                                     Calendar to,
                                                     String timezone)
                                              throws Exception
Description copied from interface: CalendarService
Get all virtual occurrences from an original recurrence event in a period of time
The result will be depended on the recurrence rule, the start date of recurrence event and the period of time to view.

Specified by:
getOccurrenceEvents in interface CalendarService
Parameters:
recurEvent - the original recurrence event
from - the from time
to - the to time
Returns:
the map of CalendarEvent object, each entry will contains an occurrence event object with recurrence-id as the key
Throws:
Exception

updateOccurrenceEvent

public void updateOccurrenceEvent(String fromCalendar,
                                  String toCalendar,
                                  String fromType,
                                  String toType,
                                  List<CalendarEvent> calEvents,
                                  String username)
                           throws Exception
Description copied from interface: CalendarService
Update an occurrence event, there are two cases: if this occurrence is virtual occurrence, convert it to exception,
if this occurrence is exception, update it as a normal event

Specified by:
updateOccurrenceEvent in interface CalendarService
Throws:
Exception

getOriginalRecurrenceEvents

public List<CalendarEvent> getOriginalRecurrenceEvents(String username,
                                                       Calendar from,
                                                       Calendar to,
                                                       String[] publicCalendarIds)
                                                throws Exception
Description copied from interface: CalendarService
Get all original recurrence events of an user in period of time

Specified by:
getOriginalRecurrenceEvents in interface CalendarService
Parameters:
username - the owner of recurrence event
from - from time
to - to time
Returns:
list of CalendarEvent objects
Throws:
Exception

getExceptionEvents

public List<CalendarEvent> getExceptionEvents(String username,
                                              CalendarEvent recurEvent)
                                       throws Exception
Description copied from interface: CalendarService
Get all exception occurrences from a original recurrence event, the exception event always belong to same calendar with original recurrence event

Specified by:
getExceptionEvents in interface CalendarService
Parameters:
username - the owner of this recurrence event
recurEvent - the original recurrence event
Returns:
the list of CalendarEvent objects
Throws:
Exception

removeRecurrenceSeries

public void removeRecurrenceSeries(String username,
                                   CalendarEvent originalEvent)
                            throws Exception
Description copied from interface: CalendarService
Remove all occurrence from an recurrence series. It will delete the original event of recurrence series.
All exception occurrences of this series still exist and will be treated as a normal event

Specified by:
removeRecurrenceSeries in interface CalendarService
Parameters:
username - owner of recurrence event, in case of private or shared calendar
originalEvent - the original recurrence event object
Throws:
Exception

updateRecurrenceSeries

public void updateRecurrenceSeries(String fromCalendar,
                                   String toCalendar,
                                   String fromType,
                                   String toType,
                                   CalendarEvent occurrence,
                                   String username)
                            throws Exception
Description copied from interface: CalendarService
Update recurrence series from an occurrence, this function is only called if the occurrence event is not changed the from date property.
In other way, if the occurrence event move to another date, it will be updated as a 'exception' occurrence and not affects to series

Specified by:
updateRecurrenceSeries in interface CalendarService
Parameters:
fromCalendar - the calendarId of the calendar which the recurrence event belong to before updating
toCalendar - the new calendarId of the recurrence event
fromType - calendarType of recurrence event before updating
toType - calendarType of recurrence event after updating
occurrence - the occurrence contains the new data about recurrence series
username - owner of recurrence event, in case of private and shared calendar
Throws:
Exception

getSharedEvent

public CalendarEvent getSharedEvent(String username,
                                    String calendarId,
                                    String eventId)
                             throws Exception
Description copied from interface: CalendarService
Get a shared event of user from user name, id of shared calendar, id of shared event

Specified by:
getSharedEvent in interface CalendarService
Parameters:
username - username
calendarId - id of shared calendar
eventId - id of shared event
Returns:
the CalendarEvent object
Throws:
Exception

removeOccurrenceInstance

public void removeOccurrenceInstance(String username,
                                     CalendarEvent occurrence)
                              throws Exception
Description copied from interface: CalendarService
Remove only an occurrence instance from recurrence series, this function will get the original event node of the occurrence and then put the recurrence id of the need-to-delete occurrence to excludeId list of original node.

Specified by:
removeOccurrenceInstance in interface CalendarService
Parameters:
username - owner of this occurrence event
occurrence - the occurrence event object to remove
Throws:
Exception

searchHighlightRecurrenceEvent

public Map<Integer,String> searchHighlightRecurrenceEvent(String username,
                                                          EventQuery eventQuery,
                                                          String[] publicCalendarIds,
                                                          String timezone)
                                                   throws Exception
Description copied from interface: CalendarService
Find all days of month or year that have event/task to highlight from all personal, shared and public calendar of an user
This function is much same like searchHightLightEvent() function but it only counts for recurrence event

Specified by:
searchHighlightRecurrenceEvent in interface CalendarService
Parameters:
username - the username of user
eventQuery - EventQuery object to limit time-range
publicCalendarIds - list of public calendar
timezone - timezone
Returns:
Throws:
Exception

shareCalendarByRunJob

public void shareCalendarByRunJob(String username,
                                  String calendarId,
                                  List<String> sharedGroups)
                           throws Exception
sharing a calendar with a group will run in background add jobs for sharing and unsharing calendar with group

Specified by:
shareCalendarByRunJob in interface CalendarService
Throws:
Exception

removeSharedCalendarByJob

public void removeSharedCalendarByJob(String username,
                                      List<String> unsharedGroups,
                                      String calendarId)
                               throws Exception
unsharing a calendar with a group will run in background

Specified by:
removeSharedCalendarByJob in interface CalendarService
Throws:
Exception

isGroupBeingShared

public boolean isGroupBeingShared(String group,
                                  org.exoplatform.services.scheduler.impl.JobSchedulerServiceImpl schedulerService_)
                           throws Exception
Description copied from interface: CalendarService
checks if a group is belong to a list of groups that's being shared

Specified by:
isGroupBeingShared in interface CalendarService
Returns:
Throws:
Exception

getEventById

public CalendarEvent getEventById(String eventId)
                           throws Exception
Specified by:
getEventById in interface CalendarService
Throws:
Exception


Copyright © 2013 eXo Platform SAS. All Rights Reserved.