* Called at course publish.
* @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
*/
public void event(Event event) {
if (event instanceof PublishEvent) {
PublishEvent pe = (PublishEvent) event;
//FIXME: LD: temporary introduced the (pe.getCommand() == PublishEvent.EVENT_IDENTIFIER) to filter the events from the same VM
if (pe.getState() == PublishEvent.PRE_PUBLISH && pe.getEventIdentifier() == PublishEvent.EVENT_IDENTIFIER) {
// PRE PUBLISH -> check node for changes
addToUpcomingWork(pe);
return;
} else if (pe.getState() == PublishEvent.PUBLISH && pe.getEventIdentifier() == PublishEvent.EVENT_IDENTIFIER) {
// a publish event, check if it matches a previous checked
boolean recalc = false;
Long resId = pe.getPublishedCourseResId();
synchronized (upcomingWork) { //o_clusterOK by:ld synchronized OK - only one cluster node must update the EfficiencyStatements (the course is locked for editing) (same as e.g. file indexer)
recalc = upcomingWork.contains(resId);
if (recalc) {
upcomingWork.remove(resId);
}
}
if (recalc) {
ICourse pubCourse = CourseFactory.loadCourse(pe.getPublishedCourseResId());
UpdateEfficiencyStatementsWorker worker = new UpdateEfficiencyStatementsWorker(pubCourse);
updateESPool.execute(worker);
}
}
}