Search in sources :

Example 1 with IWorkspaceMigrationTask

use of org.talend.dataprofiler.migration.IWorkspaceMigrationTask 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;
}
Also used : ArrayList(java.util.ArrayList) IMigrationTask(org.talend.dataprofiler.migration.IMigrationTask) IWorkspaceMigrationTask(org.talend.dataprofiler.migration.IWorkspaceMigrationTask) ProductVersion(org.talend.utils.ProductVersion)

Aggregations

ArrayList (java.util.ArrayList)1 IMigrationTask (org.talend.dataprofiler.migration.IMigrationTask)1 IWorkspaceMigrationTask (org.talend.dataprofiler.migration.IWorkspaceMigrationTask)1 ProductVersion (org.talend.utils.ProductVersion)1