use of org.olat.core.gui.media.CleanupAfterDeliveryFileMediaResource in project OpenOLAT by OpenOLAT.
the class CourseHandler method getAsMediaResource.
@Override
public MediaResource getAsMediaResource(OLATResourceable res, boolean backwardsCompatible) {
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(res, true);
String exportFileName = StringHelper.transformDisplayNameToFileSystemName(re.getDisplayname()) + ".zip";
File fExportZIP = new File(WebappHelper.getTmpDir(), exportFileName);
CourseFactory.exportCourseToZIP(res, fExportZIP, false, backwardsCompatible);
return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
}
use of org.olat.core.gui.media.CleanupAfterDeliveryFileMediaResource in project openolat by klemens.
the class CourseHandler method getAsMediaResource.
@Override
public MediaResource getAsMediaResource(OLATResourceable res, boolean backwardsCompatible) {
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(res, true);
String exportFileName = StringHelper.transformDisplayNameToFileSystemName(re.getDisplayname()) + ".zip";
File fExportZIP = new File(WebappHelper.getTmpDir(), exportFileName);
CourseFactory.exportCourseToZIP(res, fExportZIP, false, backwardsCompatible);
return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
}
use of org.olat.core.gui.media.CleanupAfterDeliveryFileMediaResource in project OpenOLAT by OpenOLAT.
the class SharedFolderManager method getAsMediaResource.
public MediaResource getAsMediaResource(OLATResourceable res) {
String exportFileName = res.getResourceableId() + ".zip";
File fExportZIP = new File(WebappHelper.getTmpDir() + "/" + exportFileName);
VFSContainer sharedFolder = getSharedFolder(res);
// OLAT-5368: do intermediate commit to avoid transaction timeout
// discussion intermediatecommit vs increased transaction timeout:
// pro intermediatecommit: not much
// pro increased transaction timeout: would fix OLAT-5368 but only move the problem
// @TODO OLAT-2597: real solution is a long-running background-task concept...
DBFactory.getInstance().intermediateCommit();
ZipUtil.zip(sharedFolder.getItems(), new LocalFileImpl(fExportZIP), false);
return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
}
use of org.olat.core.gui.media.CleanupAfterDeliveryFileMediaResource in project OpenOLAT by OpenOLAT.
the class GlossaryManagerImpl method getAsMediaResource.
/**
* Export the glossary as a media resource. The resource name is set to the
* resources display name
*
* @param res
* @return
*/
@Override
public MediaResource getAsMediaResource(OLATResourceable res) {
RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(res, false);
String exportFileName = repoEntry.getDisplayname();
// OO-135 check for special / illegal chars in filename
exportFileName = StringHelper.transformDisplayNameToFileSystemName(exportFileName);
try {
File tmpDir = new File(WebappHelper.getTmpDir());
File fExportZIP = File.createTempFile(exportFileName, ".zip", tmpDir);
VFSContainer glossaryRoot = getGlossaryRootFolder(res);
ZipUtil.zip(glossaryRoot.getItems(), new LocalFileImpl(fExportZIP), false);
return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
} catch (IOException e) {
logError("Cannot export glossar: " + res, e);
return null;
}
}
use of org.olat.core.gui.media.CleanupAfterDeliveryFileMediaResource in project openolat by klemens.
the class SharedFolderManager method getAsMediaResource.
public MediaResource getAsMediaResource(OLATResourceable res) {
String exportFileName = res.getResourceableId() + ".zip";
File fExportZIP = new File(WebappHelper.getTmpDir() + "/" + exportFileName);
VFSContainer sharedFolder = getSharedFolder(res);
// OLAT-5368: do intermediate commit to avoid transaction timeout
// discussion intermediatecommit vs increased transaction timeout:
// pro intermediatecommit: not much
// pro increased transaction timeout: would fix OLAT-5368 but only move the problem
// @TODO OLAT-2597: real solution is a long-running background-task concept...
DBFactory.getInstance().intermediateCommit();
ZipUtil.zip(sharedFolder.getItems(), new LocalFileImpl(fExportZIP), false);
return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
}
Aggregations