use of org.talend.utils.ProductVersion 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;
}
use of org.talend.utils.ProductVersion in project tdq-studio-se by Talend.
the class DbmsLanguageFactory method createDbmsLanguage.
/**
* Method "createDbmsLanguage".
*
* @param dbmsSubtype
* @return the appropriate DbmsLanguage
*/
public static DbmsLanguage createDbmsLanguage(String dbmsSubtype, String databaseVersion) {
// TODO find an appropriate place to set the database version (e.g for hive embedded)
String dbVersionStr = databaseVersion;
if (dbVersionStr == null) {
// $NON-NLS-1$
dbVersionStr = "0.0.0";
}
ProductVersion dbVersion = ProductVersion.fromString(dbVersionStr, true);
DbmsLanguage dbmsLanguage = null;
if (isMySQL(dbmsSubtype)) {
dbmsLanguage = new MySQLDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isOracle(dbmsSubtype)) {
dbmsLanguage = new OracleDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isDB2(dbmsSubtype)) {
dbmsLanguage = new DB2DbmsLanguage(dbmsSubtype, dbVersion);
} else if (isAS400(dbmsSubtype)) {
dbmsLanguage = new AS400DbmsLanguage(dbmsSubtype, dbVersion);
} else if (isMSSQL(dbmsSubtype)) {
dbmsLanguage = new MSSqlDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isPostgresql(dbmsSubtype)) {
dbmsLanguage = new PostgresqlDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isRedshift(dbmsSubtype)) {
dbmsLanguage = new RedshiftDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isExasol(dbmsSubtype)) {
dbmsLanguage = new ExasolDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isSybase(dbmsSubtype)) {
dbmsLanguage = new SybaseASEDbmsLanguage(dbVersion);
} else if (isSQLite(dbmsSubtype)) {
dbmsLanguage = new SQLiteDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isTeradata(dbmsSubtype)) {
dbmsLanguage = new TeradataDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isIngres(dbmsSubtype)) {
dbmsLanguage = new IngresDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isDelimitedFile(dbmsSubtype)) {
dbmsLanguage = new DelimitedFileLanguage(dbmsSubtype, dbVersion);
} else if (isInfomix(dbmsSubtype)) {
// MOD zshen fixed bug 11005: SQL syntax error for all analysis on Informix databases in Talend Open
// Profiler
dbmsLanguage = new InfomixDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isHive(dbmsSubtype) || isImpala(dbmsSubtype)) {
dbmsLanguage = new HiveDbmsLanguage(DbmsLanguage.HIVE, dbVersion);
} else if (isVertica(dbmsSubtype)) {
dbmsLanguage = new VerticaDbmsLanguage(dbmsSubtype, dbVersion);
} else if (isNetezza(dbmsSubtype)) {
dbmsLanguage = new NetezzaDbmsLanguage(dbmsSubtype, dbVersion);
} else {
dbmsLanguage = new DbmsLanguage(dbmsSubtype, dbVersion);
}
if (PluginConstant.EMPTY_STRING.equals(dbmsLanguage.getDbQuoteString())) {
dbmsLanguage.setDbQuoteString(dbmsLanguage.getHardCodedQuoteIdentifier());
}
return dbmsLanguage;
}
use of org.talend.utils.ProductVersion in project tdq-studio-se by Talend.
the class DbmsLanguageTest method testGetSqlExpressionDB2Case5.
/**
* Test method for
* {@link org.talend.dq.dbms.DbmsLanguage#getSqlExpression(IndicatorDefinition, String, EList, ProductVersion)} .
*/
@Test
public void testGetSqlExpressionDB2Case5() {
// $NON-NLS-1$
String sqlLang = "SQL";
// $NON-NLS-1$
String sqlBody = "SQL body";
// $NON-NLS-1$
String db2Lang = "DB2";
// $NON-NLS-1$
String db2Body = "DB2 body";
// $NON-NLS-1$
String db2NTLang = "DB2/NT";
// $NON-NLS-1$
String db2NTBody = "DB2/NT body";
IndicatorDefinition indicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
// $NON-NLS-1$
String language = "unknown";
EList<TdExpression> sqlGenericExpression = new BasicEList<TdExpression>();
TdExpression tdExpression1 = RelationalFactory.eINSTANCE.createTdExpression();
tdExpression1.setLanguage(sqlLang);
tdExpression1.setBody(sqlBody);
sqlGenericExpression.add(tdExpression1);
TdExpression tdExpression2 = RelationalFactory.eINSTANCE.createTdExpression();
tdExpression2.setLanguage(db2Lang);
tdExpression2.setBody(db2Body);
sqlGenericExpression.add(tdExpression2);
TdExpression tdExpression3 = RelationalFactory.eINSTANCE.createTdExpression();
tdExpression3.setLanguage(db2NTLang);
tdExpression3.setBody(db2NTBody);
sqlGenericExpression.add(tdExpression3);
ProductVersion dbVersion = new ProductVersion(1, 0);
TdExpression sqlExpression = DbmsLanguage.getSqlExpression(indicatorDefinition, language, sqlGenericExpression, dbVersion);
Assert.assertEquals(tdExpression1, sqlExpression);
}
use of org.talend.utils.ProductVersion in project tdq-studio-se by Talend.
the class DbmsLanguageTest method testGetSqlExpressionDB2Case3.
/**
* Test method for
* {@link org.talend.dq.dbms.DbmsLanguage#getSqlExpression(IndicatorDefinition, String, EList, ProductVersion)} .
*/
@Test
public void testGetSqlExpressionDB2Case3() {
// $NON-NLS-1$
String sqlLang = "SQL";
// $NON-NLS-1$
String sqlBody = "SQL body";
// $NON-NLS-1$
String db2Lang = "DB2";
// $NON-NLS-1$
String db2Body = "DB2 body";
// $NON-NLS-1$
String db2NTLang = "DB2/NT";
IndicatorDefinition indicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
String language = db2NTLang;
EList<TdExpression> sqlGenericExpression = new BasicEList<TdExpression>();
TdExpression tdExpression1 = RelationalFactory.eINSTANCE.createTdExpression();
tdExpression1.setLanguage(sqlLang);
tdExpression1.setBody(sqlBody);
sqlGenericExpression.add(tdExpression1);
TdExpression tdExpression2 = RelationalFactory.eINSTANCE.createTdExpression();
tdExpression2.setLanguage(db2Lang);
tdExpression2.setBody(db2Body);
sqlGenericExpression.add(tdExpression2);
ProductVersion dbVersion = new ProductVersion(1, 0);
TdExpression sqlExpression = DbmsLanguage.getSqlExpression(indicatorDefinition, language, sqlGenericExpression, dbVersion);
Assert.assertEquals(tdExpression2, sqlExpression);
}
use of org.talend.utils.ProductVersion in project tdq-studio-se by Talend.
the class DQStructureManager method isNeedMigration.
/**
* DOC bZhou Comment method "isNeedMigration".
*
* @return
*/
public boolean isNeedMigration() {
if (isSecludedVersion()) {
return true;
}
ProductVersion wVersion = WorkspaceVersionHelper.getVesion();
ProductVersion cVersion = CorePlugin.getDefault().getProductVersion();
return wVersion.compareTo(cVersion) < 0;
}
Aggregations