use of org.talend.dq.indicators.ColumnSetIndicatorEvaluator in project tdq-studio-se by Talend.
the class ColumnSetAnalysisExecutor method runAnalysis.
/*
* (non-Jsdoc)
*
* @see org.talend.dq.analysis.AnalysisExecutor#runAnalysis(org.talend.dataquality.analysis.Analysis,
* java.lang.String)
*/
@Override
protected boolean runAnalysis(Analysis analysis, String sqlStatement) {
ColumnSetIndicatorEvaluator eval = createIndicatorEvaluator(analysis);
eval.setMonitor(getMonitor());
// --- add indicators
EList<Indicator> indicators = analysis.getResults().getIndicators();
for (Indicator indicator : indicators) {
if (ColumnsetPackage.eINSTANCE.getColumnSetMultiValueIndicator().isSuperTypeOf(indicator.eClass())) {
ColumnSetMultiValueIndicator colSetMultValIndicator = (ColumnSetMultiValueIndicator) indicator;
colSetMultValIndicator.prepare();
eval.storeIndicator(indicator.getName(), colSetMultValIndicator);
}
}
TypedReturnCode<java.sql.Connection> connection = null;
// MOD yyi 2011-02-22 17871:delimitefile
if (!isDelimitedFile) {
connection = initConnection(analysis, eval);
if (!connection.isOk()) {
return false;
}
}
// when to close connection
boolean closeAtTheEnd = true;
ReturnCode rc = eval.evaluateIndicators(sqlStatement, closeAtTheEnd);
// close connection
if (connection != null) {
if (POOLED_CONNECTION) {
// release the pooled connection
resetConnectionPool(analysis);
} else {
ConnectionUtils.closeConnection(connection.getObject());
}
}
if (!rc.isOk()) {
traceError(rc.getMessage());
}
if (getMonitor() != null) {
getMonitor().worked(compIndicatorsWorked);
}
return rc.isOk();
}
Aggregations