org.olat.commons.calendar
Class ICalFileCalendarManager

java.lang.Object
  extended by org.olat.commons.calendar.ICalFileCalendarManager
All Implemented Interfaces:
CalendarManager, UserDataDeletable

public class ICalFileCalendarManager
extends java.lang.Object
implements CalendarManager


Field Summary
 
Fields inherited from interface org.olat.commons.calendar.CalendarManager
MAX_SUBJECT_DISPLAY_LENGTH, TYPE_COURSE, TYPE_GROUP, TYPE_USER
 
Constructor Summary
ICalFileCalendarManager(java.io.File fStorageBase)
           
 
Method Summary
 boolean addEventTo(Kalendar cal, KalendarEvent kalendarEvent)
          Add an event to given calendar and save calendar.
 Kalendar buildKalendarFrom(java.lang.String calendarContent, java.lang.String calType, java.lang.String calId)
          Build a Calendar object from String object.
 boolean calendarExists(java.lang.String calendarType, java.lang.String calendarID)
          Check if a calendar already exists for the given id.
 Kalendar createCalendar(java.lang.String type, java.lang.String calendarID)
          Create a new calendar with the given id.
 boolean deleteCalendar(java.lang.String type, java.lang.String calendarID)
          Delete calendar by type and id.
 void deleteCourseCalendar(ICourse course)
          Delete the calendar of the given course.
 void deleteGroupCalendar(BusinessGroup businessGroup)
          Delete the calendar of the given business group.
 void deletePersonalCalendar(Identity identity)
          Delete the personal calendar of an identity.
 void deleteUserData(Identity identity, java.lang.String newDeletedUserName)
          Delete user data for certain user
 KalendarConfig findKalendarConfigForIdentity(Kalendar kalendar, UserRequest ureq)
          Get the individual calendar configuration for a specific calendar for a specific identity.
 Kalendar getCalendar(java.lang.String type, java.lang.String calendarID)
          Get a calendar by type and id.
 java.io.File getCalendarFile(java.lang.String type, java.lang.String calendarID)
          get the calendar file name from type and id
 java.io.File getCalendarICalFile(java.lang.String type, java.lang.String calendarID)
          Get a calendar as iCalendar file.
 KalendarRenderWrapper getCourseCalendar(ICourse course)
          Get calendar for course.
 KalendarRenderWrapper getGroupCalendar(BusinessGroup businessGroup)
          Get a group's calendar.
 KalendarRenderWrapper getImportedCalendar(Identity identity, java.lang.String calendarName)
          Get an identity's personal calendar.
 OLATResourceable getOresHelperFor(Kalendar cal)
          Create Ores Helper object.
 KalendarRenderWrapper getPersonalCalendar(Identity identity)
          Get an identity's personal calendar.
 java.util.List<KalendarRecurEvent> getRecurringDatesInPeriod(java.util.Date periodStart, java.util.Date periodEnd, KalendarEvent kEvent)
          Get all recurrings of an event within the given period
 KalendarEvent getRecurringInPeriod(java.util.Date periodStart, java.util.Date periodEnd, KalendarEvent kEvent)
          Get the recurring event
 boolean isRecurringInPeriod(java.util.Date periodStart, java.util.Date periodEnd, KalendarEvent kEvent)
          Check if the event recurs within the given period
 boolean persistCalendar(Kalendar kalendar)
          Save a calendar.
 net.fortuna.ical4j.model.Calendar readCalendar(java.lang.String type, java.lang.String calendarID)
          Internal read calendar file from filesystem
 boolean removeEventFrom(Kalendar cal, KalendarEvent kalendarEvent)
          Remove an event from given calendar and save calendar.
 void saveKalendarConfigForIdentity(KalendarConfig config, Kalendar kalendar, UserRequest ureq)
          Save the calendar configuration for a specific calendar for a specific identity.
 boolean updateEventAlreadyInSync(Kalendar cal, KalendarEvent kalendarEvent)
          Update an event of given calendar and save calendar.
 boolean updateEventFrom(Kalendar cal, KalendarEvent kalendarEvent)
          Update an event of given calendar and save calendar.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ICalFileCalendarManager

public ICalFileCalendarManager(java.io.File fStorageBase)
Method Detail

calendarExists

public boolean calendarExists(java.lang.String calendarType,
                              java.lang.String calendarID)
Check if a calendar already exists for the given id.

Specified by:
calendarExists in interface CalendarManager
Parameters:
calendarID -
type -
Returns:

createCalendar

public Kalendar createCalendar(java.lang.String type,
                               java.lang.String calendarID)
Description copied from interface: CalendarManager
Create a new calendar with the given id.

Specified by:
createCalendar in interface CalendarManager
Returns:
See Also:
org.olat.calendar.CalendarManager#createClaendar(java.lang.String)

getCalendar

public Kalendar getCalendar(java.lang.String type,
                            java.lang.String calendarID)
Description copied from interface: CalendarManager
Get a calendar by type and id.

Specified by:
getCalendar in interface CalendarManager
Returns:

getOresHelperFor

public OLATResourceable getOresHelperFor(Kalendar cal)
Create Ores Helper object.

Specified by:
getOresHelperFor in interface CalendarManager
Returns:
OLATResourceable for given Kalendar

readCalendar

public net.fortuna.ical4j.model.Calendar readCalendar(java.lang.String type,
                                                      java.lang.String calendarID)
Internal read calendar file from filesystem

Specified by:
readCalendar in interface CalendarManager
Returns:

buildKalendarFrom

public Kalendar buildKalendarFrom(java.lang.String calendarContent,
                                  java.lang.String calType,
                                  java.lang.String calId)
Description copied from interface: CalendarManager
Build a Calendar object from String object.

Specified by:
buildKalendarFrom in interface CalendarManager
Returns:

persistCalendar

public boolean persistCalendar(Kalendar kalendar)
Save a calendar. This method is not thread-safe. Must be called from a synchronized block. Be sure to have the newest calendar (reload calendar in synchronized block before safe it).

Specified by:
persistCalendar in interface CalendarManager
Parameters:
calendar -

deleteCalendar

public boolean deleteCalendar(java.lang.String type,
                              java.lang.String calendarID)
Delete calendar by type and id.

Specified by:
deleteCalendar in interface CalendarManager
Returns:

getCalendarICalFile

public java.io.File getCalendarICalFile(java.lang.String type,
                                        java.lang.String calendarID)
Description copied from interface: CalendarManager
Get a calendar as iCalendar file.

Specified by:
getCalendarICalFile in interface CalendarManager
Returns:

findKalendarConfigForIdentity

public KalendarConfig findKalendarConfigForIdentity(Kalendar kalendar,
                                                    UserRequest ureq)
Description copied from interface: CalendarManager
Get the individual calendar configuration for a specific calendar for a specific identity. If no individual calendar config exists, null is returned.

Specified by:
findKalendarConfigForIdentity in interface CalendarManager
Returns:
See Also:
org.olat.calendar.CalendarManager#findKalendarConfigForIdentity(org.olat.calendar.model.Kalendar, org.olat.core.gui.UserRequest)

saveKalendarConfigForIdentity

public void saveKalendarConfigForIdentity(KalendarConfig config,
                                          Kalendar kalendar,
                                          UserRequest ureq)
Description copied from interface: CalendarManager
Save the calendar configuration for a specific calendar for a specific identity.

Specified by:
saveKalendarConfigForIdentity in interface CalendarManager
See Also:
org.olat.calendar.CalendarManager#saveKalendarConfigForIdentity(org.olat.calendar.model.KalendarConfig, org.olat.calendar.model.Kalendar, org.olat.core.gui.UserRequest)

getRecurringInPeriod

public KalendarEvent getRecurringInPeriod(java.util.Date periodStart,
                                          java.util.Date periodEnd,
                                          KalendarEvent kEvent)
Get the recurring event

Specified by:
getRecurringInPeriod in interface CalendarManager
Returns:
affected KalendarEvent or null if not recurring in period

isRecurringInPeriod

public boolean isRecurringInPeriod(java.util.Date periodStart,
                                   java.util.Date periodEnd,
                                   KalendarEvent kEvent)
Check if the event recurs within the given period

Specified by:
isRecurringInPeriod in interface CalendarManager
Returns:
true if event recurs in the given period, otherwise false

getRecurringDatesInPeriod

public java.util.List<KalendarRecurEvent> getRecurringDatesInPeriod(java.util.Date periodStart,
                                                                    java.util.Date periodEnd,
                                                                    KalendarEvent kEvent)
Description copied from interface: CalendarManager
Get all recurrings of an event within the given period

Specified by:
getRecurringDatesInPeriod in interface CalendarManager
Returns:
list with KalendarRecurEvent
See Also:
CalendarManager.getRecurringDatesInPeriod(java.util.Date, java.util.Date, org.olat.commons.calendar.model.KalendarEvent)

getCalendarFile

public java.io.File getCalendarFile(java.lang.String type,
                                    java.lang.String calendarID)
Description copied from interface: CalendarManager
get the calendar file name from type and id

Specified by:
getCalendarFile in interface CalendarManager
Returns:

getPersonalCalendar

public KalendarRenderWrapper getPersonalCalendar(Identity identity)
Description copied from interface: CalendarManager
Get an identity's personal calendar. If the calendar does not exist yet, a new calendar will be created. The calendar will be configured with defaults for calendar config.

Specified by:
getPersonalCalendar in interface CalendarManager
Returns:

getImportedCalendar

public KalendarRenderWrapper getImportedCalendar(Identity identity,
                                                 java.lang.String calendarName)
Description copied from interface: CalendarManager
Get an identity's personal calendar. If the calendar does not exist yet, a new calendar will be created. The calendar will be configured with defaults for calendar config.

Specified by:
getImportedCalendar in interface CalendarManager
Returns:

getGroupCalendar

public KalendarRenderWrapper getGroupCalendar(BusinessGroup businessGroup)
Description copied from interface: CalendarManager
Get a group's calendar. If the calendar does not yet exist, a new calendar will be created. The calendar will be configured with defaults for calendar config.

Specified by:
getGroupCalendar in interface CalendarManager
Returns:

getCourseCalendar

public KalendarRenderWrapper getCourseCalendar(ICourse course)
Description copied from interface: CalendarManager
Get calendar for course. If the calendar does not yet exist, a new calendar will be created. The calendar will be configured with defaults for calendar config.

Specified by:
getCourseCalendar in interface CalendarManager
Returns:

deletePersonalCalendar

public void deletePersonalCalendar(Identity identity)
Description copied from interface: CalendarManager
Delete the personal calendar of an identity.

Specified by:
deletePersonalCalendar in interface CalendarManager

deleteGroupCalendar

public void deleteGroupCalendar(BusinessGroup businessGroup)
Description copied from interface: CalendarManager
Delete the calendar of the given business group.

Specified by:
deleteGroupCalendar in interface CalendarManager

deleteCourseCalendar

public void deleteCourseCalendar(ICourse course)
Description copied from interface: CalendarManager
Delete the calendar of the given course.

Specified by:
deleteCourseCalendar in interface CalendarManager

deleteUserData

public void deleteUserData(Identity identity,
                           java.lang.String newDeletedUserName)
Description copied from interface: UserDataDeletable
Delete user data for certain user

Specified by:
deleteUserData in interface UserDataDeletable
Parameters:
identity - Data for this identity will be deleted

addEventTo

public boolean addEventTo(Kalendar cal,
                          KalendarEvent kalendarEvent)
Description copied from interface: CalendarManager
Add an event to given calendar and save calendar.

Specified by:
addEventTo in interface CalendarManager
Returns:
true if success
See Also:
CalendarManager.addEventTo(org.olat.commons.calendar.model.Kalendar, org.olat.commons.calendar.model.KalendarEvent)

removeEventFrom

public boolean removeEventFrom(Kalendar cal,
                               KalendarEvent kalendarEvent)
Description copied from interface: CalendarManager
Remove an event from given calendar and save calendar.

Specified by:
removeEventFrom in interface CalendarManager
Returns:
true if success
See Also:
CalendarManager.removeEventFrom(org.olat.commons.calendar.model.Kalendar, org.olat.commons.calendar.model.KalendarEvent)

updateEventFrom

public boolean updateEventFrom(Kalendar cal,
                               KalendarEvent kalendarEvent)
Description copied from interface: CalendarManager
Update an event of given calendar and save calendar.

Specified by:
updateEventFrom in interface CalendarManager
Returns:
true if success
See Also:
CalendarManager.updateEventFrom(org.olat.commons.calendar.model.Kalendar, org.olat.commons.calendar.model.KalendarEvent)

updateEventAlreadyInSync

public boolean updateEventAlreadyInSync(Kalendar cal,
                                        KalendarEvent kalendarEvent)
Description copied from interface: CalendarManager
Update an event of given calendar and save calendar. Use this method if the Kalendar is already in a doInSync.

Specified by:
updateEventAlreadyInSync in interface CalendarManager
Returns:
true if success
See Also:
CalendarManager.updateEventFrom(org.olat.commons.calendar.model.Kalendar, org.olat.commons.calendar.model.KalendarEvent)