Search in sources :

Example 51 with RepositoryHandler

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

the class IQSURVCourseNode 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(SurveyFileResource.TYPE_NAME);
        RepositoryEntry re = handler.importResource(owner, rie.getInitialAuthor(), rie.getDisplayName(), rie.getDescription(), false, locale, rie.importGetExportedFile(), null);
        IQEditController.setIQReference(re, getModuleConfiguration());
    } else {
        IQEditController.removeIQReference(getModuleConfiguration());
    }
}
Also used : RepositoryEntryImportExport(org.olat.repository.RepositoryEntryImportExport) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 52 with RepositoryHandler

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

the class QTIRuntimeController method doConvertToQTI21.

private void doConvertToQTI21(UserRequest ureq) {
    removeAsListenerAndDispose(localCmc);
    removeAsListenerAndDispose(createConvertedTestController);
    OLATResource originalObject = getRepositoryEntry().getOlatResource();
    RepositoryHandler qti21Handler = repositoryHandlerFactory.getRepositoryHandler(ImsQTI21Resource.TYPE_NAME);
    createConvertedTestController = new CreateRepositoryEntryController(ureq, getWindowControl(), qti21Handler);
    createConvertedTestController.setCreateObject(originalObject);
    createConvertedTestController.setDisplayname(getRepositoryEntry().getDisplayname());
    createConvertedTestController.setExampleAndHelp(translate("convert.qti21.hint"), "Change+from+QTI+1.2+to+QTI+2.1");
    listenTo(createConvertedTestController);
    localCmc = new CloseableModalController(getWindowControl(), translate("close"), createConvertedTestController.getInitialComponent(), true, translate("title.convert.qti21"));
    localCmc.activate();
    listenTo(localCmc);
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CreateRepositoryEntryController(org.olat.repository.ui.author.CreateRepositoryEntryController) OLATResource(org.olat.resource.OLATResource) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler)

Example 53 with RepositoryHandler

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

the class JunitTestHelper method deployDemoCourse.

/**
 * Deploys/imports the "Demo Course".
 * @return the created RepositoryEntry
 */
public static RepositoryEntry deployDemoCourse(Identity initialAuthor) {
    String displayname = "Demo-Kurs-7.1";
    String description = "";
    RepositoryEntry re = null;
    try {
        URL courseUrl = JunitTestHelper.class.getResource("file_resources/Demo-Kurs-7.1.zip");
        File courseFile = new File(courseUrl.toURI());
        RepositoryHandler courseHandler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(CourseModule.getCourseTypeName());
        re = courseHandler.importResource(initialAuthor, null, displayname, description, true, Locale.ENGLISH, courseFile, null);
        ICourse course = CourseFactory.loadCourse(re);
        CourseFactory.publishCourse(course, RepositoryEntry.ACC_USERS, false, initialAuthor, Locale.ENGLISH);
    } catch (Exception e) {
        log.error("", e);
    }
    return re;
}
Also used : ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) File(java.io.File) URL(java.net.URL)

Example 54 with RepositoryHandler

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

the class JunitTestHelper method deployBasicCourse.

/**
 * Deploy a course with only a single page.
 * @param initialAuthor
 * @return
 */
public static RepositoryEntry deployBasicCourse(Identity initialAuthor) {
    String displayname = "Basic course (" + CodeHelper.getForeverUniqueID() + ")";
    String description = "A course with only a single page";
    RepositoryEntry re = null;
    try {
        URL courseUrl = JunitTestHelper.class.getResource("file_resources/Basic_course.zip");
        File courseFile = new File(courseUrl.toURI());
        RepositoryHandler courseHandler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(CourseModule.getCourseTypeName());
        re = courseHandler.importResource(initialAuthor, null, displayname, description, true, Locale.ENGLISH, courseFile, null);
        ICourse course = CourseFactory.loadCourse(re);
        CourseFactory.publishCourse(course, RepositoryEntry.ACC_USERS, false, initialAuthor, Locale.ENGLISH);
    } catch (Exception e) {
        log.error("", e);
    }
    return re;
}
Also used : ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) File(java.io.File) URL(java.net.URL)

Example 55 with RepositoryHandler

use of org.olat.repository.handlers.RepositoryHandler in project openolat by klemens.

the class QuestionListController method doOpenCreateRepositoryTest.

private void doOpenCreateRepositoryTest(UserRequest ureq, List<QuestionItemShort> items, String type) {
    removeAsListenerAndDispose(cmc);
    removeAsListenerAndDispose(addController);
    RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(type);
    addController = handler.createCreateRepositoryEntryController(ureq, getWindowControl());
    addController.setCreateObject(new QItemList(items));
    listenTo(addController);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), addController.getInitialComponent());
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryHandler(org.olat.repository.handlers.RepositoryHandler) QItemList(org.olat.modules.qpool.model.QItemList)

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