use of org.olat.group.BusinessGroupAddResponse in project OpenOLAT by OpenOLAT.
the class ProjectGroupManagerImpl method acceptCandidates.
@Override
public BusinessGroupAddResponse acceptCandidates(final List<Identity> identities, final Project project, final Identity actionIdentity, final boolean autoSignOut, final boolean isAcceptSelectionManually) {
final Project reloadedProject = projectDao.loadProject(project.getKey());
final BusinessGroupAddResponse response = new BusinessGroupAddResponse();
BusinessGroupAddResponse state = businessGroupService.addParticipants(actionIdentity, null, identities, reloadedProject.getProjectGroup(), null);
response.getAddedIdentities().addAll(state.getAddedIdentities());
response.getIdentitiesAlreadyInGroup().addAll(state.getIdentitiesAlreadyInGroup());
Boolean result = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(project.getProjectGroup(), new SyncerCallback<Boolean>() {
@Override
public Boolean execute() {
for (final Identity identity : identities) {
if (businessGroupService.hasRoles(identity, reloadedProject.getProjectGroup(), GroupRoles.participant.name())) {
securityManager.removeIdentityFromSecurityGroup(identity, reloadedProject.getCandidateGroup());
log.audit("ProjectBroker: Accept candidate, identity=" + identity + " project=" + reloadedProject);
}
}
return Boolean.TRUE;
}
});
if (autoSignOut && result.booleanValue()) {
projectBrokerManager.signOutFormAllCandidateList(response.getAddedIdentities(), reloadedProject.getProjectBroker().getKey());
}
if (isAcceptSelectionManually && (reloadedProject.getMaxMembers() != Project.MAX_MEMBERS_UNLIMITED) && reloadedProject.getSelectedPlaces() >= reloadedProject.getMaxMembers()) {
projectBrokerManager.setProjectState(reloadedProject, Project.STATE_ASSIGNED);
log.info("ProjectBroker: Accept candidate, change project-state=" + Project.STATE_ASSIGNED);
}
return response;
}
use of org.olat.group.BusinessGroupAddResponse in project OpenOLAT by OpenOLAT.
the class BusinessGroupServiceImpl method addOwners.
@Override
public BusinessGroupAddResponse addOwners(Identity ureqIdentity, Roles ureqRoles, List<Identity> addIdentities, BusinessGroup group, MailPackage mailing) {
BusinessGroupAddResponse response = new BusinessGroupAddResponse();
List<BusinessGroupModifiedEvent.Deferred> events = new ArrayList<BusinessGroupModifiedEvent.Deferred>();
for (Identity identity : addIdentities) {
// reload business group
group = loadBusinessGroup(group);
if (securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_GUESTONLY)) {
response.getIdentitiesWithoutPermission().add(identity);
} else if (addOwner(ureqIdentity, ureqRoles, identity, group, mailing, events)) {
response.getAddedIdentities().add(identity);
} else {
response.getIdentitiesAlreadyInGroup().add(identity);
}
}
dbInstance.commit();
BusinessGroupModifiedEvent.fireDeferredEvents(events);
return response;
}
use of org.olat.group.BusinessGroupAddResponse in project OpenOLAT by OpenOLAT.
the class BusinessGroupServiceImpl method moveIdentityFromWaitingListToParticipant.
@Override
public BusinessGroupAddResponse moveIdentityFromWaitingListToParticipant(Identity ureqIdentity, List<Identity> identities, BusinessGroup currBusinessGroup, MailPackage mailing) {
Roles ureqRoles = securityManager.getRoles(ureqIdentity);
BusinessGroupAddResponse response = new BusinessGroupAddResponse();
List<BusinessGroupModifiedEvent.Deferred> events = new ArrayList<BusinessGroupModifiedEvent.Deferred>();
currBusinessGroup = businessGroupDAO.loadForUpdate(currBusinessGroup);
for (Identity identity : identities) {
// check if identity is already in participant
if (!businessGroupRelationDAO.hasRole(identity, currBusinessGroup, GroupRoles.participant.name())) {
// Identity is not in participant-list => move identity from waiting-list to participant-list
addParticipant(ureqIdentity, ureqRoles, identity, currBusinessGroup, mailing, events);
removeFromWaitingList(ureqIdentity, identity, currBusinessGroup, mailing, events);
response.getAddedIdentities().add(identity);
// notification mail is handled in controller
} else {
if (businessGroupRelationDAO.hasRole(identity, currBusinessGroup, GroupRoles.waiting.name())) {
removeFromWaitingList(ureqIdentity, identity, currBusinessGroup, mailing, events);
}
response.getIdentitiesAlreadyInGroup().add(identity);
}
}
dbInstance.commit();
BusinessGroupModifiedEvent.fireDeferredEvents(events);
return response;
}
use of org.olat.group.BusinessGroupAddResponse in project openolat by klemens.
the class ProjectGroupManagerImpl method acceptCandidates.
@Override
public BusinessGroupAddResponse acceptCandidates(final List<Identity> identities, final Project project, final Identity actionIdentity, final boolean autoSignOut, final boolean isAcceptSelectionManually) {
final Project reloadedProject = projectDao.loadProject(project.getKey());
final BusinessGroupAddResponse response = new BusinessGroupAddResponse();
BusinessGroupAddResponse state = businessGroupService.addParticipants(actionIdentity, null, identities, reloadedProject.getProjectGroup(), null);
response.getAddedIdentities().addAll(state.getAddedIdentities());
response.getIdentitiesAlreadyInGroup().addAll(state.getIdentitiesAlreadyInGroup());
Boolean result = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(project.getProjectGroup(), new SyncerCallback<Boolean>() {
@Override
public Boolean execute() {
for (final Identity identity : identities) {
if (businessGroupService.hasRoles(identity, reloadedProject.getProjectGroup(), GroupRoles.participant.name())) {
securityManager.removeIdentityFromSecurityGroup(identity, reloadedProject.getCandidateGroup());
log.audit("ProjectBroker: Accept candidate, identity=" + identity + " project=" + reloadedProject);
}
}
return Boolean.TRUE;
}
});
if (autoSignOut && result.booleanValue()) {
projectBrokerManager.signOutFormAllCandidateList(response.getAddedIdentities(), reloadedProject.getProjectBroker().getKey());
}
if (isAcceptSelectionManually && (reloadedProject.getMaxMembers() != Project.MAX_MEMBERS_UNLIMITED) && reloadedProject.getSelectedPlaces() >= reloadedProject.getMaxMembers()) {
projectBrokerManager.setProjectState(reloadedProject, Project.STATE_ASSIGNED);
log.info("ProjectBroker: Accept candidate, change project-state=" + Project.STATE_ASSIGNED);
}
return response;
}
use of org.olat.group.BusinessGroupAddResponse in project openolat by klemens.
the class FolderCallback method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest urequest, Controller source, Event event) {
if (source == projectBrokerConditionController) {
if (event == Event.CHANGED_EVENT) {
node.setConditionProjectBroker(projectBrokerConditionController.getCondition());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == dialogBoxController) {
if (DialogBoxUIFactory.isOkEvent(event)) {
// ok: open task folder
String relPath = TACourseNode.getTaskFolderPathRelToFolderRoot(CourseFactory.loadCourse(courseId), node);
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(relPath, null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(translate("taskfolder"), rootFolder);
namedFolder.setLocalSecurityCallback(new FolderCallback(relPath, false));
removeAsListenerAndDispose(frc);
frc = new FolderRunController(namedFolder, false, urequest, getWindowControl());
listenTo(frc);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("folder.close"), frc.getInitialComponent());
listenTo(cmc);
cmc.activate();
fireEvent(urequest, Event.CHANGED_EVENT);
}
} else if (source == scoringController) {
if (event == Event.CANCELLED_EVENT) {
if (hasLogEntries) {
scoringController.setDisplayOnly(true);
}
editScoring.contextPut("isOverwriting", new Boolean(false));
return;
} else if (event == Event.DONE_EVENT) {
scoringController.updateModuleConfiguration(config);
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == modulesForm) {
boolean onoff = event.getCommand().endsWith("true");
if (event.getCommand().startsWith("dropbox")) {
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_ENABLED, onoff);
} else if (event.getCommand().startsWith("returnbox")) {
config.set(ProjectBrokerCourseNode.CONF_RETURNBOX_ENABLED, onoff);
}
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
} else if (source == accountManagerGroupController) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
BusinessGroupAddResponse response = businessGroupService.addParticipants(urequest.getIdentity(), urequest.getUserSession().getRoles(), identitiesAddedEvent.getAddIdentities(), accountManagerGroup, null);
identitiesAddedEvent.setIdentitiesAddedEvent(response.getAddedIdentities());
identitiesAddedEvent.setIdentitiesWithoutPermission(response.getIdentitiesWithoutPermission());
identitiesAddedEvent.setIdentitiesAlreadyInGroup(response.getIdentitiesAlreadyInGroup());
getLogger().info("Add users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT);
} else if (event instanceof IdentitiesRemoveEvent) {
businessGroupService.removeParticipants(urequest.getIdentity(), ((IdentitiesRemoveEvent) event).getRemovedIdentities(), accountManagerGroup, null);
getLogger().info("Remove users as account-managers");
fireEvent(urequest, Event.CHANGED_EVENT);
}
} else if (source == optionsForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
projectBrokerModuleConfiguration.setNbrParticipantsPerTopic(optionsForm.getNnbrOfAttendees());
if (projectBrokerModuleConfiguration.isAcceptSelectionManually() && !optionsForm.getSelectionAccept()) {
// change 'Accept manually' to 'Accept automatically' => enroll all candidates
projectGroupManager.acceptAllCandidates(projectBrokerId, urequest.getIdentity(), projectBrokerModuleConfiguration.isAutoSignOut(), optionsForm.getSelectionAccept());
}
projectBrokerModuleConfiguration.setAcceptSelectionManaually(optionsForm.getSelectionAccept());
projectBrokerModuleConfiguration.setSelectionAutoSignOut(optionsForm.getSelectionAutoSignOut());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == customfieldsForm || source == projectEventForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (event == NodeEditController.NODECONFIG_CHANGED_EVENT) {
getLogger().debug("NODECONFIG_CHANGED_node.shortTitle=" + node.getShortTitle());
String groupName = translate("account.manager.groupname", node.getShortTitle());
String groupDescription = translate("account.manager.groupdescription", node.getShortTitle());
accountManagerGroup = projectGroupManager.updateAccountManagerGroupName(getIdentity(), groupName, groupDescription, accountManagerGroup);
} else if (source == dropboxForm) {
if (event == Event.CANCELLED_EVENT) {
return;
} else if (event == Event.DONE_EVENT) {
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_ENABLEMAIL, dropboxForm.mailEnabled());
config.set(ProjectBrokerCourseNode.CONF_DROPBOX_CONFIRMATION, dropboxForm.getConfirmation());
fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
return;
}
} else {
getLogger().warn("Can not handle event in ProjectBrokerCourseEditorController source=" + source + " " + event.toString());
}
}
Aggregations