use of net.fortuna.ical4j.data.CalendarBuilder in project traccar by traccar.
the class Calendar method setData.
public void setData(byte[] data) throws IOException, ParserException {
CalendarBuilder builder = new CalendarBuilder();
calendar = builder.build(new ByteArrayInputStream(data));
this.data = data.clone();
}
use of net.fortuna.ical4j.data.CalendarBuilder in project OpenOLAT by OpenOLAT.
the class CalendarImportTest method testImportMonthFromOutlook.
@Test
public void testImportMonthFromOutlook() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("BB_30.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
}
use of net.fortuna.ical4j.data.CalendarBuilder in project OpenOLAT by OpenOLAT.
the class CalendarImportTest method testImportRecurringCal.
@Test
public void testImportRecurringCal() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("RecurringEvent.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
VEvent rootEvent = null;
VEvent exceptionEvent = null;
for (Iterator<?> iter = calendar.getComponents().iterator(); iter.hasNext(); ) {
Object comp = iter.next();
if (comp instanceof VEvent) {
VEvent vevent = (VEvent) comp;
if (vevent.getRecurrenceId() == null) {
rootEvent = vevent;
} else {
exceptionEvent = vevent;
}
}
}
assertNotNull(rootEvent);
assertNotNull(exceptionEvent);
java.util.Date startDate = CalendarUtils.getDate(2016, java.util.Calendar.OCTOBER, 10);
DateTime start = new DateTime(startDate);
java.util.Date endDate = CalendarUtils.getDate(2016, java.util.Calendar.NOVEMBER, 10);
DateTime end = new DateTime(endDate);
Period period = new Period(start, end);
PeriodList pList = rootEvent.calculateRecurrenceSet(period);
for (Object obj : pList) {
Period p = (Period) obj;
System.out.println("Period: " + p.getStart());
}
RecurrenceId recurrenceId = exceptionEvent.getRecurrenceId();
Date recurrenceDate = recurrenceId.getDate();
System.out.println("Recurrence: " + recurrenceDate);
exceptionEvent.getSequence();
}
use of net.fortuna.ical4j.data.CalendarBuilder in project OpenOLAT by OpenOLAT.
the class CalendarImportTest method testImportFromOutlook.
@Test
public void testImportFromOutlook() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("Hoffstedde.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
}
use of net.fortuna.ical4j.data.CalendarBuilder in project OpenOLAT by OpenOLAT.
the class CalendarImportTest method testImportWeekFromOutlook.
@Test
public void testImportWeekFromOutlook() throws IOException, ParserException {
InputStream in = CalendarImportTest.class.getResourceAsStream("BB_7.ics");
CalendarBuilder builder = new CalendarBuilder();
Calendar calendar = builder.build(in);
assertNotNull(calendar);
}
Aggregations