use of org.olat.core.util.mail.ui.EMailIdentity in project OpenOLAT by OpenOLAT.
the class MembersMailController method doSend.
private void doSend(UserRequest ureq) {
ContactList contactList = new ContactList("");
if (courseEnv == null) {
if (coachEl != null && coachEl.isAtLeastSelected(1)) {
List<Long> identityKeys = new ArrayList<>(coachList.size());
for (Member coach : coachList) {
identityKeys.add(coach.getKey());
}
List<Identity> coaches = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(coaches);
}
if (participantEl != null && participantEl.isAtLeastSelected(1)) {
List<Long> identityKeys = new ArrayList<>(participantList.size());
for (Member participant : participantList) {
identityKeys.add(participant.getKey());
}
List<Identity> participants = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(participants);
}
if (waitingEl != null && waitingEl.isAtLeastSelected(1)) {
List<Long> identityKeys = new ArrayList<>(waitingList.size());
for (Member waiter : waitingList) {
identityKeys.add(waiter.getKey());
}
List<Identity> waiters = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(waiters);
}
} else {
if (ownerEl != null && ownerEl.isAtLeastSelected(1)) {
RepositoryEntry courseRepositoryEntry = courseEnv.getCourseGroupManager().getCourseEntry();
List<Identity> owners = repositoryService.getMembers(courseRepositoryEntry, GroupRoles.owner.name());
contactList.addAllIdentites(owners);
}
if (coachEl != null && coachEl.isAtLeastSelected(1)) {
Set<Long> sendToWhatYouSee = new HashSet<>();
for (Member coach : coachList) {
sendToWhatYouSee.add(coach.getKey());
}
CourseGroupManager cgm = courseEnv.getCourseGroupManager();
avoidInvisibleMember(cgm.getCoachesFromBusinessGroups(), contactList, sendToWhatYouSee);
avoidInvisibleMember(cgm.getCoaches(), contactList, sendToWhatYouSee);
}
if (participantEl != null && participantEl.isAtLeastSelected(1)) {
Set<Long> sendToWhatYouSee = new HashSet<>();
for (Member participant : participantList) {
sendToWhatYouSee.add(participant.getKey());
}
CourseGroupManager cgm = courseEnv.getCourseGroupManager();
avoidInvisibleMember(cgm.getParticipantsFromBusinessGroups(), contactList, sendToWhatYouSee);
avoidInvisibleMember(cgm.getParticipants(), contactList, sendToWhatYouSee);
}
}
if (individualEl != null && individualEl.isAtLeastSelected(1) && selectedMembers != null && selectedMembers.size() > 0) {
List<Long> identityKeys = new ArrayList<>(selectedMembers.size());
for (Member member : selectedMembers) {
identityKeys.add(member.getKey());
}
List<Identity> selectedIdentities = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(selectedIdentities);
}
if (externalEl != null && externalEl.isAtLeastSelected(1)) {
String value = externalAddressesEl.getValue();
if (StringHelper.containsNonWhitespace(value)) {
for (StringTokenizer tokenizer = new StringTokenizer(value, ",\r\n", false); tokenizer.hasMoreTokens(); ) {
String email = tokenizer.nextToken().trim();
contactList.add(new EMailIdentity(email, getLocale()));
}
}
}
doSendEmailToMember(ureq, contactList);
}
use of org.olat.core.util.mail.ui.EMailIdentity in project openolat by klemens.
the class MembersMailController method doSend.
private void doSend(UserRequest ureq) {
ContactList contactList = new ContactList("");
if (courseEnv == null) {
if (coachEl != null && coachEl.isAtLeastSelected(1)) {
List<Long> identityKeys = new ArrayList<>(coachList.size());
for (Member coach : coachList) {
identityKeys.add(coach.getKey());
}
List<Identity> coaches = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(coaches);
}
if (participantEl != null && participantEl.isAtLeastSelected(1)) {
List<Long> identityKeys = new ArrayList<>(participantList.size());
for (Member participant : participantList) {
identityKeys.add(participant.getKey());
}
List<Identity> participants = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(participants);
}
if (waitingEl != null && waitingEl.isAtLeastSelected(1)) {
List<Long> identityKeys = new ArrayList<>(waitingList.size());
for (Member waiter : waitingList) {
identityKeys.add(waiter.getKey());
}
List<Identity> waiters = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(waiters);
}
} else {
if (ownerEl != null && ownerEl.isAtLeastSelected(1)) {
RepositoryEntry courseRepositoryEntry = courseEnv.getCourseGroupManager().getCourseEntry();
List<Identity> owners = repositoryService.getMembers(courseRepositoryEntry, GroupRoles.owner.name());
contactList.addAllIdentites(owners);
}
if (coachEl != null && coachEl.isAtLeastSelected(1)) {
Set<Long> sendToWhatYouSee = new HashSet<>();
for (Member coach : coachList) {
sendToWhatYouSee.add(coach.getKey());
}
CourseGroupManager cgm = courseEnv.getCourseGroupManager();
avoidInvisibleMember(cgm.getCoachesFromBusinessGroups(), contactList, sendToWhatYouSee);
avoidInvisibleMember(cgm.getCoaches(), contactList, sendToWhatYouSee);
}
if (participantEl != null && participantEl.isAtLeastSelected(1)) {
Set<Long> sendToWhatYouSee = new HashSet<>();
for (Member participant : participantList) {
sendToWhatYouSee.add(participant.getKey());
}
CourseGroupManager cgm = courseEnv.getCourseGroupManager();
avoidInvisibleMember(cgm.getParticipantsFromBusinessGroups(), contactList, sendToWhatYouSee);
avoidInvisibleMember(cgm.getParticipants(), contactList, sendToWhatYouSee);
}
}
if (individualEl != null && individualEl.isAtLeastSelected(1) && selectedMembers != null && selectedMembers.size() > 0) {
List<Long> identityKeys = new ArrayList<>(selectedMembers.size());
for (Member member : selectedMembers) {
identityKeys.add(member.getKey());
}
List<Identity> selectedIdentities = securityManager.loadIdentityByKeys(identityKeys);
contactList.addAllIdentites(selectedIdentities);
}
if (externalEl != null && externalEl.isAtLeastSelected(1)) {
String value = externalAddressesEl.getValue();
if (StringHelper.containsNonWhitespace(value)) {
for (StringTokenizer tokenizer = new StringTokenizer(value, ",\r\n", false); tokenizer.hasMoreTokens(); ) {
String email = tokenizer.nextToken().trim();
contactList.add(new EMailIdentity(email, getLocale()));
}
}
}
doSendEmailToMember(ureq, contactList);
}
Aggregations