Package org.olat.commons.calendar.model

Examples of org.olat.commons.calendar.model.Kalendar


    Kalendar kalendar = createKalendar(type, calendarID, calendar);
    return kalendar;
  }

  private Kalendar createKalendar(String type, String calendarID, Calendar calendar) {
    Kalendar cal = new Kalendar(calendarID, type);
    for (Iterator iter = calendar.getComponents().iterator(); iter.hasNext();) {
      Component comp = (Component) iter.next();
      if (comp instanceof VEvent) {
        VEvent vevent = (VEvent)comp;
        KalendarEvent calEvent = getKalendarEvent(vevent);
        cal.addEvent(calEvent);
      } else if (comp instanceof VTimeZone) {
        log.info("createKalendar: VTimeZone Component is not supported and will not be added to calender");
        log.debug("createKalendar: VTimeZone=" + comp);
      } else {
        log.warn("createKalendar: unknown Component=" + comp);
View Full Code Here


    }
    return calendar;
  }
 
  public Kalendar buildKalendarFrom(String calendarContent, String calType, String calId) {
    Kalendar kalendar = null;
    BufferedReader reader = new BufferedReader(new StringReader(calendarContent));
    CalendarBuilder builder = new CalendarBuilder();
    try {
      Calendar calendar = builder.build(reader);
      kalendar = createKalendar(calType, calId, calendar);
View Full Code Here

    fDirectory = new File(fStorageBase, "/" + TYPE_COURSE);
    fDirectory.mkdirs();
  }

  public KalendarRenderWrapper getPersonalCalendar(Identity identity) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_USER, identity.getName());
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(identity.getName(), KalendarRenderWrapper.CALENDAR_COLOR_BLUE, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }

  public KalendarRenderWrapper getImportedCalendar(Identity identity, String calendarName) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_USER, ImportCalendarManager.getImportedCalendarID(identity, calendarName));
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(calendarName, KalendarRenderWrapper.CALENDAR_COLOR_BLUE, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
 
  public KalendarRenderWrapper getGroupCalendar(BusinessGroup businessGroup) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_GROUP, businessGroup.getResourceableId().toString());
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(businessGroup.getName(), KalendarRenderWrapper.CALENDAR_COLOR_ORANGE, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
 
  public KalendarRenderWrapper getCourseCalendar(ICourse course) {
    Kalendar cal = getCalendar(CalendarManager.TYPE_COURSE, course.getResourceableId().toString());
    KalendarRenderWrapper calendarWrapper = new KalendarRenderWrapper(cal);
    KalendarConfig config = new KalendarConfig(course.getCourseTitle(), KalendarRenderWrapper.CALENDAR_COLOR_GREEN, true);
    calendarWrapper.setKalendarConfig(config);
    return calendarWrapper;
  }
View Full Code Here

   */
  public boolean addEventTo(final Kalendar cal, final KalendarEvent kalendarEvent) {
    OLATResourceable calOres = getOresHelperFor(cal);
    Boolean persistSuccessful = CoordinatorManager.getCoordinator().getSyncer().doInSync( calOres, new SyncerCallback<Boolean>() {
      public Boolean execute() {
        Kalendar loadedCal = getCalendarFromCache(cal.getType(),cal.getCalendarID());
        loadedCal.addEvent(kalendarEvent);
        boolean successfullyPersist = persistCalendar(loadedCal);
        return new Boolean(successfullyPersist);
      }
    });
    // inform all controller about calendar change for reload
View Full Code Here

   */
  public boolean removeEventFrom(final Kalendar cal, final KalendarEvent kalendarEvent) {
    OLATResourceable calOres = getOresHelperFor(cal);
    Boolean removeSuccessful = CoordinatorManager.getCoordinator().getSyncer().doInSync( calOres, new SyncerCallback<Boolean>() {
      public Boolean execute() {
        Kalendar loadedCal = getCalendarFromCache(cal.getType(),cal.getCalendarID());
        loadedCal.removeEvent(kalendarEvent);
        boolean successfullyPersist = persistCalendar(loadedCal);
        return new Boolean(successfullyPersist);
      }
    });
    // inform all controller about calendar change for reload
View Full Code Here

   * @see org.olat.commons.calendar.CalendarManager#updateEventFrom(org.olat.commons.calendar.model.Kalendar, org.olat.commons.calendar.model.KalendarEvent)
   */
  public boolean updateEventAlreadyInSync(final Kalendar cal, final KalendarEvent kalendarEvent) {
    OLATResourceable calOres = getOresHelperFor(cal);
    CoordinatorManager.getCoordinator().getSyncer().assertAlreadyDoInSyncFor(calOres);
    Kalendar loadedCal = getCalendarFromCache(cal.getType(),cal.getCalendarID());
    loadedCal.removeEvent(kalendarEvent); // remove old event
    loadedCal.addEvent(kalendarEvent); // add changed event
    boolean successfullyPersist = persistCalendar(loadedCal);
    // inform all controller about calendar change for reload
    CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new KalendarModifiedEvent(cal), OresHelper.lookupType(CalendarManager.class));
    return successfullyPersist;
    }
View Full Code Here

   */
  private static void reloadCalendarFromUrl(String importUrl, String calType, String calId) {
      try {
          String calendarContent = getContentFromUrl(importUrl);
          CalendarManager calManager = CalendarManagerFactory.getInstance().getCalendarManager();
          Kalendar kalendar = calManager.buildKalendarFrom(calendarContent, calType, calId);
          calManager.persistCalendar(kalendar);
        } catch (IOException e) {
          log.error("Could not reload calendar from url=" + importUrl, e);
        }
     
View Full Code Here

TOP

Related Classes of org.olat.commons.calendar.model.Kalendar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.