use of org.olat.course.nodes.gta.model.Membership 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.course.nodes.gta.model.Membership in project openolat by klemens.
the class GTANotifications method createBusinessGroupsSubscriptionInfo.
private void createBusinessGroupsSubscriptionInfo(Identity subscriberIdentity) {
RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
Membership membership = gtaManager.getMembership(subscriberIdentity, entry, gtaNode);
boolean owner = repositoryService.hasRole(subscriberIdentity, entry, GroupRoles.owner.name());
if (owner) {
List<BusinessGroup> groups = gtaManager.getBusinessGroups(gtaNode);
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, true);
}
createCoachSolutionItems();
} else if (membership.isCoach()) {
List<BusinessGroup> groups = gtaManager.getCoachedBusinessGroups(subscriberIdentity, gtaNode);
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, true);
}
createCoachSolutionItems();
}
if (membership.isParticipant()) {
List<BusinessGroup> groups = gtaManager.getParticipatingBusinessGroups(subscriberIdentity, gtaNode);
if (groups.size() == 1 && !owner && !membership.isCoach()) {
Task task = gtaManager.getTask(groups.get(0), taskList);
if (task != null) {
header = translator.translate("notifications.group.header.task", new String[] { getTaskName(task), displayName });
}
}
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, false);
Task task = gtaManager.getTask(group, taskList);
if (createParticipantSolutionItems(task, null, group)) {
break;
}
}
}
}
use of org.olat.course.nodes.gta.model.Membership in project OpenOLAT by OpenOLAT.
the class GTANotifications method createBusinessGroupsSubscriptionInfo.
private void createBusinessGroupsSubscriptionInfo(Identity subscriberIdentity) {
RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
Membership membership = gtaManager.getMembership(subscriberIdentity, entry, gtaNode);
boolean owner = repositoryService.hasRole(subscriberIdentity, entry, GroupRoles.owner.name());
if (owner) {
List<BusinessGroup> groups = gtaManager.getBusinessGroups(gtaNode);
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, true);
}
createCoachSolutionItems();
} else if (membership.isCoach()) {
List<BusinessGroup> groups = gtaManager.getCoachedBusinessGroups(subscriberIdentity, gtaNode);
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, true);
}
createCoachSolutionItems();
}
if (membership.isParticipant()) {
List<BusinessGroup> groups = gtaManager.getParticipatingBusinessGroups(subscriberIdentity, gtaNode);
if (groups.size() == 1 && !owner && !membership.isCoach()) {
Task task = gtaManager.getTask(groups.get(0), taskList);
if (task != null) {
header = translator.translate("notifications.group.header.task", new String[] { getTaskName(task), displayName });
}
}
for (BusinessGroup group : groups) {
createBusinessGroupsSubscriptionItems(group, false);
Task task = gtaManager.getTask(group, taskList);
if (createParticipantSolutionItems(task, null, group)) {
break;
}
}
}
}
use of org.olat.course.nodes.gta.model.Membership in project openolat by klemens.
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);
}
Aggregations