Skip to content
Snippets Groups Projects
CourseUpgrade.java 2.58 KiB
Newer Older
Alan Moran's avatar
Alan Moran committed
/**
srosse's avatar
srosse committed
 * <a href="http://www.openolat.org">
 * OpenOLAT - Online Learning and Training</a><br>
Alan Moran's avatar
Alan Moran committed
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); <br>
 * you may not use this file except in compliance with the License.<br>
srosse's avatar
srosse committed
 * You may obtain a copy of the License at the
 * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
Alan Moran's avatar
Alan Moran committed
 * <p>
 * Unless required by applicable law or agreed to in writing,<br>
srosse's avatar
srosse committed
 * software distributed under the License is distributed on an "AS IS" BASIS, <br>
Alan Moran's avatar
Alan Moran committed
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
 * See the License for the specific language governing permissions and <br>
 * limitations under the License.
 * <p>
srosse's avatar
srosse committed
 * Initial code contributed and copyrighted by<br>
 * frentix GmbH, http://www.frentix.com
Alan Moran's avatar
Alan Moran committed
 * <p>
 */
package org.olat.course;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import org.olat.core.gui.components.tree.TreeNode;
import org.olat.core.logging.LogDelegator;
import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper;
import org.olat.core.util.nodes.INode;
import org.olat.core.util.tree.TreeVisitor;
import org.olat.core.util.tree.Visitor;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.MSCourseNode;
import org.olat.course.nodes.TACourseNode;
import org.olat.course.tree.CourseEditorTreeModel;
import org.olat.modules.ModuleConfiguration;

/**
 * 
 * Description:<br>
 * Upgrade-Code for course
 * will check for up-to-date editorTreeModel or runStructure first.
 * 
 * <P>
 * Initial Date:  17.07.2009 <br>
 * @author Roman Haag, www.frentix.com, roman.haag@frentix.com,
 */
public class CourseUpgrade extends LogDelegator {
	private static final String MS_TYPE = "ms";

	public CourseUpgrade(){
		//
	}
	
	public void migrateCourse(ICourse course){
		PersistingCourseImpl ccourse = (PersistingCourseImpl) course;
		// only upgrade from version 1 => 2 
		// this will migrate wiki-syntax to html
		int migrateTargetVersion = 2;
		CourseEditorTreeModel editorTreeModel = course.getEditorTreeModel();
		if (!editorTreeModel.isVersionUpToDate() && editorTreeModel.getVersion() != migrateTargetVersion){
strentini's avatar
strentini committed
			logError("as of OpenOLAT 8, old courses with verison 1 are no longer supported. No migration done! Upgrade to 7.0 first!", null);
Alan Moran's avatar
Alan Moran committed
		}		
		Structure runStructure = course.getRunStructure();
		if (!runStructure.isVersionUpToDate() && runStructure.getVersion() != migrateTargetVersion){
strentini's avatar
strentini committed
			logError("as of OpenOLAT 8, old courses with verison 1 are no longer supported. No migration done! Upgrade to 7.0 first!", null);
strentini's avatar
strentini committed
	
Alan Moran's avatar
Alan Moran committed
}