result.add(event);
}
}
}
// subscriptions
final TeamEventExternalSubscriptionCache aboCache = TeamEventExternalSubscriptionCache.instance();
final List<Integer> alreadyAdded = new ArrayList<Integer>();
// precondition for abos: existing teamcals in filter
if (teamEventFilter.getTeamCals() != null) {
for (final Integer calendarId : teamEventFilter.getTeamCals()) {
if (aboCache.isExternalSubscribedCalendar(calendarId) == true) {
addEventsToList(teamEventFilter, result, aboCache, calendarId);
alreadyAdded.add(calendarId);
}
}
}
// if the getTeamCalId is not null and we do not added this before, do it now
final Integer teamCalId = teamEventFilter.getTeamCalId();
if (teamCalId != null && alreadyAdded.contains(teamCalId) == false) {
if (aboCache.isExternalSubscribedCalendar(teamCalId) == true) {
addEventsToList(teamEventFilter, result, aboCache, teamCalId);
}
}
return result;
}