use of org.olat.repository.RepositoryEntryImportExport in project openolat by klemens.
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 klemens.
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 klemens.
the class CPCourseNode method exportNode.
@Override
public void exportNode(File exportDirectory, ICourse course) {
RepositoryEntry re = CPEditController.getCPReference(getModuleConfiguration(), false);
if (re == null)
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 VideoManagerImpl method getVideoExportMediaResource.
@Override
public VideoExportMediaResource getVideoExportMediaResource(RepositoryEntry repoEntry) {
OLATResource videoResource = repoEntry.getOlatResource();
OlatRootFolderImpl baseContainer = FileResourceManager.getInstance().getFileResourceRootImpl(videoResource);
// 1) dump repo entry metadata to resource folder
LocalFolderImpl repoentryContainer = (LocalFolderImpl) VFSManager.resolveOrCreateContainerFromPath(baseContainer, DIRNAME_REPOENTRY);
RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(repoEntry, repoentryContainer.getBasefile());
importExport.exportDoExportProperties();
// 2) package everything in resource folder to streaming zip resource
VideoExportMediaResource exportResource = new VideoExportMediaResource(baseContainer, repoEntry.getDisplayname());
return exportResource;
}
use of org.olat.repository.RepositoryEntryImportExport in project OpenOLAT by OpenOLAT.
the class VideoManagerImpl method importFromExportArchive.
@Override
public boolean importFromExportArchive(RepositoryEntry repoEntry, VFSLeaf exportArchive) {
OLATResource videoResource = repoEntry.getOlatResource();
// 1) unzip archive
VFSContainer baseContainer = FileResourceManager.getInstance().getFileResourceRootImpl(videoResource);
ZipUtil.unzip(exportArchive, baseContainer);
exportArchive.delete();
// 2) update metadata from the repo entry export
LocalFolderImpl repoentryContainer = (LocalFolderImpl) baseContainer.resolve(DIRNAME_REPOENTRY);
if (repoentryContainer != null) {
RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(repoentryContainer.getBasefile());
importExport.setRepoEntryPropertiesFromImport(repoEntry);
// now delete the import folder, not used anymore
repoentryContainer.delete();
}
// 3) Set poster image for repo entry
VFSContainer masterContainer = getMasterContainer(videoResource);
VFSLeaf posterImage = (VFSLeaf) masterContainer.resolve(FILENAME_POSTER_JPG);
if (posterImage != null) {
repositoryManager.setImage(posterImage, repoEntry);
}
return true;
}
Aggregations