public void event(UserRequest urequest, Controller source, Event event) {
if (source == projectLeaderController) {
BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags();
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent)event;
BusinessGroupAddResponse response = BusinessGroupManagerImpl.getInstance().addOwnersAndFireEvent(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), project.getProjectGroup(), flags);
identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities());
identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission());
identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup());
getLogger().info("Add users as project-leader");
fireEvent(urequest, Event.CHANGED_EVENT );
} else if (event instanceof IdentitiesRemoveEvent) {
BusinessGroupManagerImpl.getInstance().removeOwnersAndFireEvent(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), project.getProjectGroup(), flags);
getLogger().info("Remove users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT );
}
} else if (source == projectMemberController) {
BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags();
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent)event;
BusinessGroupAddResponse response = BusinessGroupManagerImpl.getInstance().addParticipantsAndFireEvent(urequest.getIdentity(), identitiesAddedEvent.getAddIdentities(), project.getProjectGroup(), flags);
identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities());
identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission());
identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup());
getLogger().info("Add users as project-members");
fireEvent(urequest, Event.CHANGED_EVENT );
} else if (event instanceof IdentitiesRemoveEvent) {
BusinessGroupManagerImpl.getInstance().removeParticipantsAndFireEvent(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), project.getProjectGroup(), flags);
getLogger().info("Remove users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT );
}
} else if (source == projectCandidatesController) {
BGConfigFlags flags = BGConfigFlags.createRightGroupDefaultFlags();
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddEvent = (IdentitiesAddEvent)event;
List<Identity> addedIdentities = ProjectBrokerManagerFactory.getProjectGroupManager().addCandidates(identitiesAddEvent.getAddIdentities(), project);
identitiesAddEvent.setIdentitiesAddedEvent(addedIdentities);
fireEvent(urequest, Event.CHANGED_EVENT );
} else if (event instanceof IdentitiesRemoveEvent) {
ProjectBrokerManagerFactory.getProjectGroupManager().removeCandidates(((IdentitiesRemoveEvent)event).getRemovedIdentities(), project);
fireEvent(urequest, Event.CHANGED_EVENT );
} else if (event instanceof IdentitiesMoveEvent) {