Search in sources :

Example 1 with CustomerDefaultBAWDataset

use of org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset in project tdq-studio-se by Talend.

the class AnalysisUtils method createDynamicBAWChartEventReceiver.

/**
 * DOC yyin Comment method "createDynamicBAWChartEventReceiver".
 *
 * @param oneCategoryIndicatorModel
 * @param categoryDataset
 * @return
 */
public static DynamicBAWChartEventReceiver createDynamicBAWChartEventReceiver(DynamicIndicatorModel oneCategoryIndicatorModel, Map<Indicator, EventReceiver> eventReceivers) {
    DynamicBAWChartEventReceiver bawReceiver = new DynamicBAWChartEventReceiver();
    Object categoryDataset = oneCategoryIndicatorModel.getDataset();
    if (categoryDataset instanceof CustomerDefaultBAWDataset) {
        // all summary selected
        bawReceiver.setBawDataset((CustomerDefaultBAWDataset) categoryDataset);
    } else {
        // not-all summary selected
        bawReceiver.setDataset(categoryDataset);
    }
    bawReceiver.setBAWparentComposite(oneCategoryIndicatorModel.getBawParentChartComp());
    bawReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
    int index = 0;
    int length = oneCategoryIndicatorModel.getSummaryIndicators().size();
    for (Indicator oneIndicator : oneCategoryIndicatorModel.getSummaryIndicators()) {
        DynamicChartEventReceiver eReceiver = bawReceiver.createEventReceiver(IndicatorEnum.findIndicatorEnum(oneIndicator.eClass()), oneIndicator);
        eReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
        eReceiver.setEntityIndex(index++);
        if (SummaryStatisticsState.FULL_FLAG != length) {
            eReceiver.setDataset(categoryDataset);
        }
        eReceiver.clearValue();
        eventReceivers.put(oneIndicator, eReceiver);
        EventManager.getInstance().register(oneIndicator, EventEnum.DQ_DYMANIC_CHART, eReceiver);
    }
    bawReceiver.clearValue();
    return bawReceiver;
}
Also used : DynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver) BenfordFrequencyDynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.BenfordFrequencyDynamicChartEventReceiver) PatternDynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.PatternDynamicChartEventReceiver) FrequencyDynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.FrequencyDynamicChartEventReceiver) CustomerDefaultBAWDataset(org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset) Indicator(org.talend.dataquality.indicators.Indicator) DynamicBAWChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicBAWChartEventReceiver)

Example 2 with CustomerDefaultBAWDataset

use of org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset in project tdq-studio-se by Talend.

the class SummaryStatisticsState method getCustomerDataset.

public ICustomerDataset getCustomerDataset() {
    Map<IndicatorEnum, Double> map = new HashMap<IndicatorEnum, Double>();
    CustomerDefaultCategoryDataset customerdataset = new CustomerDefaultCategoryDataset();
    for (IndicatorUnit unit : units) {
        // MOD xqliu 2009-06-29 bug 7068
        String value = null;
        if (indicators2ValueMap.containsKey(unit)) {
            value = indicators2ValueMap.get(unit);
        } else {
            value = summaryUtil.getUnitValue(unit);
        }
        if (Java2SqlType.isNumbericInSQL(sqltype)) {
            try {
                map.put(unit.getType(), Double.parseDouble(value));
            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
        ChartDataEntity entity = summaryUtil.createDataEntity(unit, value);
        customerdataset.addDataEntity(entity);
    }
    if (isIntact() && !isSupportDynamicChart) {
        CustomerDefaultBAWDataset dataset = new CustomerDefaultBAWDataset(map.get(IndicatorEnum.MeanIndicatorEnum), map.get(IndicatorEnum.MedianIndicatorEnum), map.get(IndicatorEnum.LowerQuartileIndicatorEnum), map.get(IndicatorEnum.UpperQuartileIndicatorEnum), map.get(IndicatorEnum.MinValueIndicatorEnum), map.get(IndicatorEnum.MaxValueIndicatorEnum), customerdataset);
        dataset.addDataEntity(customerdataset.getDataEntities());
        return dataset;
    } else {
        // MOD hcheng,Range indicator value should not appear in bar chart
        if (!isIntact()) {
            map.remove(IndicatorEnum.RangeIndicatorEnum);
            map.remove(IndicatorEnum.IQRIndicatorEnum);
        }
        for (IndicatorEnum indicatorEnum : map.keySet()) {
            customerdataset.addValue(map.get(indicatorEnum), indicatorEnum.getLabel(), indicatorEnum.getLabel());
        }
        return customerdataset;
    }
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) HashMap(java.util.HashMap) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) CustomerDefaultBAWDataset(org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset)

Aggregations

CustomerDefaultBAWDataset (org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset)2 HashMap (java.util.HashMap)1 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)1 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)1 BenfordFrequencyDynamicChartEventReceiver (org.talend.dataprofiler.core.ui.events.BenfordFrequencyDynamicChartEventReceiver)1 DynamicBAWChartEventReceiver (org.talend.dataprofiler.core.ui.events.DynamicBAWChartEventReceiver)1 DynamicChartEventReceiver (org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver)1 FrequencyDynamicChartEventReceiver (org.talend.dataprofiler.core.ui.events.FrequencyDynamicChartEventReceiver)1 PatternDynamicChartEventReceiver (org.talend.dataprofiler.core.ui.events.PatternDynamicChartEventReceiver)1 Indicator (org.talend.dataquality.indicators.Indicator)1 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)1 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)1