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());
}
}
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);
}
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;
}
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;
}
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();
}
Aggregations