Search in sources :

Example 31 with EntryChangedEvent

use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.

the class PublishProcess method changeGeneralAccess.

public void changeGeneralAccess(Identity author, int access, boolean membersOnly) {
    RepositoryManager.getInstance().setAccess(repositoryEntry, access, membersOnly);
    MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish");
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, repositoryEntry);
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) MultiUserEvent(org.olat.core.util.event.MultiUserEvent)

Example 32 with EntryChangedEvent

use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.

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)

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