Package org.olat.commons.calendar.model

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


    if(recurDates == null) return lstDates;
   
    for( Object obj : recurDates ) {
      net.fortuna.ical4j.model.Date date = (net.fortuna.ical4j.model.Date)obj;
     
      KalendarRecurEvent recurEvent;
     
      java.util.Calendar eventStartCal = java.util.Calendar.getInstance();
      eventStartCal.clear();
      eventStartCal.setTime(kEvent.getBegin());
     
      java.util.Calendar eventEndCal = java.util.Calendar.getInstance();
      eventEndCal.clear();
      eventEndCal.setTime(kEvent.getEnd());
     
      java.util.Calendar recurStartCal = java.util.Calendar.getInstance();
      recurStartCal.clear();
      recurStartCal.setTimeInMillis(date.getTime());

      long duration = kEvent.getEnd().getTime() - kEvent.getBegin().getTime();

      java.util.Calendar beginCal = java.util.Calendar.getInstance();
      beginCal.clear();
      beginCal.set(
          recurStartCal.get(java.util.Calendar.YEAR),
          recurStartCal.get(java.util.Calendar.MONTH),
          recurStartCal.get(java.util.Calendar.DATE),
          eventStartCal.get(java.util.Calendar.HOUR_OF_DAY),
          eventStartCal.get(java.util.Calendar.MINUTE),
          eventStartCal.get(java.util.Calendar.SECOND)
          );
     
      java.util.Calendar endCal = java.util.Calendar.getInstance();
      endCal.clear();
      endCal.setTimeInMillis(beginCal.getTimeInMillis() + duration);
      if(kEvent.getBegin().compareTo(beginCal.getTime()) == 0) continue; //prevent doubled events
      Date recurrenceEnd = CalendarUtils.getRecurrenceEndDate(kEvent.getRecurrenceRule());
      if(kEvent.isAllDayEvent() && recurrenceEnd != null && recurStartCal.getTime().after(recurrenceEnd)) continue; //workaround for ical4j-bug in all day events
      recurEvent = new KalendarRecurEvent(kEvent.getID(), kEvent.getSubject(), new Date(beginCal.getTimeInMillis()), new Date(endCal.getTimeInMillis()));
      recurEvent.setSourceEvent(kEvent);
      lstDates.add(recurEvent);
    }
    return lstDates;
  }
View Full Code Here

TOP

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

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.