Search in sources :

Example 6 with SolutionList

use of org.olat.course.nodes.gta.model.SolutionList in project openolat by klemens.

the class ConvertToGTACourseNode method copySolutions.

private void copySolutions(TACourseNode sourceNode, GTACourseNode gtaNode, CourseEnvironment courseEnv) {
    ModuleConfiguration gtaConfig = gtaNode.getModuleConfiguration();
    String solutionPath = SolutionController.getSolutionPathRelToFolderRoot(courseEnv, sourceNode);
    OlatRootFolderImpl solutionContainer = new OlatRootFolderImpl(solutionPath, null);
    VFSContainer solutionDirectory = gtaManager.getSolutionsContainer(courseEnv, gtaNode);
    SolutionList solutionList = new SolutionList();
    for (VFSItem solution : solutionContainer.getItems()) {
        if (solution instanceof VFSLeaf) {
            VFSLeaf solutionDocument = solutionDirectory.createChildLeaf(solution.getName());
            VFSManager.copyContent((VFSLeaf) solution, solutionDocument);
            Solution solDef = new Solution();
            convertMetada(solutionContainer, solutionDirectory, solution.getName(), null, solDef);
            solDef.setFilename(solution.getName());
            solutionList.getSolutions().add(solDef);
        }
    }
    gtaConfig.set(GTACourseNode.GTASK_SOLUTIONS, solutionList);
}
Also used : SolutionList(org.olat.course.nodes.gta.model.SolutionList) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) ModuleConfiguration(org.olat.modules.ModuleConfiguration) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) Solution(org.olat.course.nodes.gta.model.Solution)

Aggregations

SolutionList (org.olat.course.nodes.gta.model.SolutionList)6 Path (java.nio.file.Path)4 Solution (org.olat.course.nodes.gta.model.Solution)4 ModuleConfiguration (org.olat.modules.ModuleConfiguration)4 ArrayList (java.util.ArrayList)2 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 VFSItem (org.olat.core.util.vfs.VFSItem)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2