use of org.talend.dataprofiler.migration.IMigrationTask in project tdq-studio-se by Talend.
the class FileSystemImportWriter method migration.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.imex.model.IImexWriter#migration(org.eclipse.core.runtime.IProgressMonitor)
*/
public void migration(IProgressMonitor monitor) {
List<IMigrationTask> modelTasks = new ArrayList<IMigrationTask>();
if (versionFile != null && versionFile.exists()) {
ProductVersion version = WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
MigrationTaskManager manager = new MigrationTaskManager(version, MigrationTaskType.FILE);
List<IMigrationTask> taskList = manager.getValidTasks();
if (!taskList.isEmpty()) {
for (IMigrationTask task : taskList) {
if (task.isModelTask()) {
((AbstractWorksapceUpdateTask) task).setWorkspacePath(basePath);
modelTasks.add(task);
} else {
// MOD msjian TDQ-7365 2013-5-27: only added the not inclued tasks
if (!commTasks.contains(task)) {
commTasks.add(task);
}
// TDQ-7365~
}
}
}
}
if (!modelTasks.isEmpty()) {
MigrationTaskManager.doMigrationTask(modelTasks, monitor);
}
}
use of org.talend.dataprofiler.migration.IMigrationTask in project tdq-studio-se by Talend.
the class MigrationTaskManager method doMigrationTask.
/**
* DOC bZhou Comment method "doMigrationTask".
*
* @param tasks
* @param monitor
*/
public static void doMigrationTask(List<IMigrationTask> tasks, IProgressMonitor monitor) {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
// $NON-NLS-1$
monitor.beginTask("Migration...", tasks.size());
for (IMigrationTask task : tasks) {
if (monitor.isCanceled()) {
break;
}
monitor.subTask(task.getName());
if (task.valid()) {
if (!task.execute()) {
// $NON-NLS-1$
log.error("Migration Task failed: " + task.getName());
} else {
if (log.isInfoEnabled()) {
// $NON-NLS-1$
log.info("Migration Task success: " + task.getId());
}
}
}
monitor.worked(1);
}
monitor.done();
}
use of org.talend.dataprofiler.migration.IMigrationTask in project tdq-studio-se by Talend.
the class MigrationTaskManagerWithoutUI method getWorksapceTasks.
/**
* DOC bZhou Comment method "getWorksapceTasks".
*
* @param wVersion
*
* @return
*/
public List<IMigrationTask> getWorksapceTasks() {
List<IMigrationTask> validTasks = getValidTasks(workspaceVersion, currentVersion, allMigrationTask);
Iterator<IMigrationTask> it = validTasks.iterator();
while (it.hasNext()) {
IMigrationTask task = it.next();
if (task.getMigrationTaskType() == MigrationTaskType.DATABASE) {
it.remove();
}
}
List<IMigrationTask> resortList = new ArrayList<IMigrationTask>();
for (IMigrationTask task : validTasks) {
if (task.isModelTask()) {
resortList.add(task);
}
}
for (IMigrationTask task : validTasks) {
if (!task.isModelTask()) {
resortList.add(task);
}
}
return resortList;
}
use of org.talend.dataprofiler.migration.IMigrationTask in project tdq-studio-se by Talend.
the class MigrationTaskManagerWithoutUI method getValidTasks.
/**
* DOC bZhou Comment method "getValidTasks".
*
* @param workspaceVersion
* @param currentVersion
* @param tasks
* @return
*/
public static List<IMigrationTask> getValidTasks(ProductVersion workspaceVersion, ProductVersion currentVersion, List<IMigrationTask> tasks) {
List<IMigrationTask> validTasks = new ArrayList<IMigrationTask>();
for (IMigrationTask task : tasks) {
if (task.getTaskCategory() == MigrationTaskCategory.WORKSPACE) {
IWorkspaceMigrationTask wTask = (IWorkspaceMigrationTask) task;
ProductVersion taskVersion = ProductVersion.fromString(wTask.getVersion());
if (taskVersion.compareTo(workspaceVersion) > 0 && taskVersion.compareTo(currentVersion) <= 0) {
validTasks.add(task);
}
}
if (task.getTaskCategory() == MigrationTaskCategory.PROJECT) {
validTasks.add(task);
}
}
return validTasks;
}
Aggregations