use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent in project OpenOLAT by OpenOLAT.
the class PodcastHandler method cleanupOnDelete.
@Override
public boolean cleanupOnDelete(RepositoryEntry entry, OLATResourceable res) {
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(new OLATResourceableJustBeforeDeletedEvent(res), res);
// For now, notifications are not implemented since a podcast feed is meant
// to be subscriped to anyway.
// NotificationsManager.getInstance().deletePublishersOf(res);
FeedManager.getInstance().deleteFeed(res);
return true;
}
use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent in project OpenOLAT by OpenOLAT.
the class NoteController method event.
/**
* @see org.olat.core.util.event.GenericEventListener#event(org.olat.core.gui.control.Event)
*/
public void event(Event event) {
if (event instanceof OLATResourceableJustBeforeDeletedEvent) {
OLATResourceableJustBeforeDeletedEvent bdev = (OLATResourceableJustBeforeDeletedEvent) event;
Long key = n.getKey();
if (key != null) {
// already persisted
if (bdev.getOresId().equals(key)) {
dispose();
}
}
}
}
use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent in project OpenOLAT by OpenOLAT.
the class NoteListController 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 row has been clicked
if (source == tableC) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
String actionid = te.getActionId();
int rowid = te.getRowId();
this.chosenN = nLModel.getObject(rowid);
if (actionid.equals("choose")) {
removeAsListenerAndDispose(nc);
nc = new NoteController(ureq, getWindowControl(), chosenN);
listenTo(nc);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), nc.getInitialComponent());
listenTo(cmc);
cmc.activate();
} else if (actionid.equals("delete")) {
deleteDialogCtr = activateYesNoDialog(ureq, null, translate("note.delete.confirmation"), deleteDialogCtr);
}
}
} else if (source == deleteDialogCtr) {
if (DialogBoxUIFactory.isYesEvent(event)) {
// delete is ok
nm.deleteNote(chosenN);
// fire local event (for the same user)
// TODO:fj:a make Note (and all persistables) olatresourceables: problem: type is then NoteImpl instead of Note
OLATResourceable ores = OresHelper.createOLATResourceableInstance(Note.class, chosenN.getKey());
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(new OLATResourceableJustBeforeDeletedEvent(ores), ores);
showInfo("note.delete.successfull");
populateNLTable();
chosenN = null;
} else {
// answer was "no"
chosenN = null;
}
} else if (source == nc) {
if (event == Event.BACK_EVENT) {
cmc.deactivate();
}
}
}
use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent 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;
}
}
}
use of org.olat.core.util.resource.OLATResourceableJustBeforeDeletedEvent in project OpenOLAT by OpenOLAT.
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();
}
}
Aggregations