Search in sources :

Example 1 with ScormMainManager

use of org.olat.modules.scorm.ScormMainManager in project openolat by klemens.

the class SCORMCPHandler method copy.

@Override
public RepositoryEntry copy(Identity author, RepositoryEntry source, RepositoryEntry target) {
    final ScormMainManager scormManager = ScormMainManager.getInstance();
    OLATResource sourceResource = source.getOlatResource();
    OLATResource targetResource = target.getOlatResource();
    File sourceFileroot = FileResourceManager.getInstance().getFileResourceRootImpl(sourceResource).getBasefile();
    File zipRoot = new File(sourceFileroot, FileResourceManager.ZIPDIR);
    File targetFileroot = FileResourceManager.getInstance().getFileResourceRootImpl(targetResource).getBasefile();
    FileUtils.copyFileToDir(zipRoot, targetFileroot, "add file resource");
    // copy packaging info
    ScormPackageConfig scormConfig = scormManager.getScormPackageConfig(sourceResource);
    if (scormConfig != null) {
        scormManager.setScormPackageConfig(targetResource, scormConfig);
    }
    return target;
}
Also used : ScormMainManager(org.olat.modules.scorm.ScormMainManager) ScormPackageConfig(org.olat.modules.scorm.ScormPackageConfig) OLATResource(org.olat.resource.OLATResource) File(java.io.File)

Example 2 with ScormMainManager

use of org.olat.modules.scorm.ScormMainManager in project OpenOLAT by OpenOLAT.

the class SCORMCPHandler method copy.

@Override
public RepositoryEntry copy(Identity author, RepositoryEntry source, RepositoryEntry target) {
    final ScormMainManager scormManager = ScormMainManager.getInstance();
    OLATResource sourceResource = source.getOlatResource();
    OLATResource targetResource = target.getOlatResource();
    File sourceFileroot = FileResourceManager.getInstance().getFileResourceRootImpl(sourceResource).getBasefile();
    File zipRoot = new File(sourceFileroot, FileResourceManager.ZIPDIR);
    File targetFileroot = FileResourceManager.getInstance().getFileResourceRootImpl(targetResource).getBasefile();
    FileUtils.copyFileToDir(zipRoot, targetFileroot, "add file resource");
    // copy packaging info
    ScormPackageConfig scormConfig = scormManager.getScormPackageConfig(sourceResource);
    if (scormConfig != null) {
        scormManager.setScormPackageConfig(targetResource, scormConfig);
    }
    return target;
}
Also used : ScormMainManager(org.olat.modules.scorm.ScormMainManager) ScormPackageConfig(org.olat.modules.scorm.ScormPackageConfig) OLATResource(org.olat.resource.OLATResource) File(java.io.File)

Aggregations

File (java.io.File)2 ScormMainManager (org.olat.modules.scorm.ScormMainManager)2 ScormPackageConfig (org.olat.modules.scorm.ScormPackageConfig)2 OLATResource (org.olat.resource.OLATResource)2