Search in sources :

Example 91 with SearchBusinessGroupParams

use of org.olat.group.model.SearchBusinessGroupParams in project openolat by klemens.

the class GroupsPortletRunController method getPersistentManuallySortedItems.

/**
 * Retrieves the persistent manually sorted items for the current portlet.
 * @param ureq
 * @return
 */
private List<PortletEntry<BusinessGroupEntry>> getPersistentManuallySortedItems() {
    @SuppressWarnings("unchecked") Map<Long, Integer> storedPrefs = (Map<Long, Integer>) guiPreferences.get(Map.class, getPreferenceKey(SORTED_ITEMS_PREF));
    List<PortletEntry<BusinessGroupEntry>> portletEntryList;
    if (storedPrefs != null) {
        SearchBusinessGroupParams params = new SearchBusinessGroupParams(getIdentity(), true, true);
        params.setGroupKeys(storedPrefs.keySet());
        List<BusinessGroup> groups = businessGroupService.findBusinessGroups(params, null, 0, -1);
        portletEntryList = convertBusinessGroupToPortletEntryList(groups, false);
    } else {
        List<BusinessGroup> groups = new ArrayList<BusinessGroup>();
        portletEntryList = convertShortBusinessGroupToPortletEntryList(groups, false);
    }
    return getPersistentManuallySortedItems(portletEntryList);
}
Also used : PortletEntry(org.olat.core.gui.control.generic.portal.PortletEntry) BusinessGroup(org.olat.group.BusinessGroup) ArrayList(java.util.ArrayList) Map(java.util.Map) SearchBusinessGroupParams(org.olat.group.model.SearchBusinessGroupParams)

Example 92 with SearchBusinessGroupParams

use of org.olat.group.model.SearchBusinessGroupParams in project openolat by klemens.

the class HomeCalendarManager method appendGroupCalendars.

private void appendGroupCalendars(Identity identity, List<KalendarRenderWrapper> calendars, Map<CalendarKey, CalendarUserConfiguration> configMap) {
    // get group calendars
    if (calendarModule.isEnableGroupCalendar()) {
        SearchBusinessGroupParams groupParams = new SearchBusinessGroupParams(identity, true, false);
        groupParams.addTools(CollaborationTools.TOOL_CALENDAR);
        List<BusinessGroup> ownerGroups = businessGroupService.findBusinessGroups(groupParams, null, 0, -1);
        addCalendars(ownerGroups, true, false, calendars, configMap);
        SearchBusinessGroupParams groupParams2 = new SearchBusinessGroupParams(identity, false, true);
        groupParams2.addTools(CollaborationTools.TOOL_CALENDAR);
        List<BusinessGroup> attendedGroups = businessGroupService.findBusinessGroups(groupParams2, null, 0, -1);
        attendedGroups.removeAll(ownerGroups);
        addCalendars(attendedGroups, false, true, calendars, configMap);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) SearchBusinessGroupParams(org.olat.group.model.SearchBusinessGroupParams)

Aggregations

SearchBusinessGroupParams (org.olat.group.model.SearchBusinessGroupParams)92 BusinessGroup (org.olat.group.BusinessGroup)84 Identity (org.olat.core.id.Identity)36 Test (org.junit.Test)34 ArrayList (java.util.ArrayList)26 BusinessGroupService (org.olat.group.BusinessGroupService)18 BusinessGroupQueryParams (org.olat.group.model.BusinessGroupQueryParams)16 BusinessGroupRow (org.olat.group.model.BusinessGroupRow)16 OpenBusinessGroupRow (org.olat.group.model.OpenBusinessGroupRow)16 StatisticsBusinessGroupRow (org.olat.group.model.StatisticsBusinessGroupRow)16 RepositoryEntry (org.olat.repository.RepositoryEntry)16 HashSet (java.util.HashSet)12 GET (javax.ws.rs.GET)10 Produces (javax.ws.rs.Produces)10 Roles (org.olat.core.id.Roles)10 HashMap (java.util.HashMap)8 Map (java.util.Map)8 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)6 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)6 ICourse (org.olat.course.ICourse)6