use of org.olat.group.ui.edit.BusinessGroupModifiedEvent in project OpenOLAT by OpenOLAT.
the class AssessmentModeCoordinationServiceImpl method event.
@Override
public void event(Event event) {
if (event instanceof BusinessGroupModifiedEvent) {
try {
BusinessGroupModifiedEvent mod = (BusinessGroupModifiedEvent) event;
if (BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT.equals(mod.getCommand())) {
Long identityKey = mod.getAffectedIdentityKey();
sendEventAfterMembershipChange(identityKey);
}
} catch (Exception e) {
log.error("", e);
}
}
}
use of org.olat.group.ui.edit.BusinessGroupModifiedEvent in project OpenOLAT by OpenOLAT.
the class RunMainController 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 ureq, Controller source, Event event) {
if (needsRebuildAfter) {
currentCourseNode = updateAfterChanges(currentCourseNode);
needsRebuildAfter = false;
}
if (source == currentNodeController) {
if (event instanceof OlatCmdEvent) {
OlatCmdEvent oe = (OlatCmdEvent) event;
String cmd = oe.getCommand();
if (OlatCmdEvent.GOTONODE_CMD.equals(cmd)) {
// "69680861018558/node-specific-data";
String subcmd = oe.getSubcommand();
CourseNode identNode;
String nodecmd = null;
int slPos = subcmd.indexOf('/');
if (slPos != -1) {
nodecmd = subcmd.substring(slPos + 1);
identNode = course.getRunStructure().getNode(subcmd.substring(0, slPos));
} else {
identNode = course.getRunStructure().getNode(subcmd);
}
if (identNode == null) {
showWarning("msg.nodenotavailableanymore");
} else {
addLoggingResourceable(LoggingResourceable.wrap(identNode));
currentCourseNode = identNode;
updateTreeAndContent(ureq, identNode, nodecmd);
oe.accept();
}
}
} else if (event == Event.DONE_EVENT) {
// preconditions may have changed
if (needsRebuildAfterRunDone) {
needsRebuildAfterRunDone = false;
updateTreeAndContent(ureq, currentCourseNode, null);
}
} else if (REBUILD.equals(event.getCommand())) {
needsRebuildAfterRunDone = false;
updateTreeAndContent(ureq, currentCourseNode, null);
} else if (event instanceof TreeNodeEvent) {
TreeNodeEvent tne = (TreeNodeEvent) event;
TreeNode newCpTreeNode = tne.getChosenTreeNode();
luTree.setSelectedNodeId(newCpTreeNode.getIdent());
} else if (event == Event.CHANGED_EVENT) {
updateTreeAndContent(ureq, currentCourseNode, null);
} else if (event instanceof BusinessGroupModifiedEvent) {
fireEvent(ureq, event);
updateTreeAndContent(ureq, currentCourseNode, null);
}
}
}
use of org.olat.group.ui.edit.BusinessGroupModifiedEvent in project OpenOLAT by OpenOLAT.
the class ENRunController 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 ureq, Controller source, Event event) {
String cmd = event.getCommand();
if (source == tableCtr) {
if (cmd.equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
EnrollmentRow row = groupListModel.getObject(rowid);
Long choosenGroupKey = row.getKey();
if (actionid.equals(CMD_ENROLL_IN_GROUP)) {
BusinessGroup choosenGroup = businessGroupService.loadBusinessGroup(choosenGroupKey);
addLoggingResourceable(LoggingResourceable.wrap(choosenGroup));
if (log.isDebug()) {
log.debug("CMD_ENROLL_IN_GROUP ureq.getComponentID()=" + ureq.getComponentID() + " ureq.getComponentTimestamp()=" + ureq.getComponentTimestamp());
}
EnrollStatus enrollStatus = enrollmentManager.doEnroll(ureq.getIdentity(), ureq.getUserSession().getRoles(), choosenGroup, enNode, coursePropertyManager, getWindowControl(), getTranslator(), enrollableGroupKeys, enrollableAreaKeys, courseGroupManager);
if (enrollStatus.isEnrolled() || enrollStatus.isInWaitingList()) {
// OK
} else {
getWindowControl().setError(enrollStatus.getErrorMessage());
}
// events are already fired BusinessGroupManager level :: BusinessGroupModifiedEvent.fireModifiedGroupEvents(BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT, choosenGroup, ureq.getIdentity());
// but async
// fire event to indicate runmaincontroller that the menuview is to update
doEnrollView(updateModel());
if (enrollStatus.isEnrolled()) {
fireEvent(ureq, new BusinessGroupModifiedEvent(BusinessGroupModifiedEvent.IDENTITY_ADDED_EVENT, choosenGroup, getIdentity()));
} else {
fireEvent(ureq, Event.DONE_EVENT);
}
} else if (actionid.equals(CMD_ENROLLED_CANCEL)) {
BusinessGroup choosenGroup = businessGroupService.loadBusinessGroup(choosenGroupKey);
addLoggingResourceable(LoggingResourceable.wrap(choosenGroup));
List<String> roles = businessGroupService.getIdentityRolesInBusinessGroup(getIdentity(), choosenGroup);
if (roles.contains(GroupRoles.waiting.name())) {
enrollmentManager.doCancelEnrollmentInWaitingList(ureq.getIdentity(), choosenGroup, enNode, coursePropertyManager, getWindowControl(), getTranslator());
} else if (roles.contains(GroupRoles.participant.name())) {
enrollmentManager.doCancelEnrollment(ureq.getIdentity(), choosenGroup, enNode, coursePropertyManager, getWindowControl(), getTranslator());
}
// fire event to indicate runmaincontroller that the menuview is to update
fireEvent(ureq, new BusinessGroupModifiedEvent(BusinessGroupModifiedEvent.IDENTITY_REMOVED_EVENT, choosenGroup, getIdentity()));
// events are already fired BusinessGroupManager level :: BusinessGroupModifiedEvent.fireModifiedGroupEvents(BusinessGroupModifiedEvent.IDENTITY_REMOVED_EVENT, group, ureq.getIdentity());
// but async
doEnrollView(updateModel());
} else if (CMD_VISIT_CARD.equals(actionid)) {
List<String> roles = businessGroupService.getIdentityRolesInBusinessGroup(getIdentity(), row);
String businessPath;
if (roles.contains(GroupRoles.coach.name()) || roles.contains(GroupRoles.participant.name())) {
businessPath = "[BusinessGroup:" + choosenGroupKey + "]";
} else {
businessPath = "[GroupCard:" + choosenGroupKey + "]";
}
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
}
}
use of org.olat.group.ui.edit.BusinessGroupModifiedEvent in project OpenOLAT by OpenOLAT.
the class GroupsPortletRunController method event.
public void event(Event event) {
if (event instanceof BusinessGroupModifiedEvent) {
BusinessGroupModifiedEvent mev = (BusinessGroupModifiedEvent) event;
if (BusinessGroupModifiedEvent.IDENTITY_REMOVED_EVENT.equals(event.getCommand()) && getIdentity().getKey().equals(mev.getAffectedIdentityKey())) {
Long modifiedKey = mev.getModifiedGroupKey();
for (PortletEntry<BusinessGroupEntry> portlet : groupListModel.getObjects()) {
if (modifiedKey.equals(portlet.getKey())) {
;
groupListModel.getObjects().remove(portlet);
tableCtr.modelChanged();
break;
}
}
}
}
}
use of org.olat.group.ui.edit.BusinessGroupModifiedEvent in project OpenOLAT by OpenOLAT.
the class BusinessGroupMainRunController method event.
/**
* @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
*/
@Override
public void event(Event event) {
if (event instanceof OLATResourceableJustBeforeDeletedEvent) {
OLATResourceableJustBeforeDeletedEvent delEvent = (OLATResourceableJustBeforeDeletedEvent) event;
if (!delEvent.targetEquals(businessGroup)) {
throw new AssertException("receiving a delete event for a olatres we never registered for!!!:" + delEvent.getDerivedOres());
}
dispose();
} else if (event instanceof BusinessGroupModifiedEvent) {
BusinessGroupModifiedEvent bgmfe = (BusinessGroupModifiedEvent) event;
if (event.getCommand().equals(BusinessGroupModifiedEvent.CONFIGURATION_MODIFIED_EVENT)) {
// reset business group property manager
// update reference to update business group object
businessGroup = businessGroupService.loadBusinessGroup(businessGroup);
chatAvailable = isChatAvailable();
main.contextPut("BuddyGroup", businessGroup);
TreeModel trMdl = buildTreeModel();
bgTree.setTreeModel(trMdl);
if (bgEditCntrllr == null) {
// change didn't origin by our own edit controller
showInfo("grouprun.configurationchanged");
bgTree.setSelectedNodeId(trMdl.getRootNode().getIdent());
mainPanel.setContent(main);
} else {
// Activate edit menu item
bgTree.setSelectedNodeId(ACTIVITY_MENUSELECT_ADMINISTRATION);
}
} else if (bgmfe.wasMyselfRemoved(getIdentity()) && !wildcard && !isGroupsAdmin) {
// nothing more here!! The message will be created and displayed upon disposing
// disposed message controller will be set
dispose();
}
} else if (event instanceof AssessmentEvent) {
if (((AssessmentEvent) event).getEventType().equals(AssessmentEvent.TYPE.STARTED)) {
groupRunDisabled = true;
} else if (((AssessmentEvent) event).getEventType().equals(AssessmentEvent.TYPE.STOPPED)) {
groupRunDisabled = false;
}
}
}
Aggregations