use of org.olat.commons.calendar.model.CalendarFileInfos in project openolat by klemens.
the class ICalServlet method generateAggregatedCalendar.
/**
* Collect all the calendars, update the URL properties and the UUID.
*
* @param identity
* @param request
* @param response
* @throws IOException
*/
private void generateAggregatedCalendar(Identity identity, HttpServletRequest request, HttpServletResponse response) throws IOException {
PersonalCalendarManager homeCalendarManager = CoreSpringFactory.getImpl(PersonalCalendarManager.class);
if (identity == null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
} else {
List<CalendarFileInfos> iCalFiles = homeCalendarManager.getListOfCalendarsFiles(identity);
DBFactory.getInstance().commitAndCloseSession();
Agent agent = getAgent(request);
Writer out = response.getWriter();
out.write(Calendar.BEGIN);
out.write(':');
out.write(Calendar.VCALENDAR);
out.write(Strings.LINE_SEPARATOR);
out.write(Version.VERSION_2_0.toString());
out.write(CalScale.GREGORIAN.toString());
outputTTL(agent, out);
Set<String> timezoneIds = new HashSet<>();
int numOfFiles = iCalFiles.size();
for (int i = 0; i < numOfFiles; i++) {
outputCalendar(iCalFiles.get(i), out, agent, timezoneIds);
}
if (agent == Agent.outlook) {
outputTimeZoneForOutlook(timezoneIds, out);
}
out.write(Calendar.END);
out.write(':');
out.write(Calendar.VCALENDAR);
}
}
Aggregations