if (event == Event.CANCELLED_EVENT || DialogBoxUIFactory.isOkEvent(event)) {
fireEvent(ureq, Event.CANCELLED_EVENT);
}
} else if(event instanceof IdentitiesAddEvent ) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
BusinessGroupAddResponse response = null;
addLoggingResourceable(LoggingResourceable.wrap(currBusinessGroup));
if (source == ownerGrpCntrllr) {
response = bgm.addOwnersAndFireEvent(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup, flags);
} else if (source == partipGrpCntrllr) {
response = bgm.addParticipantsAndFireEvent(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup, flags);
} else if (source == waitingGruppeController) {
response = bgm.addToWaitingListAndFireEvent(ureq.getIdentity(), identitiesAddedEvent.getAddIdentities(), currBusinessGroup, flags);
}
identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities());
identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission());
identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup());
fireEvent(ureq, Event.CHANGED_EVENT );
} else if (event instanceof IdentitiesRemoveEvent) {
List<Identity> identities = ((IdentitiesRemoveEvent) event).getRemovedIdentities();
if (source == ownerGrpCntrllr) {
bgm.removeOwnersAndFireEvent(ureq.getIdentity(), identities, currBusinessGroup, flags);
} else if (source == partipGrpCntrllr) {
bgm.removeParticipantsAndFireEvent(ureq.getIdentity(), identities, currBusinessGroup, flags);
if (currBusinessGroup.getWaitingListEnabled().booleanValue()) {
// It is possible that a user is transfered from waiting-list to participants => reload data to see transfered user in right group.
partipGrpCntrllr.reloadData();
waitingGruppeController.reloadData();
}
} else if (source == waitingGruppeController) {
bgm.removeFromWaitingListAndFireEvent(ureq.getIdentity(), identities, currBusinessGroup, flags);
}
fireEvent(ureq, Event.CHANGED_EVENT );
} else if (source == waitingGruppeController) {
if (event instanceof IdentitiesMoveEvent) {
IdentitiesMoveEvent identitiesMoveEvent = (IdentitiesMoveEvent) event;
BusinessGroupAddResponse response = bgm.moveIdenityFromWaitingListToParticipant(identitiesMoveEvent.getChosenIdentities(), ureq.getIdentity(), currBusinessGroup, flags);
identitiesMoveEvent.setNotMovedIdentities(response.getIdentitiesAlreadyInGroup());
identitiesMoveEvent.setMovedIdentities(response.getAddedIdentities());
// Participant and waiting-list were changed => reload both
partipGrpCntrllr.reloadData();
waitingGruppeController.reloadData();
// send mail for all of them
MailerWithTemplate mailer = MailerWithTemplate.getInstance();