use of org.olat.repository.controllers.EntryChangedEvent in project OpenOLAT by OpenOLAT.
the class ConfirmCloseController method setReadOnlyEntries.
private boolean setReadOnlyEntries(UserRequest ureq, List<RepositoryEntry> entries) {
boolean allOk = true;
for (RepositoryEntry entry : entries) {
RepositoryEntry reloadedEntry = repositoryService.loadByKey(entry.getKey());
if (reloadedEntry != null) {
repositoryService.closeRepositoryEntry(reloadedEntry);
ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_DEACTIVATE, getClass(), LoggingResourceable.wrap(reloadedEntry, OlatResourceableType.genRepoEntry));
fireEvent(ureq, new EntryChangedEvent(reloadedEntry, getIdentity(), Change.closed, "closed"));
}
}
return allOk;
}
use of org.olat.repository.controllers.EntryChangedEvent in project OpenOLAT by OpenOLAT.
the class CatalogManager method notifyReferencedRepositoryEntryChanges.
/**
* @param re
*/
public void notifyReferencedRepositoryEntryChanges(RepositoryEntry re) {
// inform anybody interested about this change
MultiUserEvent modifiedEvent = new EntryChangedEvent(re, null, Change.modifiedDescription, "CatalogManager");
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, re);
}
use of org.olat.repository.controllers.EntryChangedEvent in project OpenOLAT by OpenOLAT.
the class PublishProcess method changeAccessAndProperties.
public void changeAccessAndProperties(Identity author, CourseAccessAndProperties accessAndProps) {
RepositoryManager manager = RepositoryManager.getInstance();
manager.setAccessAndProperties(accessAndProps.getRepositoryEntry(), accessAndProps.getAccess(), accessAndProps.isMembersOnly(), accessAndProps.isCanCopy(), accessAndProps.isCanReference(), accessAndProps.isCanDownload());
manager.setLeaveSetting(accessAndProps.getRepositoryEntry(), accessAndProps.getSetting());
List<OfferAccess> offerAccess = accessAndProps.getOfferAccess();
// 1: add new and update existing offerings
ACService acService = CoreSpringFactory.getImpl(ACService.class);
for (OfferAccess newLink : offerAccess) {
if (accessAndProps.getConfirmationEmail() != null) {
Offer offer = newLink.getOffer();
boolean confirmation = accessAndProps.getConfirmationEmail().booleanValue();
if (offer.isConfirmationEmail() != confirmation) {
offer.setConfirmationEmail(confirmation);
if (offer.getKey() != null) {
offer = acService.save(offer);
}
}
}
acService.saveOfferAccess(newLink);
}
// 2: remove offerings not available anymore
List<OfferAccess> deletedOfferAccess = accessAndProps.getDeletedOfferAccess();
for (OfferAccess deletedLink : deletedOfferAccess) {
acService.deletedLinkToMethod(deletedLink);
}
MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish");
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, repositoryEntry);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES);
}
use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.
the class RepositoryEntryLifeCycleChangeController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (confirmDeleteCtrl == source) {
cmc.deactivate();
if (event == Event.CANCELLED_EVENT) {
cleanUp();
} else if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
cleanUp();
// commit before sending events
dbInstance.commit();
fireEvent(ureq, deletedEvent);
EntryChangedEvent e = new EntryChangedEvent(re, getIdentity(), Change.deleted, "runtime");
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
}
} else if (confirmCloseCtrl == source) {
cmc.deactivate();
if (event == Event.CANCELLED_EVENT) {
cleanUp();
} else if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
cleanUp();
// commit before sending events
dbInstance.commit();
doCloseResource();
fireEvent(ureq, closedEvent);
EntryChangedEvent e = new EntryChangedEvent(re, getIdentity(), Change.closed, "runtime");
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
}
} else if (confirmUncloseCtrl == source) {
if (DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) {
cleanUp();
doUncloseResource();
// commit before sending events
dbInstance.commit();
fireEvent(ureq, unclosedEvent);
EntryChangedEvent e = new EntryChangedEvent(re, getIdentity(), Change.unclosed, "runtime");
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
}
} else if (cmc == source) {
cleanUp();
}
}
use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.
the class AuthorListController method doMark.
protected boolean doMark(UserRequest ureq, AuthoringEntryRow row) {
OLATResourceable item = OresHelper.createOLATResourceableInstance("RepositoryEntry", row.getKey());
if (markManager.isMarked(item, getIdentity(), null)) {
markManager.removeMark(item, getIdentity(), null);
// before sending, save the changes
dbInstance.commit();
EntryChangedEvent e = new EntryChangedEvent(row, getIdentity(), Change.removeBookmark, i18nName);
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
return false;
}
String businessPath = "[RepositoryEntry:" + item.getResourceableId() + "]";
markManager.setMark(item, getIdentity(), null, businessPath);
// before sending, save the changes
dbInstance.commit();
EntryChangedEvent e = new EntryChangedEvent(row, getIdentity(), Change.addBookmark, i18nName);
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
return true;
}
Aggregations