use of org.olat.group.BusinessGroupRef in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method getDuplicatedMemberships.
@Override
public List<IdentityRef> getDuplicatedMemberships(GTACourseNode cNode) {
List<IdentityRef> duplicates;
ModuleConfiguration config = cNode.getModuleConfiguration();
if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
List<Long> consolidatedGroupKeys = new ArrayList<>();
if (groupKeys != null && groupKeys.size() > 0) {
consolidatedGroupKeys.addAll(groupKeys);
}
consolidatedGroupKeys.addAll(areaManager.findBusinessGroupKeysOfAreaKeys(areaKeys));
List<BusinessGroupRef> businessGroups = BusinessGroupRefImpl.toRefs(consolidatedGroupKeys);
duplicates = businessGroupRelationDao.getDuplicateMemberships(businessGroups);
} else {
duplicates = Collections.emptyList();
}
return duplicates;
}
use of org.olat.group.BusinessGroupRef in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method getMembership.
@Override
public Membership getMembership(IdentityRef identity, RepositoryEntryRef entry, GTACourseNode cNode) {
List<String> roles;
ModuleConfiguration config = cNode.getModuleConfiguration();
if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
List<Long> consolidatedGroupKeys = new ArrayList<>();
if (groupKeys != null && groupKeys.size() > 0) {
consolidatedGroupKeys.addAll(groupKeys);
}
consolidatedGroupKeys.addAll(areaManager.findBusinessGroupKeysOfAreaKeys(areaKeys));
List<BusinessGroupRef> businessGroups = BusinessGroupRefImpl.toRefs(consolidatedGroupKeys);
roles = businessGroupRelationDao.getRoles(identity, businessGroups);
} else {
roles = repositoryEntryRelationDao.getRoles(identity, entry);
}
boolean coach = roles.contains(GroupRoles.coach.name()) || roles.contains(GroupRoles.owner.name());
boolean participant = roles.contains(GroupRoles.participant.name());
return new Membership(coach, participant);
}
use of org.olat.group.BusinessGroupRef in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (layoutLink == source) {
doLayout(ureq);
} else if (optionsLink == source) {
doOptions(ureq);
} else if (assessmentModeLink == source) {
doAssessmentMode(ureq);
} else if (certificatesOptionsLink == source) {
doCertificatesOptions(ureq);
} else if (lifeCycleChangeLink == source) {
doLifeCycleChange(ureq);
} else if (reminderLink == source) {
doReminders(ureq);
} else if (lecturesAdminLink == source) {
doLecturesAdmin(ureq);
} else if (lecturesLink == source) {
doLectures(ureq);
} else if (archiverLink == source) {
doArchive(ureq);
} else if (folderLink == source) {
doCourseFolder(ureq);
} else if (areaLink == source) {
doCourseAreas(ureq);
} else if (dbLink == source) {
doDatabases(ureq);
} else if (courseStatisticLink == source) {
doCourseStatistics(ureq);
} else if (testStatisticLink == source) {
doAssessmentTestStatistics(ureq);
} else if (surveyStatisticLink == source) {
doAssessmentSurveyStatistics(ureq);
} else if (assessmentLink == source) {
doAssessmentTool(ureq);
} else if (calendarLink == source) {
launchCalendar(ureq);
} else if (chatLink == source) {
launchChat(ureq);
} else if (searchLink == source) {
launchCourseSearch(ureq);
} else if (efficiencyStatementsLink == source) {
doEfficiencyStatements(ureq);
} else if (noteLink == source) {
launchPersonalNotes(ureq);
} else if (openGlossaryLink == source) {
launchGlossary(ureq);
} else if (leaveLink == source) {
doConfirmLeave(ureq);
} else if (source instanceof Link && "group".equals(((Link) source).getCommand())) {
BusinessGroupRef ref = (BusinessGroupRef) ((Link) source).getUserObject();
launchGroup(ureq, ref.getKey());
} else if (source == toolbarPanel) {
if (event instanceof VetoPopEvent) {
delayedClose = Delayed.pop;
} else if (event instanceof PopEvent) {
processPopEvent(ureq, (PopEvent) event);
}
} else if (enableGlossaryLink == source) {
toggleGlossary(ureq);
}
// Update window title
if (source instanceof Link) {
Link link = (Link) source;
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
String newTitle = course.getCourseTitle() + " - " + link.getI18n();
getWindowControl().getWindowBackOffice().getWindow().setTitle(getTranslator(), newTitle);
}
super.event(ureq, source, event);
}
use of org.olat.group.BusinessGroupRef in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method toBusinessGroups.
protected final List<BusinessGroup> toBusinessGroups(UserRequest ureq, List<? extends BusinessGroupRef> items, boolean editableOnly) {
List<Long> groupKeys = new ArrayList<Long>();
for (BusinessGroupRef item : items) {
groupKeys.add(item.getKey());
}
if (editableOnly) {
filterEditableGroupKeys(ureq, groupKeys);
}
List<BusinessGroup> groups = businessGroupService.loadBusinessGroups(groupKeys);
return groups;
}
use of org.olat.group.BusinessGroupRef in project OpenOLAT by OpenOLAT.
the class BusinessGroupMembershipProcessor method processResourceRemoved.
private void processResourceRemoved(Long groupKey, Long repoKey) {
BusinessGroupRef groupRef = new BusinessGroupRefImpl(groupKey);
RepositoryEntryRef entryRef = new RepositoryEntryRefImpl(repoKey);
OLATResource resource = repositoryManager.lookupRepositoryEntryResource(entryRef.getKey());
List<Long> memberKeys = businessGroupRelationDao.getMemberKeys(Collections.singletonList(groupRef), GroupRoles.coach.name(), GroupRoles.participant.name());
for (Long memberKey : memberKeys) {
IdentityRef member = new IdentityRefImpl(memberKey);
List<String> remaingRoles = repositoryEntryRelationDao.getRoles(member, entryRef);
if (remaingRoles.isEmpty()) {
notificationsManager.unsubscribeAllForIdentityAndResId(member, resource.getResourceableId());
}
}
}
Aggregations