Search in sources :

Example 1 with PublishEvent

use of org.olat.course.editor.PublishEvent in project OpenOLAT by OpenOLAT.

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 2 with PublishEvent

use of org.olat.course.editor.PublishEvent 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)

Aggregations

Identity (org.olat.core.id.Identity)2 OLATResourceableJustBeforeDeletedEvent (org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent)2 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)2 PublishEvent (org.olat.course.editor.PublishEvent)2