use of org.olat.repository.RepositoryEntryImportExport in project OpenOLAT by OpenOLAT.
the class IQSURVCourseNode method exportNode.
@Override
public void exportNode(File exportDirectory, ICourse course) {
String repositorySoftKey = (String) getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
// nothing to export
if (repositorySoftKey == null)
return;
// self healing
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, false);
if (re == null) {
// nothing to export, but correct the module configuration
IQEditController.removeIQReference(getModuleConfiguration());
return;
}
File fExportDirectory = new File(exportDirectory, getIdent());
fExportDirectory.mkdirs();
RepositoryEntryImportExport reie = new RepositoryEntryImportExport(re, fExportDirectory);
reie.exportDoExport();
}
use of org.olat.repository.RepositoryEntryImportExport in project OpenOLAT by OpenOLAT.
the class AbstractFeedCourseNode method importFeed.
public void importFeed(RepositoryHandler handler, File importDirectory, Identity owner, Locale locale) {
RepositoryEntryImportExport rie = new RepositoryEntryImportExport(importDirectory, getIdent());
if (rie.anyExportedPropertiesAvailable()) {
RepositoryEntry re = handler.importResource(owner, rie.getInitialAuthor(), rie.getDisplayName(), rie.getDescription(), false, locale, rie.importGetExportedFile(), null);
FeedNodeEditController.setReference(re, getModuleConfiguration());
} else {
FeedNodeEditController.removeReference(getModuleConfiguration());
}
}
use of org.olat.repository.RepositoryEntryImportExport in project OpenOLAT by OpenOLAT.
the class AbstractFeedCourseNode method exportNode.
@Override
public void exportNode(File exportDirectory, ICourse course) {
RepositoryEntry re = getReferencedRepositoryEntry();
if (re == null)
return;
// build current export ZIP for feed learning resource
FeedManager.getInstance().getFeedArchive(re.getOlatResource());
// trigger resource file export
File fExportDirectory = new File(exportDirectory, getIdent());
fExportDirectory.mkdirs();
RepositoryEntryImportExport reie = new RepositoryEntryImportExport(re, fExportDirectory);
reie.exportDoExport();
}
use of org.olat.repository.RepositoryEntryImportExport 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());
}
}
use of org.olat.repository.RepositoryEntryImportExport in project OpenOLAT by OpenOLAT.
the class IQSELFCourseNode 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()) {
File file = rie.importGetExportedFile();
RepositoryHandler handlerQTI21 = RepositoryHandlerFactory.getInstance().getRepositoryHandler(ImsQTI21Resource.TYPE_NAME);
RepositoryEntry re;
if (handlerQTI21.acceptImport(file, "repo.zip").isValid()) {
re = handlerQTI21.importResource(owner, rie.getInitialAuthor(), rie.getDisplayName(), rie.getDescription(), false, locale, rie.importGetExportedFile(), null);
getModuleConfiguration().set(IQEditController.CONFIG_KEY_TYPE_QTI, IQEditController.CONFIG_VALUE_QTI21);
} else {
RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(TestFileResource.TYPE_NAME);
re = handler.importResource(owner, rie.getInitialAuthor(), rie.getDisplayName(), rie.getDescription(), false, locale, file, null);
}
IQEditController.setIQReference(re, getModuleConfiguration());
} else {
IQEditController.removeIQReference(getModuleConfiguration());
}
}
Aggregations