Search in sources :

Example 1 with DelimitedFileIndicatorEvaluator

use of org.talend.dq.indicators.DelimitedFileIndicatorEvaluator in project tdq-studio-se by Talend.

the class DelimitedFileAnalysisExecutor method runAnalysis.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dq.analysis.AnalysisExecutor#runAnalysis(org.talend.dataquality.analysis.Analysis,
     * java.lang.String)
     */
@Override
protected boolean runAnalysis(Analysis analysis, String sqlStatement) {
    DelimitedFileIndicatorEvaluator eval = createIndicatorEvaluator(analysis);
    DelimitedFileConnection con = (DelimitedFileConnection) analysis.getContext().getConnection();
    EList<Indicator> indicators = analysis.getResults().getIndicators();
    eval.setMonitor(getMonitor());
    RowCountIndicatorsAdapter.getInstance().clear();
    for (Indicator indicator : indicators) {
        assert indicator != null;
        MetadataColumn mColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(indicator.getAnalyzedElement());
        if (mColumn == null) {
            continue;
        }
        String columnName = mColumn.getLabel();
        eval.storeIndicator(columnName, indicator);
    }
    eval.setDelimitedFileconnection(con);
    ReturnCode rc = eval.evaluateIndicators(sqlStatement, true);
    if (!rc.isOk()) {
        log.warn(rc.getMessage());
        setError(rc.getMessage());
    }
    if (getMonitor() != null) {
        getMonitor().worked(compIndicatorsWorked);
    }
    return rc.isOk();
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ReturnCode(org.talend.utils.sugars.ReturnCode) DelimitedFileIndicatorEvaluator(org.talend.dq.indicators.DelimitedFileIndicatorEvaluator) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) Indicator(org.talend.dataquality.indicators.Indicator)

Aggregations

DelimitedFileConnection (org.talend.core.model.metadata.builder.connection.DelimitedFileConnection)1 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)1 Indicator (org.talend.dataquality.indicators.Indicator)1 DelimitedFileIndicatorEvaluator (org.talend.dq.indicators.DelimitedFileIndicatorEvaluator)1 ReturnCode (org.talend.utils.sugars.ReturnCode)1