Search in sources :

Example 31 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class TableAnalysisWizard method initCWMResourceBuilder.

@Override
public ModelElement initCWMResourceBuilder() {
    Analysis analysis = (Analysis) super.initCWMResourceBuilder();
    NamedColumnSet[] ncss = getNamedColumnSet();
    Connection tdp = getTdDataProvider();
    if (ncss != null && getAnalysisBuilder() != null) {
        List<Indicator> indicatorList = new ArrayList<Indicator>();
        WhereRule[] whereRules = getWhereRules(dqruleSelectPage.getCViewer().getCheckedElements());
        for (NamedColumnSet ncs : ncss) {
            // add RowCountIndicator
            RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
            DefinitionHandler.getInstance().setDefaultIndicatorDefinition(rowCountIndicator);
            rowCountIndicator.setAnalyzedElement(ncs);
            indicatorList.add(rowCountIndicator);
            // add user selected WhereRuleIndicator
            if (whereRules != null) {
                for (WhereRule whereRule : whereRules) {
                    WhereRuleIndicator[] compositeWhereRuleIndicator = DQRuleUtilities.createCompositeWhereRuleIndicator(ncs, whereRule);
                    indicatorList.addAll(Arrays.asList(compositeWhereRuleIndicator));
                }
            }
        }
        getAnalysisBuilder().addElementsToAnalyze(ncss, indicatorList.toArray(new Indicator[indicatorList.size()]));
        getAnalysisBuilder().setAnalysisConnection(tdp);
    }
    return analysis;
}
Also used : WhereRule(org.talend.dataquality.rules.WhereRule) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator) Analysis(org.talend.dataquality.analysis.Analysis) Connection(org.talend.core.model.metadata.builder.connection.Connection) ArrayList(java.util.ArrayList) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator)

Example 32 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class RowCountIndicatorsAdapter method storeSqlResults.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.indicators.impl.IndicatorImpl#storeSqlResults(java.util.List)
     */
@Override
public boolean storeSqlResults(List<Object[]> objects) {
    int index = 0;
    for (RowCountIndicator rci : this.rowCountIndiSet) {
        rci.storeSqlResults(objects);
        index++;
    }
    if (index == 0 || index != rowCountIndiSet.size()) {
        return false;
    }
    return super.storeSqlResults(objects);
}
Also used : RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator)

Example 33 with RowCountIndicator

use of org.talend.dataquality.indicators.RowCountIndicator in project tdq-studio-se by Talend.

the class RowCountIndicatorsAdapter method setInstantiatedExpression.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.indicators.impl.IndicatorImpl#setInstantiatedExpression(orgomg.cwm.objectmodel.core.Expression)
     */
@Override
public boolean setInstantiatedExpression(Expression expression) {
    int index = 0;
    for (RowCountIndicator rci : this.rowCountIndiSet) {
        TdExpression copySqlExpression = BooleanExpressionHelper.createTdExpression(expression.getLanguage(), expression.getBody());
        rci.setInstantiatedExpression(copySqlExpression);
        index++;
    }
    if (index == 0 || index != rowCountIndiSet.size()) {
        return false;
    }
    return super.setInstantiatedExpression(expression);
}
Also used : TdExpression(org.talend.cwm.relational.TdExpression) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator)

Aggregations

RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)33 Indicator (org.talend.dataquality.indicators.Indicator)12 Test (org.junit.Test)11 NullCountIndicator (org.talend.dataquality.indicators.NullCountIndicator)10 DuplicateCountIndicator (org.talend.dataquality.indicators.DuplicateCountIndicator)9 ArrayList (java.util.ArrayList)8 DistinctCountIndicator (org.talend.dataquality.indicators.DistinctCountIndicator)7 UniqueCountIndicator (org.talend.dataquality.indicators.UniqueCountIndicator)7 PersistenceException (org.talend.commons.exception.PersistenceException)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)6 TDQIndicatorDefinitionItem (org.talend.dataquality.properties.TDQIndicatorDefinitionItem)6 List (java.util.List)5 AverageLengthIndicator (org.talend.dataquality.indicators.AverageLengthIndicator)5 BlankCountIndicator (org.talend.dataquality.indicators.BlankCountIndicator)5 TdColumn (org.talend.cwm.relational.TdColumn)4 DefValueCountIndicator (org.talend.dataquality.indicators.DefValueCountIndicator)4 InvalidRegCodeCountIndicator (org.talend.dataquality.indicators.InvalidRegCodeCountIndicator)4 MaxLengthIndicator (org.talend.dataquality.indicators.MaxLengthIndicator)4 MaxValueIndicator (org.talend.dataquality.indicators.MaxValueIndicator)4 MeanIndicator (org.talend.dataquality.indicators.MeanIndicator)4