use of org.talend.dataquality.indicators.schema.SchemaIndicator in project tdq-studio-se by Talend.
the class AnalysisFilterWizard method addSchemaIndicator.
protected void addSchemaIndicator(List<Schema> tdSchemas, CatalogIndicator catalogIndicator) {
for (Schema schema : tdSchemas) {
SchemaIndicator createSchemaIndicator = SchemaFactory.eINSTANCE.createSchemaIndicator();
// MOD xqliu 2009-1-21 feature 4715
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createSchemaIndicator);
createSchemaIndicator.setAnalyzedElement(schema);
catalogIndicator.addSchemaIndicator(createSchemaIndicator);
}
}
use of org.talend.dataquality.indicators.schema.SchemaIndicator in project tdq-studio-se by Talend.
the class SchemaEvaluator method executeSqlQuery.
@Override
protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
ReturnCode ok = new ReturnCode(true);
// --- preconditions
DataProvider dataProvider = this.getDataManager();
if (this.elementToIndicators.values().isEmpty()) {
// $NON-NLS-1$
String msg = Messages.getString("Evaluator.NoInidcator1");
log.error(msg);
ok.setReturnCode(msg, false);
return ok;
}
Indicator[] indics = this.getAllIndicators();
if (indics.length == 0) {
// $NON-NLS-1$
String msg = Messages.getString("Evaluator.NoInidcator2", dataProvider);
log.error(msg);
ok.setReturnCode(msg, false);
return ok;
}
for (Indicator indicator : indics) {
SchemaIndicator schemaIndicator = DataqualitySwitchHelper.SCHEMA_SWITCH.doSwitch(indicator);
if (schemaIndicator == null) {
continue;
}
Schema schema = (Schema) schemaIndicator.getAnalyzedElement();
String catName = schema.getName();
// MOD yyi 2009-11-30 10187
if (!checkSchema(schema)) {
// $NON-NLS-1$
ok.setReturnCode(Messages.getString("Evaluator.schemaNotExist", catName), false);
return ok;
}
// ~
// ADD xqliu 2010-01-06 bug 10919
EObject container = schema.eContainer();
if (container != null) {
Catalog catalog = SwitchHelpers.CATALOG_SWITCH.doSwitch(container);
if (catalog != null) {
catName = catalog.getName();
// MOD gdbu 2011-4-21 bug : 20578
if (!ConnectionUtils.isOdbcProgress(connection) && !ConnectionUtils.isOdbcOracle(connection) && StringUtils.isNotEmpty(catName) && dbms().supportCatalogSelection()) {
connection.setCatalog(catName);
}
// ~20578
}
}
// ~
evalSchemaIndicLow(null, schemaIndicator, null, schema, ok);
}
return ok;
}
Aggregations