Search in sources :

Example 26 with OLATResourceableJustBeforeDeletedEvent

use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent in project openolat by klemens.

the class RunMainController method event.

/**
 * implementation of listener which listens to publish events
 *
 * @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
 */
@Override
public void event(Event event) {
    if (event instanceof PublishEvent) {
        PublishEvent pe = (PublishEvent) event;
        if (course.getResourceableId().equals(pe.getPublishedCourseResId())) {
            processPublishEvent(pe);
        }
    } else if (event instanceof OLATResourceableJustBeforeDeletedEvent) {
        OLATResourceableJustBeforeDeletedEvent ojde = (OLATResourceableJustBeforeDeletedEvent) event;
        // registered only to one event, but good style.
        if (ojde.targetEquals(course, true)) {
            doDisposeAfterEvent();
        }
    } else if (event instanceof AssessmentChangedEvent) {
        AssessmentChangedEvent ace = (AssessmentChangedEvent) event;
        Identity identity = uce.getIdentityEnvironment().getIdentity();
        // reevaluate the changed node if the event changed the current user
        if (ace.getIdentityKey().equals(identity.getKey())) {
            String assessmentChangeType = ace.getCommand();
            // do not re-evaluate things if only comment has been changed
            if (assessmentChangeType.equals(AssessmentChangedEvent.TYPE_SCORE_EVAL_CHANGED) || assessmentChangeType.equals(AssessmentChangedEvent.TYPE_ATTEMPTS_CHANGED)) {
                // LD: do not recalculate the score now, but at the next click, since the event comes before DB commit
                // uce.getScoreAccounting().evaluateAll();
                assessmentChangedEventReceived = true;
            }
            // raise a flag to indicate refresh
            needsRebuildAfterRunDone = true;
        }
    }
}
Also used : PublishEvent(org.olat.course.editor.PublishEvent) AssessmentChangedEvent(org.olat.course.assessment.AssessmentChangedEvent) OLATResourceableJustBeforeDeletedEvent(org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent) Identity(org.olat.core.id.Identity)

Example 27 with OLATResourceableJustBeforeDeletedEvent

use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent in project openolat by klemens.

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;
        }
    }
}
Also used : TreeModel(org.olat.core.gui.components.tree.TreeModel) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) AssertException(org.olat.core.logging.AssertException) AssessmentEvent(org.olat.course.nodes.iq.AssessmentEvent) OLATResourceableJustBeforeDeletedEvent(org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent) BusinessGroupModifiedEvent(org.olat.group.ui.edit.BusinessGroupModifiedEvent)

Example 28 with OLATResourceableJustBeforeDeletedEvent

use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent in project openolat by klemens.

the class BusinessGroupEditController 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(currBusinessGroup))
            throw new AssertException("receiving a delete event for a olatres we never registered for!!!:" + delEvent.getDerivedOres());
        dispose();
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) OLATResourceableJustBeforeDeletedEvent(org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent)

Aggregations

OLATResourceableJustBeforeDeletedEvent (org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent)28 AssertException (org.olat.core.logging.AssertException)6 ObjectNotFoundException (org.hibernate.ObjectNotFoundException)2 StaleObjectStateException (org.hibernate.StaleObjectStateException)2 CollaborationTools (org.olat.collaboration.CollaborationTools)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)2 TreeModel (org.olat.core.gui.components.tree.TreeModel)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 DBRuntimeException (org.olat.core.logging.DBRuntimeException)2 KnownIssueException (org.olat.core.logging.KnownIssueException)2 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)2 PublishEvent (org.olat.course.editor.PublishEvent)2 AssessmentEvent (org.olat.course.nodes.iq.AssessmentEvent)2 DeletableGroupData (org.olat.group.DeletableGroupData)2 BusinessGroupModifiedEvent (org.olat.group.ui.edit.BusinessGroupModifiedEvent)2 OLATResource (org.olat.resource.OLATResource)2 OLATResourceManager (org.olat.resource.OLATResourceManager)2