From 689f59fcbb446a858aadd98293dff9a6092ecc4f Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Fri, 14 Sep 2012 15:25:33 +0200
Subject: [PATCH] OO-343: export the solutions for task course building block

---
 .../org/olat/course/nodes/TACourseNode.java   | 20 +++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/olat/course/nodes/TACourseNode.java b/src/main/java/org/olat/course/nodes/TACourseNode.java
index 14d6d49d85c..a1f8d8d110c 100644
--- a/src/main/java/org/olat/course/nodes/TACourseNode.java
+++ b/src/main/java/org/olat/course/nodes/TACourseNode.java
@@ -707,11 +707,17 @@ public class TACourseNode extends GenericCourseNode implements AssessableCourseN
 	 */
 	@Override
 	public void exportNode(File fExportDirectory, ICourse course) {
-		// export only this taskfolder's tasks
-		File fTaskFolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(course, this));
-		File fNodeExportDir = new File(fExportDirectory, this.getIdent());
+		// export the tasks
+		File fTaskFolder = new File(FolderConfig.getCanonicalRoot(), TACourseNode.getTaskFolderPathRelToFolderRoot(course, this));
+		File fNodeExportDir = new File(fExportDirectory, getIdent());
 		fNodeExportDir.mkdirs();
 		FileUtils.copyDirContentsToDir(fTaskFolder, fNodeExportDir, false, "export task course node");
+		
+		//export thes solutions
+		File fSolutionDir = new File(FolderConfig.getCanonicalRoot(), TACourseNode.getFoldernodesPathRelToFolderBase(course.getCourseEnvironment()) + "/" + getIdent());
+		File fSolExportDir = new File(new File(fExportDirectory, "solutions"), getIdent());
+		fSolExportDir.mkdirs();
+		FileUtils.copyDirContentsToDir(fSolutionDir, fSolExportDir, false, "export task course node solutions");
 	}
 
 	/**
@@ -721,9 +727,15 @@ public class TACourseNode extends GenericCourseNode implements AssessableCourseN
 	 */
 	@Override
 	public Controller importNode(File importDirectory, ICourse course, boolean unattendedImport, UserRequest ureq, WindowControl wControl) {
-		File fNodeImportDir = new File(importDirectory, this.getIdent());
+		//import tasks
+		File fNodeImportDir = new File(importDirectory, getIdent());
 		File fTaskfolderDir = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(course, this));
 		FileUtils.copyDirContentsToDir(fNodeImportDir, fTaskfolderDir, false, "import task course node");
+	
+		File fSolutionDir = new File(FolderConfig.getCanonicalRoot(), TACourseNode.getFoldernodesPathRelToFolderBase(course.getCourseEnvironment()) + "/" + getIdent());
+		fSolutionDir.mkdirs();
+		File fSolImportDir = new File(new File(importDirectory, "solutions"), getIdent());
+		FileUtils.copyDirContentsToDir(fSolImportDir, fSolutionDir, false, "import task course node solutions");
 		return null;
 	}
 
-- 
GitLab