Search in sources :

Example 26 with ChartDataEntity

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

the class DateFrequencyStateUtil method createDataEntity.

public static ChartDataEntity createDataEntity(IndicatorUnit unit, FrequencyExt freqExt, String keyLabel) {
    ChartDataEntity entity = new ChartDataEntity();
    entity.setIndicator(unit.getIndicator());
    entity.setKey(freqExt == null ? null : freqExt.getKey());
    entity.setLabelNull(freqExt == null || freqExt.getKey() == null);
    entity.setLabel(keyLabel);
    entity.setValue(String.valueOf(freqExt == null ? StringUtils.EMPTY : freqExt.getValue()));
    if (freqExt == null) {
        entity.setPercent(0.0);
    } else {
        entity.setPercent(freqExt.getFrequency());
    }
    return entity;
}
Also used : ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 27 with ChartDataEntity

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

the class DateFrequencyStateUtil method getDataEntity.

public static ChartDataEntity[] getDataEntity(List<IndicatorUnit> units, int sortType) {
    List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
    for (IndicatorUnit unit : units) {
        if (unit.isExcuted()) {
            FrequencyExt[] frequencyExt = (FrequencyExt[]) unit.getValue();
            ComparatorsFactory.sort(frequencyExt, sortType);
            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(DateFrequencyStateUtil.createDataEntity(unit, freqExt, keyLabel));
            }
        }
    }
    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 28 with ChartDataEntity

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

the class PatternStatisticsTableState 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) {
        PatternMatchingExt patternExt = PatternStatisticeStateUtil.getUnitValue(unit.getIndicator(), unit.getValue());
        String notMathCount = PatternStatisticeStateUtil.getNotMatchCount(patternExt);
        String machCount = PatternStatisticeStateUtil.getMatchCount(patternExt);
        PatternChartDataEntity patternEntity = PatternStatisticeStateUtil.createDataEntity(unit, unit.getIndicator().getName(), notMathCount, machCount);
        dataEnities.add(patternEntity);
    }
    return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
Also used : PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt) PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

Example 29 with ChartDataEntity

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

the class FrequencyDynamicChartEventReceiver method setFrequecyToDataset.

private void setFrequecyToDataset(Object customerdataset, FrequencyExt[] frequencyExt, Indicator indicator) {
    int numOfShown = frequencyExt.length;
    IndicatorParameters parameters = indicator.getParameters();
    if (parameters != null) {
        if (parameters.getTopN() < numOfShown) {
            numOfShown = parameters.getTopN();
        }
    }
    FrequencyExt[] tempFreq = handleFrequency(frequencyExt);
    clearDataEntity(customerdataset);
    boolean withRowCountIndicator = FrequencyTypeStateUtil.isWithRowCountIndicator(indicator);
    // Added TDQ-12870
    List columnKeys = TOPChartUtils.getInstance().getColumnKeys(customerdataset);
    FrequencyExt freqE = tempFreq[0];
    if (!columnKeys.contains(String.valueOf(freqE.getKey()))) {
        // columnKeys.clear();
        TOPChartUtils.getInstance().clearDataset(customerdataset);
        ICustomerDataset customerDataset = TOPChartUtils.getInstance().getCustomerDataset(customerdataset);
        if (customerDataset != null && customerDataset instanceof CustomerDefaultCategoryDataset) {
            ((CustomerDefaultCategoryDataset) customerDataset).clearAll();
        }
    }
    for (int i = 0; i < numOfShown; i++) {
        FrequencyExt freqExt = tempFreq[i];
        String keyLabel = String.valueOf(freqExt.getKey());
        if ("null".equals(keyLabel)) {
            // $NON-NLS-1$
            keyLabel = SpecialValueDisplay.NULL_FIELD;
        }
        if ("".equals(keyLabel)) {
            // $NON-NLS-1$
            keyLabel = SpecialValueDisplay.EMPTY_FIELD;
        }
        ChartDataEntity entity = FrequencyTypeStateUtil.createChartEntity(indicator, freqExt, keyLabel, withRowCountIndicator);
        if (customerdataset instanceof CustomerDefaultCategoryDataset) {
            ((CustomerDefaultCategoryDataset) customerdataset).addDataEntity(entity);
            addValueToDataset(((CustomerDefaultCategoryDataset) customerdataset).getDataset(), freqExt, keyLabel);
        } else {
            ICustomerDataset customerDataset = TOPChartUtils.getInstance().getCustomerDataset(customerdataset);
            if (customerDataset != null && customerDataset instanceof CustomerDefaultCategoryDataset) {
                customerDataset.addDataEntity(entity);
                addValueToDataset(((CustomerDefaultCategoryDataset) customerDataset).getDataset(), freqExt, keyLabel);
            }
        }
    }
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) ArrayList(java.util.ArrayList) List(java.util.List) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) FrequencyExt(org.talend.dq.indicators.ext.FrequencyExt) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) ICustomerDataset(org.talend.dataprofiler.common.ui.editor.preview.ICustomerDataset)

Example 30 with ChartDataEntity

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

the class PatternDynamicChartEventReceiver method refreshPatternTable.

private void refreshPatternTable(PatternMatchingExt matchExt) {
    TableWithData input = (TableWithData) tableViewer.getInput();
    if (input != null) {
        ChartDataEntity[] dataEntities = input.getEnity();
        if (dataEntities != null && dataEntities.length > getIndexInDataset()) {
            ((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumMatch(String.valueOf(matchExt.getMatchingValueCount()));
            ((PatternChartDataEntity) dataEntities[getIndexInDataset()]).setNumNoMatch(String.valueOf(matchExt.getNotMatchingValueCount()));
            tableViewer.getTable().clearAll();
            tableViewer.setInput(input);
        }
    }
}
Also used : PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity)

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