Search in sources :

Example 11 with RepositoryHandler

use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.

the class BlogCourseNode method importNode.

@Override
public void importNode(File importDirectory, ICourse course, Identity owner, Locale locale, boolean withReferences) {
    if (withReferences) {
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(BlogFileResource.TYPE_NAME);
        importFeed(handler, importDirectory, owner, locale);
    } else {
        FeedNodeEditController.removeReference(getModuleConfiguration());
    }
}
Also used : RepositoryHandler(org.olat.repository.handlers.RepositoryHandler)

Example 12 with RepositoryHandler

use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.

the class CPCourseNode method importNode.

@Override
public void importNode(File importDirectory, ICourse course, Identity owner, Locale locale, boolean withReferences) {
    RepositoryEntryImportExport rie = new RepositoryEntryImportExport(importDirectory, getIdent());
    if (withReferences && rie.anyExportedPropertiesAvailable()) {
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(ImsCPFileResource.TYPE_NAME);
        RepositoryEntry re = handler.importResource(owner, rie.getInitialAuthor(), rie.getDisplayName(), rie.getDescription(), false, locale, rie.importGetExportedFile(), null);
        CPEditController.setCPReference(re, getModuleConfiguration());
    } else {
        CPEditController.removeCPReference(getModuleConfiguration());
    }
}
Also used : RepositoryEntryImportExport(org.olat.repository.RepositoryEntryImportExport) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 13 with RepositoryHandler

use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.

the class ReferencableEntriesSearchController method event.

@Override
public void event(UserRequest ureq, Component source, Event event) {
    if (source == segmentView) {
        if (event instanceof SegmentViewEvent) {
            SegmentViewEvent sve = (SegmentViewEvent) event;
            String segmentCName = sve.getComponentName();
            Component clickedLink = mainVC.getComponent(segmentCName);
            if (clickedLink == myEntriesLink) {
                searchCtr.doSearchByOwnerLimitType(ureq.getIdentity(), limitTypes);
            } else if (clickedLink == allEntriesLink) {
                switch(canBe) {
                    case referenceable:
                        searchCtr.doSearchForReferencableResourcesLimitType(ureq.getIdentity(), limitTypes, ureq.getUserSession().getRoles());
                        break;
                    case copyable:
                        searchCtr.doSearchForCopyableResourcesLimitType(ureq.getIdentity(), limitTypes, ureq.getUserSession().getRoles());
                        break;
                    case all:
                        searchCtr.doSearchByTypeLimitAccess(limitTypes, ureq);
                        break;
                }
            } else if (clickedLink == searchEntriesLink) {
                searchCtr.displaySearchForm();
            } else if (clickedLink == adminEntriesLink) {
                searchCtr.displayAdminSearchForm();
            }
            mainVC.setDirty(true);
        }
    } else if (source == createRessourceCmp || (source instanceof Link && ((Link) source).getUserObject() instanceof RepositoryHandler)) {
        removeAsListenerAndDispose(cmc);
        removeAsListenerAndDispose(createController);
        RepositoryHandler handler = (RepositoryHandler) ((Link) source).getUserObject();
        createController = handler.createCreateRepositoryEntryController(ureq, getWindowControl());
        listenTo(createController);
        String title = translate(handler.getCreateLabelI18nKey());
        cmc = new CloseableModalController(getWindowControl(), translate("close"), createController.getInitialComponent(), true, title);
        cmc.setCustomWindowCSS("o_sel_author_create_popup");
        listenTo(cmc);
        cmc.activate();
    } else if (source == importRessourceButton) {
        removeAsListenerAndDispose(importController);
        importController = new ImportRepositoryEntryController(ureq, getWindowControl(), limitTypes);
        listenTo(importController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), importController.getInitialComponent(), true, "");
        listenTo(cmc);
        cmc.activate();
    }
}
Also used : SegmentViewEvent(org.olat.core.gui.components.segmentedview.SegmentViewEvent) ImportRepositoryEntryController(org.olat.repository.ui.author.ImportRepositoryEntryController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) Component(org.olat.core.gui.components.Component) SegmentViewComponent(org.olat.core.gui.components.segmentedview.SegmentViewComponent) Link(org.olat.core.gui.components.link.Link)

Example 14 with RepositoryHandler

use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.

the class RepositoryServiceImpl method deletePermanently.

@Override
public ErrorList deletePermanently(RepositoryEntry entry, Identity identity, Roles roles, Locale locale) {
    ErrorList errors = new ErrorList();
    boolean debug = log.isDebug();
    // invoke handler delete callback
    if (debug)
        log.debug("deleteRepositoryEntry start entry=" + entry);
    entry = (RepositoryEntry) dbInstance.loadObject(entry, true);
    if (debug)
        log.debug("deleteRepositoryEntry after load entry=" + entry);
    RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(entry);
    OLATResource resource = entry.getOlatResource();
    // delete old context
    if (!handler.readyToDelete(entry, identity, roles, locale, errors)) {
        return errors;
    }
    userCourseInformationsManager.deleteUserCourseInformations(entry);
    certificatesManager.deleteRepositoryEntry(entry);
    // delete all bookmarks referencing deleted entry
    CoreSpringFactory.getImpl(MarkManager.class).deleteMarks(entry);
    // delete all catalog entries referencing deleted entry
    catalogManager.resourceableDeleted(entry);
    // delete assessment modes
    assessmentModeDao.delete(entry);
    // delete reminders
    reminderDao.delete(entry);
    // delete all policies
    securityManager.deletePolicies(resource);
    // delete reservations
    reservationDao.deleteReservations(resource);
    // delete references
    referenceManager.deleteAllReferencesOf(resource);
    // delete all pending tasks
    persistentTaskDao.delete(resource);
    dbInstance.commit();
    // delete lectures
    CoreSpringFactory.getImpl(LectureService.class).delete(entry);
    dbInstance.commit();
    // delete license
    CoreSpringFactory.getImpl(LicenseService.class).delete(resource);
    dbInstance.commit();
    // detach portfolio if there are some lost
    CoreSpringFactory.getImpl(PortfolioService.class).detachCourseFromBinders(entry);
    dbInstance.commit();
    // inform handler to do any cleanup work... handler must delete the
    // referenced resourceable a swell.
    handler.cleanupOnDelete(entry, resource);
    dbInstance.commit();
    // delete all test sessions
    assessmentTestSessionDao.deleteAllUserTestSessionsByCourse(entry);
    // nullify the reference
    assessmentEntryDao.removeEntryForReferenceEntry(entry);
    assessmentEntryDao.deleteEntryForRepositoryEntry(entry);
    dbInstance.commit();
    if (debug)
        log.debug("deleteRepositoryEntry after reload entry=" + entry);
    deleteRepositoryEntryAndBaseGroups(entry);
    if (debug)
        log.debug("deleteRepositoryEntry Done");
    return errors;
}
Also used : ErrorList(org.olat.repository.ErrorList) PortfolioService(org.olat.modules.portfolio.PortfolioService) MarkManager(org.olat.core.commons.services.mark.MarkManager) LicenseService(org.olat.core.commons.services.license.LicenseService) OLATResource(org.olat.resource.OLATResource) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) LectureService(org.olat.modules.lecture.LectureService)

Example 15 with RepositoryHandler

use of org.olat.repository.handlers.RepositoryHandler in project OpenOLAT by OpenOLAT.

the class RepositoryServiceImpl method getIntroductionMovie.

@Override
public VFSLeaf getIntroductionMovie(RepositoryEntry re) {
    RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(re);
    VFSContainer mediaContainer = handler.getMediaContainer(re);
    if (mediaContainer != null) {
        List<VFSItem> items = mediaContainer.getItems();
        for (VFSItem item : items) {
            if (item instanceof VFSLeaf && item.getName().startsWith(re.getKey().toString()) && (item.getName().endsWith(".mp4") || item.getName().endsWith(".m4v") || item.getName().endsWith(".flv"))) {
                return (VFSLeaf) item;
            }
        }
    }
    return null;
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler)

Aggregations

RepositoryHandler (org.olat.repository.handlers.RepositoryHandler)74 RepositoryEntry (org.olat.repository.RepositoryEntry)42 RepositoryEntryImportExport (org.olat.repository.RepositoryEntryImportExport)18 OLATResource (org.olat.resource.OLATResource)16 File (java.io.File)14 ICourse (org.olat.course.ICourse)10 RepositoryService (org.olat.repository.RepositoryService)10 ArrayList (java.util.ArrayList)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 MediaResource (org.olat.core.gui.media.MediaResource)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)6 LockResult (org.olat.core.util.coordinate.LockResult)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)6 OrderedRepositoryHandler (org.olat.repository.handlers.RepositoryHandlerFactory.OrderedRepositoryHandler)6 URL (java.net.URL)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4