Search in sources :

Example 21 with TableIndicatorUnit

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

the class WhereRuleStatisticsStateTable method getOptimizeShowDataset.

/**
 * DOC xqliu Comment method "getOptimizeShowDataset". ADD xqliu 2010-03-10 feature 10834
 *
 * @return
 */
private List<Object> getOptimizeShowDataset() {
    List<Object> result = new ArrayList<Object>();
    // get the page size
    int size = getSizeOfDQRulePerChart();
    // Add RowCountIndicator dataset
    CustomerDefaultCategoryDataset customerDatasetRownCount = new CustomerDefaultCategoryDataset();
    // MOD msjian TDQ-5119: fix a NPE
    if (units != null && units.size() > 0) {
        addRownCountDataEntity2CustomerDataset(customerDatasetRownCount, getRownCountUnit(units));
        result.add(customerDatasetRownCount);
        // MOD xqliu 2012-04-23 TDQ-5057: don't include RowCountUnit
        List<TableIndicatorUnit> whereRuleUnits = removeRowCountUnit(units);
        int totalNum = whereRuleUnits.size();
        int pageNum = totalNum % size == 0 ? totalNum / size : totalNum / size + 1;
        for (int i = 0; i < pageNum; i++) {
            CustomerDefaultCategoryDataset customerDataset = new CustomerDefaultCategoryDataset();
            for (int j = 0; j < size; ++j) {
                int index = i * size + j;
                if (index < totalNum) {
                    addDataEntity2CustomerDataset(customerDataset, whereRuleUnits.get(index));
                } else {
                    break;
                }
            }
            result.add(customerDataset);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)

Example 22 with TableIndicatorUnit

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

the class TableIndicator method createSpecialIndicatorUnit.

private TableIndicatorUnit createSpecialIndicatorUnit(IndicatorDefinition whereRule, IndicatorEnum indicatorEnum, Indicator indicator) {
    Indicator indicatorNew = indicator;
    if (indicatorNew == null) {
        IndicatorSqlFactory factory = IndicatorSqlFactory.eINSTANCE;
        indicatorNew = (Indicator) factory.create(indicatorEnum.getIndicatorType());
        if (whereRule != null && indicatorNew instanceof WhereRuleIndicator) {
            indicatorNew.setAnalyzedElement(getColumnSet());
            indicatorNew.setIndicatorDefinition(whereRule);
        }
    }
    if (!indicatorEnumList.contains(indicatorEnum)) {
        this.indicatorEnumList.add(indicatorEnum);
    }
    if (this.specialIndicatorUnitList == null) {
        this.specialIndicatorUnitList = new ArrayList<TableIndicatorUnit>();
    }
    TableIndicatorUnit indicatorUnit = new TableIndicatorUnit(indicatorEnum, indicatorNew, this);
    specialIndicatorUnitList.add(indicatorUnit);
    return indicatorUnit;
}
Also used : IndicatorSqlFactory(org.talend.dataquality.indicators.sql.IndicatorSqlFactory) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator)

Example 23 with TableIndicatorUnit

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

the class TableIndicator method removeSpecialIndicatorUnit.

/**
 * Remove the specialIndicatorUnit from specialIndicatorList, if there exist more than one special Indicator which
 * has same IndicatorEnumn type, the type of IndicatorUnit will be not removed from flatIndicatorEnumList.
 *
 * @param indicatorUnit
 */
private void removeSpecialIndicatorUnit(TableIndicatorUnit indicatorUnit) {
    IndicatorEnum indicatorEnumn = indicatorUnit.getType();
    this.specialIndicatorUnitList.remove(indicatorUnit);
    for (TableIndicatorUnit unit : specialIndicatorUnitList) {
        if (unit.getType() == indicatorEnumn) {
            return;
        } else {
            continue;
        }
    }
    this.indicatorEnumList.remove(indicatorEnumn);
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)

Example 24 with TableIndicatorUnit

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

the class TableIndicator method createIndicatorUnit.

private TableIndicatorUnit createIndicatorUnit(IFile fe, IndicatorEnum indicatorEnum, Indicator indicator) {
    Indicator indicatorNew = indicator;
    if (indicator == null) {
        IndicatorsFactory factory = IndicatorsFactory.eINSTANCE;
        indicatorNew = (Indicator) factory.create(indicatorEnum.getIndicatorType());
        indicatorNew.setAnalyzedElement(getColumnSet());
    }
    if (!DefinitionHandler.getInstance().setDefaultIndicatorDefinition(indicator)) {
        // $NON-NLS-1$
        log.error(DefaultMessagesImpl.getString("TableIndicator.couldnotSetDef") + indicatorNew.getName());
    }
    TableIndicatorUnit indicatorUnit = new TableIndicatorUnit(indicatorEnum, indicatorNew, this);
    this.indicatorUnitMap.put(indicatorEnum, indicatorUnit);
    return indicatorUnit;
}
Also used : IndicatorsFactory(org.talend.dataquality.indicators.IndicatorsFactory) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator)

Aggregations

TableIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)24 ArrayList (java.util.ArrayList)8 TableIndicator (org.talend.dataprofiler.core.model.TableIndicator)5 Indicator (org.talend.dataquality.indicators.Indicator)5 TreeItem (org.eclipse.swt.widgets.TreeItem)4 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)4 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)3 WhereRuleIndicator (org.talend.dataquality.indicators.sql.WhereRuleIndicator)3 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)3 RuleRepNode (org.talend.dq.nodes.RuleRepNode)3 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)3 NamedColumnSet (orgomg.cwm.resource.relational.NamedColumnSet)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 List (java.util.List)2 Map (java.util.Map)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2