Search in sources :

Example 6 with EntryChangedEvent

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;
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 7 with EntryChangedEvent

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);
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Example 8 with EntryChangedEvent

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);
}
Also used : OfferAccess(org.olat.resource.accesscontrol.OfferAccess) Offer(org.olat.resource.accesscontrol.Offer) EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) ACService(org.olat.resource.accesscontrol.ACService) RepositoryManager(org.olat.repository.RepositoryManager) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Example 9 with EntryChangedEvent

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();
    }
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent)

Example 10 with EntryChangedEvent

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;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent)

Aggregations

EntryChangedEvent (org.olat.repository.controllers.EntryChangedEvent)32 RepositoryEntry (org.olat.repository.RepositoryEntry)12 MultiUserEvent (org.olat.core.util.event.MultiUserEvent)10 OLATResourceable (org.olat.core.id.OLATResourceable)8 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 LicenseType (org.olat.core.commons.services.license.LicenseType)2 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)2 Roles (org.olat.core.id.Roles)2 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)2 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2 BusinessGroup (org.olat.group.BusinessGroup)2 BusinessGroupSelectionEvent (org.olat.group.model.BusinessGroupSelectionEvent)2 ExportFormatOptions (org.olat.modules.qpool.ExportFormatOptions)2 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)2 QItemList (org.olat.modules.qpool.model.QItemList)2