for (final Integer calendarId : filter.getTeamCals()) {
final TeamEventSubscription eventSubscription = subscriptions.get(calendarId);
if (eventSubscription == null) {
continue;
}
final TeamCalDO calendar = TeamCalCache.getInstance().getCalendar(calendarId);
if (getTeamCalRight().getAccessType(calendar, userId).isIn(TeamCalAccessType.FULL, TeamCalAccessType.READONLY,
TeamCalAccessType.MINIMAL) == false) {
continue;
}
teamCals.add(calendarId);
}
}
if (filter.getTeamCalId() != null) {
final TeamEventSubscription eventSubscription = subscriptions.get(filter.getTeamCalId());
if (eventSubscription != null) {
final TeamCalDO cal = TeamCalCache.getInstance().getCalendar(filter.getTeamCalId());
if (getTeamCalRight().getAccessType(cal, userId)
.isIn(TeamCalAccessType.FULL, TeamCalAccessType.READONLY, TeamCalAccessType.MINIMAL) == true) {
teamCals.add(filter.getTeamCalId());
}
}
}
if (teamCals != null) {
for (final Integer calendarId : teamCals) {
final TeamEventSubscription eventSubscription = subscriptions.get(calendarId);
if (eventSubscription != null) {
final List<TeamEventDO> recurrenceEvents = eventSubscription.getRecurrenceEvents();
if (recurrenceEvents != null && recurrenceEvents.size() > 0) {
for (final TeamEventDO event : recurrenceEvents) {
final TeamCalDO calendar = TeamCalCache.getInstance().getCalendar(calendarId);
if (getTeamCalRight().getAccessType(calendar, userId) == TeamCalAccessType.MINIMAL) {
result.add(event.createMinimalCopy());
} else {
result.add(event);
}