// CalendarLinkage should have cache.
UserCalendarLink calendarLinkage = daos.getCalendarAccess().find(con, calendarId);
if (calendarLinkage == null)
throw new PartakeException(UserErrorCode.INVALID_NOTFOUND);
User user = daos.getUserAccess().find(con, calendarLinkage.getUserId());
if (user == null)
throw new PartakeException(UserErrorCode.INVALID_NOTFOUND);
Calendar calendar = CalendarUtil.createCalendarSkeleton();
// TODO: We only consider the first 1000 entries of enrollments due to memory limit.
List<UserTicket> enrollments =
daos.getEnrollmentAccess().findByUserId(con, user.getId(), 0, 1000);
for (UserTicket enrollment : enrollments) {
// TODO: Event should be search-able by ticket-id.
EventTicket ticket = daos.getEventTicketAccess().find(con, enrollment.getTicketId());
Event event = daos.getEventAccess().find(con, ticket.getEventId());
if (event == null)