use of com.axelor.apps.base.db.CalendarManagement in project axelor-open-suite by axelor.
the class CalendarService method showSharedCalendars.
public List<Long> showSharedCalendars(User user) {
Team team = user.getActiveTeam();
Set<User> followedUsers = user.getFollowersCalUserSet();
List<Long> calendarIdlist = new ArrayList<Long>();
for (User userIt : followedUsers) {
for (CalendarManagement calendarManagement : userIt.getCalendarManagementList()) {
if ((user.equals(calendarManagement.getUser())) || (team != null && team.equals(calendarManagement.getTeam()))) {
List<ICalendar> icalList = icalRepo.all().filter("self.user.id = ?1", userIt.getId()).fetch();
calendarIdlist.addAll(Lists.transform(icalList, it -> it.getId()));
}
}
}
List<ICalendar> icalList = icalRepo.all().filter("self.user.id = ?1", user.getId()).fetch();
calendarIdlist.addAll(Lists.transform(icalList, it -> it.getId()));
return calendarIdlist;
}
Aggregations