changeEmail.addEmailTo(cl);
StringBuilder result = new StringBuilder();
result.append(translate("qti.restricted.leading"));
for (Iterator iter = referencees.iterator(); iter.hasNext();) {
ReferenceImpl element = (ReferenceImpl) iter.next();
// FIXME:discuss:possible performance/cache problem
if ("CourseModule".equals(element.getSource().getResourceableTypeName())) {
ICourse course = CourseFactory.loadCourse(element.getSource().getResourceableId());
// the course owners
RepositoryEntry entry = rm.lookupRepositoryEntry(course, false);
String courseTitle = course.getCourseTitle();
SecurityGroup owners = entry.getOwnerGroup();
List stakeHoldersIds = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(owners);
// add stakeholders as group
cl = new ContactList(courseTitle);
cl.addAllIdentites(stakeHoldersIds);
changeEmail.addEmailTo(cl);
StringBuilder stakeHolders = new StringBuilder();
User user = ((Identity) stakeHoldersIds.get(0)).getUser();
Locale loc = ureq.getLocale();
stakeHolders.append(user.getProperty(UserConstants.FIRSTNAME, loc)).append(" ").append(user.getProperty(UserConstants.LASTNAME, loc));
for (int i = 1; i < stakeHoldersIds.size(); i++) {
user = ((Identity) stakeHoldersIds.get(i)).getUser();
stakeHolders.append(", ").append(user.getProperty(UserConstants.FIRSTNAME, loc)).append(" ").append(user.getProperty(UserConstants.LASTNAME, loc));
}
CourseNode cn = course.getEditorTreeModel().getCourseNode(element.getUserdata());
String courseNodeTitle = cn.getShortTitle();
result.append(translate("qti.restricted.course", courseTitle));
result.append(translate("qti.restricted.node", courseNodeTitle));
result.append(translate("qti.restricted.owners", stakeHolders.toString()));
}