use of biweekly.io.TimezoneAssignment in project substitution-schedule-parser by vertretungsplanme.
the class BaseIcalParser method getTimeZoneStart.
private TimeZone getTimeZoneStart(ICalendar ical, VEvent event) {
if (event.getDateStart() == null) {
return null;
}
TimezoneInfo tzinfo = ical.getTimezoneInfo();
TimeZone timezone;
if (tzinfo.isFloating(event.getDateStart())) {
timezone = TimeZone.getDefault();
} else {
TimezoneAssignment dtstartTimezone = tzinfo.getTimezone(event.getDateStart());
timezone = (dtstartTimezone == null) ? TimeZone.getTimeZone("UTC") : dtstartTimezone.getTimeZone();
}
return timezone;
}
use of biweekly.io.TimezoneAssignment in project common by zenlunatics.
the class EventProvider method writeICS.
// --------------------------------------------------------------------------
@AdminTask
public synchronized void writeICS(Request request) throws IOException {
ICalendar ical = new ICalendar();
String string = request.site.getSettings().getString("time zone");
TimeZone time_zone = TimeZone.getTimeZone(string);
TimezoneAssignment tza = TimezoneAssignment.download(time_zone, false);
ical.getTimezoneInfo().setDefaultTimezone(tza);
ArrayList<Event> events = new ArrayList<Event>();
addAllEvents(events, request);
for (Event event : events) {
VEvent vevent = event.newVEvent(request);
if (vevent != null)
ical.addEvent(vevent);
}
FilePathStringBuilder fpsb = request.site.getBaseFilePath().append("calendars");
new File(fpsb.toString()).mkdirs();
String file_path = fpsb.append(m_name).toString();
Biweekly.write(ical).go(new File(file_path));
new File(file_path).renameTo(new File(file_path + ".ics"));
}
Aggregations