Search in sources :

Example 36 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class TableDynamicChartEventReceiver method handle.

@Override
public boolean handle(Object value) {
    if (value == null) {
        return false;
    }
    if (IndicatorEnum.RowCountIndicatorEnum.equals(this.getIndicatorType())) {
        super.handle(value);
    } else {
        Long count = getIndicator().getCount();
        double valueMatch = WhereRuleStatisticsStateUtil.getMatchValue(value);
        double valueNotmatch = WhereRuleStatisticsStateUtil.getNotMatchValue(value, valueMatch, count);
        if (dataset != null) {
            TOPChartUtils.getInstance().setValue(dataset, valueNotmatch, WhereRuleStatisticsStateTable.ROW_KEY_NOT_PASS, indicatorName);
            TOPChartUtils.getInstance().setValue(dataset, valueMatch, WhereRuleStatisticsStateTable.ROW_KEY_PASS, indicatorName);
        }
        if (tableViewer != null) {
            TableWithData input = (TableWithData) tableViewer.getInput();
            if (input != null) {
                ChartDataEntity[] dataEntities = input.getEnity();
                ((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumMatch(String.valueOf(valueMatch));
                ((WhereRuleChartDataEntity) dataEntities[this.getEntityIndex()]).setNumNoMatch(String.valueOf(valueNotmatch));
                tableViewer.getTable().clearAll();
                tableViewer.setInput(input);
            }
        }
    }
    return true;
}
Also used : WhereRuleChartDataEntity(org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) WhereRuleChartDataEntity(org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity)

Example 37 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class FrequencyTableState method getDataEntity.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
     */
@Override
public ChartDataEntity[] getDataEntity() {
    List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
    boolean withRowCountIndicator = isWithRowCountIndicator();
    for (IndicatorUnit unit : units) {
        if (unit.isExcuted()) {
            FrequencyExt[] frequencyExt = (FrequencyExt[]) unit.getValue();
            sortIndicator(frequencyExt);
            int numOfShown = FrequencyTypeStateUtil.getNumberOfShown(unit, frequencyExt);
            for (int i = 0; i < numOfShown; i++) {
                FrequencyExt freqExt = frequencyExt[i];
                String keyLabel = FrequencyTypeStateUtil.getKeyLabel(freqExt, 30);
                dataEnities.add(FrequencyTypeStateUtil.createChartEntity(unit.getIndicator(), freqExt, keyLabel, withRowCountIndicator));
            }
        } else {
        // TDQ-11422: before analysis run turn to Analysis Results page, there should show nothing data
        // dataEnities.add(FrequencyTypeStateUtil.createChartEntity(unit.getIndicator(), null, null, false));
        }
    }
    return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
Also used : ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) FrequencyExt(org.talend.dq.indicators.ext.FrequencyExt)

Example 38 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class ModeStatisticsTableState method getDataEntity.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
     */
@Override
public ChartDataEntity[] getDataEntity() {
    List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
    for (IndicatorUnit unit : units) {
        ChartDataEntity entity = ModeStatisticsStateUtil.createDataEntity(unit, unit.getIndicatorName());
        dataEnities.add(entity);
    }
    return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
Also used : ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 39 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class SimpleRuleStatisticsTableState method getDataEntity.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
     */
@Override
public ChartDataEntity[] getDataEntity() {
    TableIndicatorUnit rownCountUnit = WhereRuleStatisticsStateUtil.getRownCountUnit(tableunits);
    List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
    if (rownCountUnit != null) {
        String value = CommonStateUtil.getUnitValue(rownCountUnit.getValue(), StringFormatUtil.DOUBLE_NUMBER);
        String label = rownCountUnit.getIndicatorName();
        ChartDataEntity createDataEntity = CommonStateUtil.createDataEntity(rownCountUnit, value, label);
        dataEnities.add(createDataEntity);
    }
    return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
Also used : ArrayList(java.util.ArrayList) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 40 with ChartDataEntity

use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.

the class WhereRuleStatisticsTableState method getDataEntityOfRowCount.

/**
 * DOC xqliu Comment method "getDataEntityRowCount".
 *
 * @return
 */
public ChartDataEntity[] getDataEntityOfRowCount() {
    TableIndicatorUnit rownCountUnit = WhereRuleStatisticsStateUtil.getRownCountUnit(tableunits);
    List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
    if (rownCountUnit != null) {
        // final Object unitValue = rownCountUnit.getValue();
        // unitValue != null ?Double.parseDouble(unitValue.toString()): Double.NaN;
        String value = CommonStateUtil.getUnitValue(rownCountUnit.getValue(), StringFormatUtil.DOUBLE_NUMBER);
        String label = rownCountUnit.getIndicatorName();
        ChartDataEntity createDataEntity = CommonStateUtil.createDataEntity(rownCountUnit, value, label);
        dataEnities.add(createDataEntity);
    }
    return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
Also used : ArrayList(java.util.ArrayList) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) WhereRuleChartDataEntity(org.talend.dq.indicators.preview.table.WhereRuleChartDataEntity)

Aggregations

ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)61 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)17 ArrayList (java.util.ArrayList)16 Test (org.junit.Test)13 TdColumn (org.talend.cwm.relational.TdColumn)13 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)12 Analysis (org.talend.dataquality.analysis.Analysis)11 IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)10 TdTable (org.talend.cwm.relational.TdTable)9 TdExpression (org.talend.cwm.relational.TdExpression)8 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)8 FrequencyExt (org.talend.dq.indicators.ext.FrequencyExt)8 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)7 TableWithData (org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData)7 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)6 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)6 Expression (orgomg.cwm.objectmodel.core.Expression)6 Domain (org.talend.dataquality.domain.Domain)5 Pattern (org.talend.dataquality.domain.pattern.Pattern)5 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)5