use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method filterBusinessGroups.
@Override
public List<BusinessGroup> filterBusinessGroups(List<BusinessGroup> groups, GTACourseNode cNode) {
if (groups == null || groups.isEmpty())
return new ArrayList<>(1);
List<BusinessGroup> filteredGroups = new ArrayList<>();
ModuleConfiguration config = cNode.getModuleConfiguration();
List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
for (BusinessGroup group : groups) {
if (groupKeys.contains(group.getKey())) {
filteredGroups.add(group);
}
}
if (filteredGroups.size() < groups.size()) {
List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
List<Long> groupKeysOfAreas = areaManager.findBusinessGroupKeysOfAreaKeys(areaKeys);
for (BusinessGroup group : groups) {
// don't add 2x
if (!groupKeys.contains(group.getKey()) && groupKeysOfAreas.contains(group.getKey())) {
filteredGroups.add(group);
}
}
}
return filteredGroups;
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class GTAManagerImpl method getCoachedBusinessGroups.
@Override
public List<BusinessGroup> getCoachedBusinessGroups(IdentityRef identity, GTACourseNode cNode) {
ModuleConfiguration config = cNode.getModuleConfiguration();
List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
return getBusinessGroups(identity, groupKeys, areaKeys, GroupRoles.coach);
}
use of org.olat.modules.ModuleConfiguration 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.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class OpenMeetingsEditController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == accessibilityCondContr) {
if (event == Event.CHANGED_EVENT) {
Condition cond = accessibilityCondContr.getCondition();
courseNode.setPreConditionAccess(cond);
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == editForm) {
// config form action
if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
OpenMeetingsRoom room = editForm.getRoom();
if (room != null) {
ModuleConfiguration moduleConfiguration = courseNode.getModuleConfiguration();
moduleConfiguration.set(CONFIG_ROOM_NAME, room.getName());
moduleConfiguration.set(CONFIG_ROOM_SIZE, new Long(room.getSize()));
moduleConfiguration.set(CONFIG_ROOM_MODERATION, new Boolean(room.isModerated()));
moduleConfiguration.set(CONFIG_ROOM_AUDIO_ONLY, new Boolean(room.isAudioOnly()));
moduleConfiguration.set(CONFIG_ROOM_COMMENT, room.getComment());
moduleConfiguration.set(CONFIG_ROOM_TYPE, new Long(room.getType()));
}
}
if (event == Event.DONE_EVENT) {
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
}
use of org.olat.modules.ModuleConfiguration in project OpenOLAT by OpenOLAT.
the class OpenMeetingsEditController method getDefaultValues.
private OpenMeetingsRoom getDefaultValues() {
OpenMeetingsRoom room = new OpenMeetingsRoom();
ModuleConfiguration moduleConfiguration = courseNode.getModuleConfiguration();
Object name = moduleConfiguration.get(CONFIG_ROOM_NAME);
if (name instanceof String) {
room.setName((String) name);
}
Object size = moduleConfiguration.get(CONFIG_ROOM_SIZE);
if (size instanceof Long) {
room.setSize(((Long) size).longValue());
}
Object moderated = moduleConfiguration.get(CONFIG_ROOM_MODERATION);
if (moderated instanceof Boolean) {
room.setModerated(((Boolean) moderated).booleanValue());
} else if (moderated == null) {
room.setModerated(true);
}
Object comment = moduleConfiguration.get(CONFIG_ROOM_COMMENT);
if (comment instanceof String) {
room.setComment((String) comment);
}
Object type = moduleConfiguration.get(CONFIG_ROOM_TYPE);
if (type instanceof Long) {
room.setType(((Long) type).longValue());
} else if (type == null) {
room.setType(3);
}
Object isAudioOnly = moduleConfiguration.get(CONFIG_ROOM_AUDIO_ONLY);
if (isAudioOnly instanceof Boolean) {
room.setAudioOnly(((Boolean) isAudioOnly).booleanValue());
} else if (isAudioOnly == null) {
room.setAudioOnly(true);
}
return room;
}
Aggregations