use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.
the class AbstractBusinessGroupListController method doSearch.
protected void doSearch(FlexiTableSearchEvent event) {
BusinessGroupQueryParams params = getDefaultSearchParams();
params.setNameOrDesc(event.getSearch());
loadModel(params);
}
use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.
the class EditMembershipController method loadModel.
private void loadModel(Identity memberToLoad) {
BusinessGroupQueryParams params = new BusinessGroupQueryParams();
if (repoEntry == null) {
params.setBusinessGroupKey(businessGroup.getKey());
} else {
params.setRepositoryEntry(repoEntry);
}
List<StatisticsBusinessGroupRow> groups = businessGroupService.findBusinessGroupsStatistics(params);
if (groups.size() > 1) {
Collections.sort(groups, new BusinessGroupRowComparator(getLocale()));
}
boolean defaultMembership = false;
if (memberToLoad == null) {
if (repoEntry != null && groups.isEmpty()) {
boolean managed = RepositoryEntryManagedFlag.isManaged(repoEntry, RepositoryEntryManagedFlag.membersmanagement) && !overrideManaged;
if (!managed) {
repoRightsEl.select("participant", true);
}
} else if (repoEntry == null && groups.size() == 1) {
boolean managed = BusinessGroupManagedFlag.isManaged(groups.get(0).getManagedFlags(), BusinessGroupManagedFlag.membersmanagement) && !overrideManaged;
if (!managed) {
defaultMembership = true;
}
}
}
List<Long> businessGroupKeys = new ArrayList<>(groups.size());
groups.forEach(group -> businessGroupKeys.add(group.getKey()));
groupMemberships = memberToLoad == null ? Collections.<BusinessGroupMembership>emptyList() : businessGroupService.getBusinessGroupMembership(businessGroupKeys, memberToLoad);
List<MemberOption> options = new ArrayList<MemberOption>();
for (StatisticsBusinessGroupRow group : groups) {
boolean managed = BusinessGroupManagedFlag.isManaged(group.getManagedFlags(), BusinessGroupManagedFlag.membersmanagement) && !overrideManaged;
MemberOption option = new MemberOption(group);
BGPermission bgPermission = PermissionHelper.getPermission(group.getKey(), memberToLoad, groupMemberships);
option.setTutor(createSelection(bgPermission.isTutor(), !managed, GroupRoles.coach.name()));
option.setParticipant(createSelection(bgPermission.isParticipant() || defaultMembership, !managed, GroupRoles.participant.name()));
boolean waitingListEnable = !managed && group.isWaitingListEnabled();
option.setWaiting(createSelection(bgPermission.isWaitingList(), waitingListEnable, GroupRoles.waiting.name()));
options.add(option);
}
tableDataModel.setObjects(options);
}
use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.
the class OpenBusinessGroupListController method getDefaultSearchParams.
@Override
protected BusinessGroupQueryParams getDefaultSearchParams() {
BusinessGroupQueryParams params = new BusinessGroupQueryParams();
params.setPublicGroups(Boolean.TRUE);
return params;
}
use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.
the class SearchBusinessGroupListController method getDefaultSearchParams.
@Override
protected BusinessGroupQueryParams getDefaultSearchParams() {
BusinessGroupQueryParams params = new BusinessGroupQueryParams();
// security
if (!isAdmin()) {
params.setOwner(true);
params.setAttendee(true);
params.setWaiting(true);
}
return params;
}
use of org.olat.group.model.BusinessGroupQueryParams in project openolat by klemens.
the class SelectBusinessGroupCourseAuthorController method getDefaultSearchParams.
@Override
protected BusinessGroupQueryParams getDefaultSearchParams() {
BusinessGroupQueryParams params = new BusinessGroupQueryParams();
params.setAuthorConnection(true);
return params;
}
Aggregations