// associations
Collection<ClientData> membersOfGroup = null;
Collection<GroupRoleData> groupRoles = null;
GroupRoleData selectedRole = null;
Collection<CalendarData> calendars = null;
CalendarData collectionMeetingCalendar = null;
if (!associationParameters.isEmpty()) {
if (associationParameters.contains("all")) {
associationParameters.addAll(Arrays.asList("clientMembers", "groupRoles", "calendars", "collectionMeetingCalendar"));
}
if (associationParameters.contains("clientMembers")) {
membersOfGroup = this.clientReadPlatformService.retrieveClientMembersOfGroup(groupId);
if (CollectionUtils.isEmpty(membersOfGroup)) {
membersOfGroup = null;
}
}
if (associationParameters.contains("groupRoles")) {
groupRoles = this.groupRolesReadPlatformService.retrieveGroupRoles(groupId);
if (CollectionUtils.isEmpty(groupRoles)) {
groupRoles = null;
}
}
if (associationParameters.contains("parentCalendars")) {
final List<Integer> calendarTypeOptions = CalendarUtils.createIntegerListFromQueryParameter("all");
calendars = this.calendarReadPlatformService.retrieveParentCalendarsByEntity(groupId, CalendarEntityType.GROUPS.getValue(),
calendarTypeOptions);
if (CollectionUtils.isEmpty(calendars)) {
calendars = null;
}
}
if (associationParameters.contains("collectionMeetingCalendar")) {
if (group.isChildGroup()) {
collectionMeetingCalendar = this.calendarReadPlatformService.retrieveCollctionCalendarByEntity(group.getParentId(),
CalendarEntityType.CENTERS.getValue());
} else {
collectionMeetingCalendar = this.calendarReadPlatformService.retrieveCollctionCalendarByEntity(groupId,
CalendarEntityType.GROUPS.getValue());
}
if (collectionMeetingCalendar != null) {
final boolean withHistory = true;
final LocalDate tillDate = null;
final Collection<LocalDate> recurringDates = this.calendarReadPlatformService.generateRecurringDates(
collectionMeetingCalendar, withHistory, tillDate);
final Collection<LocalDate> nextTenRecurringDates = this.calendarReadPlatformService
.generateNextTenRecurringDates(collectionMeetingCalendar);
final MeetingData lastMeeting = this.meetingReadPlatformService.retrieveLastMeeting(collectionMeetingCalendar
.getCalendarInstanceId());
final LocalDate recentEligibleMeetingDate = this.calendarReadPlatformService
.generateNextEligibleMeetingDateForCollection(collectionMeetingCalendar, lastMeeting);
collectionMeetingCalendar = CalendarData.withRecurringDates(collectionMeetingCalendar, recurringDates,
nextTenRecurringDates, recentEligibleMeetingDate);