Search in sources :

Example 6 with QItemList

use of org.olat.modules.qpool.model.QItemList in project openolat by klemens.

the class QTIHandler method createResource.

protected RepositoryEntry createResource(String type, FileResource ores, Identity initialAuthor, String displayname, String description, Object object, Locale locale) {
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(ores);
    RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    DBFactory.getInstance().commit();
    File fRepositoryQTI = new File(FileResourceManager.getInstance().getFileResourceRoot(re.getOlatResource()), "qti.zip");
    QTIEditorPackageImpl qtiPackage = new QTIEditorPackageImpl(displayname, type, locale);
    if (object instanceof QItemList) {
        QItemList itemToImport = (QItemList) object;
        QTIQPoolServiceProvider provider = (QTIQPoolServiceProvider) CoreSpringFactory.getBean("qtiPoolServiceProvider");
        provider.exportToEditorPackage(qtiPackage, itemToImport.getItems(), true);
    }
    qtiPackage.savePackageTo(fRepositoryQTI);
    return re;
}
Also used : QTIEditorPackageImpl(org.olat.ims.qti.editor.QTIEditorPackageImpl) QTIQPoolServiceProvider(org.olat.ims.qti.qpool.QTIQPoolServiceProvider) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) File(java.io.File) RepositoryService(org.olat.repository.RepositoryService) QItemList(org.olat.modules.qpool.model.QItemList)

Aggregations

QItemList (org.olat.modules.qpool.model.QItemList)6 File (java.io.File)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 RepositoryService (org.olat.repository.RepositoryService)4 OLATResource (org.olat.resource.OLATResource)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 ImsQTI21Resource (org.olat.fileresource.types.ImsQTI21Resource)2 QTIEditorPackage (org.olat.ims.qti.editor.QTIEditorPackage)2 QTIEditorPackageImpl (org.olat.ims.qti.editor.QTIEditorPackageImpl)2 QTIQPoolServiceProvider (org.olat.ims.qti.qpool.QTIQPoolServiceProvider)2 QTI21DeliveryOptions (org.olat.ims.qti21.QTI21DeliveryOptions)2 RepositoryHandler (org.olat.repository.handlers.RepositoryHandler)2