Search in sources :

Example 21 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum in project tdq-studio-se by Talend.

the class IndicatorTreeModelBuilder method buildIndicatorCategory.

/**
 * build Indicator Category. we DO NOT use the CACHE here, because sometimes, when the indicator definitions become
 * to Proxy, we can not get its property to get Label display on the select indicator dialog(can prefer to TDQ-8857)
 *
 * @return
 */
public static IIndicatorNode[] buildIndicatorCategory() {
    // if (indicatorCategoryNodes != null) {
    // return indicatorCategoryNodes;
    // }
    // build Basic Statistic categoryNode
    IndicatorCategoryNode simpleCategoryNode = new IndicatorCategoryNode(SIMPLE_LABEL, IndicatorEnum.CountsIndicatorEnum);
    // build Text statistics categoryNode
    IndicatorCategoryNode textCategoryNode = new IndicatorCategoryNode(TEXT_LABEL, IndicatorEnum.TextIndicatorEnum);
    // build Summary Statistic categoryNode
    IndicatorCategoryNode boxCategoryNode = new IndicatorCategoryNode(SUMMARY_LABEL, IndicatorEnum.BoxIIndicatorEnum);
    // build Pattern Frequency Statistics categoryNode
    IndicatorEnum[] patternFinderEnums = new IndicatorEnum[] { IndicatorEnum.PatternFreqIndicatorEnum, IndicatorEnum.PatternLowFreqIndicatorEnum, IndicatorEnum.EastAsiaPatternFreqIndicatorEnum, IndicatorEnum.EastAsiaPatternLowFreqIndicatorEnum, IndicatorEnum.DatePatternFreqIndicatorEnum };
    IndicatorCategoryNode patternFinderCategoryNode = new IndicatorCategoryNode(PATTERN_LABEL, patternFinderEnums);
    // MOD mzhao 2009-03-05 build Soundex Statistic categoryNode
    IndicatorEnum[] soundexIndicatorEnums = new IndicatorEnum[] { IndicatorEnum.SoundexIndicatorEnum, IndicatorEnum.SoundexLowIndicatorEnum };
    IndicatorCategoryNode soundexCategoryNode = new IndicatorCategoryNode(SOUNDEX_LABEL, soundexIndicatorEnums);
    IndicatorCategoryNode phoneCategoryNode = new IndicatorCategoryNode(PHONE_NUMBER_LABEL, IndicatorEnum.PhoneNumbStatisticsIndicatorEnum);
    // build Nominal Statistic categoryNode
    IndicatorEnum[] advanceIndicatorEnums = new IndicatorEnum[] { IndicatorEnum.ModeIndicatorEnum, IndicatorEnum.FrequencyIndicatorEnum, IndicatorEnum.DateFrequencyIndicatorEnum, IndicatorEnum.WeekFrequencyIndicatorEnum, IndicatorEnum.MonthFrequencyIndicatorEnum, IndicatorEnum.QuarterFrequencyIndicatorEnum, IndicatorEnum.YearFrequencyIndicatorEnum, IndicatorEnum.BinFrequencyIndicatorEnum, IndicatorEnum.LowFrequencyIndicatorEnum, IndicatorEnum.DateLowFrequencyIndicatorEnum, IndicatorEnum.WeekLowFrequencyIndicatorEnum, IndicatorEnum.MonthLowFrequencyIndicatorEnum, IndicatorEnum.QuarterLowFrequencyIndicatorEnum, IndicatorEnum.YearLowFrequencyIndicatorEnum, IndicatorEnum.BinLowFrequencyIndicatorEnum };
    IndicatorCategoryNode advanceCategoryNode = new IndicatorCategoryNode(ADVANCED_LABEL, advanceIndicatorEnums);
    // Added yyin 20120827, TDQ-5076, build Fraud Detection category and SIndicator
    IndicatorEnum[] fraudIndicatorEnums = new IndicatorEnum[] { IndicatorEnum.BenfordLawFrequencyIndicatorEnum };
    IndicatorCategoryNode fraudCategoryNode = new IndicatorCategoryNode(FRAUD_LABEL, fraudIndicatorEnums);
    // Add UDIEnums
    IndicatorCategoryNode UDICategoryNode = new IndicatorCategoryNode(UDI_LABEL);
    UDICategoryNode.setChildren(createUDIChildrens());
    // Add PatternEnums
    IndicatorCategoryNode regexPatternCategoryNode = new IndicatorCategoryNode(REGEX_PATTERN);
    regexPatternCategoryNode.setChildren(createRegexPatternChildrens());
    // new
    IndicatorCategoryNode sqlPatternCategoryNode = new IndicatorCategoryNode(SQL_PATTERN);
    // IndicatorEnum[]
    sqlPatternCategoryNode.setChildren(createSqlPatternChildrens());
    // {IndicatorEnum.SqlPatternMatchingIndicatorEnum
    // });
    IndicatorCategoryNode patternCategoryNode = new IndicatorCategoryNode(PATTERN, new IndicatorEnum[] { IndicatorEnum.PatternIndicatorEnum });
    patternCategoryNode.setChildren(new IIndicatorNode[] { sqlPatternCategoryNode, regexPatternCategoryNode });
    indicatorCategoryNodes = new IndicatorCategoryNode[] { simpleCategoryNode, textCategoryNode, boxCategoryNode, advanceCategoryNode, patternFinderCategoryNode, soundexCategoryNode, phoneCategoryNode, fraudCategoryNode, UDICategoryNode, patternCategoryNode };
    return indicatorCategoryNodes;
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IndicatorCategoryNode(org.talend.dq.nodes.indicator.impl.IndicatorCategoryNode)

Example 22 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum in project tdq-studio-se by Talend.

the class DQRuleUtilities method createIndicatorUnit.

/**
 * DOC xqliu Comment method "createIndicatorUnit".
 *
 * @param fe
 * @param tableIndicator
 * @param analysis
 * @return
 */
public static TableIndicatorUnit createIndicatorUnit(RuleRepNode ruleRepNode, TableIndicator tableIndicator, Analysis analysis) {
    IndicatorDefinition whereRule = ruleRepNode.getRule();
    for (Indicator indicator : tableIndicator.getIndicators()) {
        if (whereRule.getName().equals(indicator.getName())) {
            return null;
        }
    }
    WhereRuleIndicator[] compositeWhereRuleIndicator = createCompositeWhereRuleIndicator(tableIndicator.getColumnSet(), whereRule);
    IndicatorEnum type = IndicatorEnum.findIndicatorEnum(compositeWhereRuleIndicator[0].eClass());
    TableIndicatorUnit addIndicatorUnit = tableIndicator.addSpecialIndicator(whereRule, type, compositeWhereRuleIndicator[0]);
    DependenciesHandler.getInstance().setUsageDependencyOn(analysis, whereRule);
    return addIndicatorUnit;
}
Also used : WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) Indicator(org.talend.dataquality.indicators.Indicator) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator)

Example 23 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum in project tdq-studio-se by Talend.

the class AbstractIndicatorSelectGrid method processNodeSelection.

/**
 * recursively check if a entire row/column is selected/
 *
 * @param grid
 * @param parentItem
 * @param currentItem
 */
void processNodeSelection(GridItem parentItem, GridItem currentItem) {
    if (currentItem.hasChildren()) {
        // declare and initialize variables
        Boolean[] allCheckedInColumn = new Boolean[getColumnCount()];
        Boolean[] hasCheckedInColumn = new Boolean[getColumnCount()];
        for (int j = 1; j < getColumnCount(); j++) {
            allCheckedInColumn[j] = true;
            hasCheckedInColumn[j] = false;
        }
        for (int i = 0; i < currentItem.getItemCount(); i++) {
            GridItem childItem = currentItem.getItem(i);
            // process the children of current item, this must be done before handling the current item
            processNodeSelection(currentItem, childItem);
            boolean allCheckedInRow = true;
            boolean hasCheckedInRow = false;
            boolean expanded = false;
            for (int j = 2; j < getColumnCount(); j++) {
                if (childItem.getChecked(j)) {
                    hasCheckedInRow = true;
                    hasCheckedInColumn[j] = true;
                    expanded = true;
                    if (childItem.getGrayed(j)) {
                        allCheckedInRow = false;
                        allCheckedInColumn[j] = false;
                    }
                } else {
                    if (childItem.getCheckable(j)) {
                        allCheckedInRow = false;
                        allCheckedInColumn[j] = false;
                    }
                }
            }
            childItem.setChecked(1, hasCheckedInRow);
            childItem.setGrayed(1, hasCheckedInRow && !allCheckedInRow);
            if (expanded) {
                currentItem.setExpanded(true);
            }
        }
        // process the selections of indicator category row
        boolean entireCategoryChecked = true;
        for (int j = 2; j < getColumnCount(); j++) {
            if (currentItem.getCheckable(j)) {
                if (hasCheckedInColumn[j]) {
                    hasCheckedInColumn[1] = true;
                    currentItem.setChecked(j, true);
                } else {
                    currentItem.setChecked(j, false);
                }
                if (!allCheckedInColumn[j]) {
                    currentItem.setGrayed(j, hasCheckedInColumn[j]);
                    entireCategoryChecked = false;
                } else {
                    currentItem.setGrayed(j, false);
                }
                // are selected
                if (hasCheckedInColumn[j] && allCheckedInColumn[j]) {
                    IIndicatorNode indicatorNode = (IIndicatorNode) currentItem.getData();
                    IndicatorEnum indicatorEnum = indicatorNode.getIndicatorEnum();
                    ModelElementIndicator meIndicator = (ModelElementIndicator) getColumn(j).getData();
                    if (indicatorEnum != null && meIndicator != null && (indicatorEnum == IndicatorEnum.RangeIndicatorEnum || indicatorEnum == IndicatorEnum.IQRIndicatorEnum)) {
                        meIndicator.addTempIndicatorEnum(indicatorEnum);
                    }
                }
            }
        }
        if (currentItem.getCheckable(1)) {
            currentItem.setChecked(1, hasCheckedInColumn[1]);
            currentItem.setGrayed(1, hasCheckedInColumn[1] && !entireCategoryChecked);
        }
    }
}
Also used : TalendGridItem(org.eclipse.nebula.widgets.grid.TalendGridItem) GridItem(org.eclipse.nebula.widgets.grid.GridItem) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) Point(org.eclipse.swt.graphics.Point) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 24 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum in project tdq-studio-se by Talend.

the class AbstractColumnDropTree method createOneUnit.

/**
 * DOC qzhang Comment method "createOneUnit".
 *
 * @param treeItem
 * @param indicatorUnit
 */
public void createOneUnit(final TreeItem treeItem, IndicatorUnit indicatorUnit) {
    final TreeItem indicatorItem = new TreeItem(treeItem, SWT.NONE);
    final IndicatorUnit unit = indicatorUnit;
    IndicatorEnum indicatorType = indicatorUnit.getType();
    indicatorItem.setData(MODELELEMENT_INDICATOR_KEY, treeItem.getData(MODELELEMENT_INDICATOR_KEY));
    indicatorItem.setData(INDICATOR_UNIT_KEY, unit);
    indicatorItem.setData(viewKey, this);
    indicatorItem.setImage(0, getIndicatorImage(unit));
    String indicatorName = getIndicatorName(indicatorUnit);
    // $NON-NLS-1$
    String label = indicatorName == null ? "unknown indicator" : indicatorName;
    indicatorItem.setText(0, label);
    TreeEditor optionEditor = new TreeEditor(tree);
    // $NON-NLS-1$
    final Label optionLabel = createTreeItemLabel(tree, ImageLib.OPTION, "AnalysisColumnTreeViewer.options");
    optionLabel.setData(indicatorUnit);
    optionLabel.addMouseListener(new MouseAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt .events.MouseEvent)
             */
        @Override
        public void mouseDown(MouseEvent e) {
            boolean hasIndicatorParameters = openIndicatorOptionDialog(Display.getCurrent().getActiveShell(), indicatorItem);
            if (hasIndicatorParameters) {
                optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
            }
        }
    });
    optionEditor.minimumWidth = optionLabel.getImage().getBounds().width;
    optionEditor.horizontalAlignment = SWT.CENTER;
    optionEditor.setEditor(optionLabel, indicatorItem, 1);
    // }
    TreeEditor delEditor = new TreeEditor(tree);
    // $NON-NLS-1$
    Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisColumnTreeViewer.delete");
    delLabel.addMouseListener(new MouseAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt .events.MouseEvent)
             */
        @Override
        public void mouseDown(MouseEvent e) {
            // current delLabel is behind of one indicator item.
            ModelElementIndicator meIndicator = (ModelElementIndicator) treeItem.getData(MODELELEMENT_INDICATOR_KEY);
            deleteIndicatorItems(meIndicator, unit);
            if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
                setElements(modelElementIndicators);
            } else {
                removeItemBranch(indicatorItem);
            }
        }
    });
    delEditor.minimumWidth = delLabel.getImage().getBounds().width;
    delEditor.horizontalAlignment = SWT.CENTER;
    // MOD mzhao feature 13040, column analysis have 5 columns, whereas columnset have 4 columns.
    if (AnalysisColumnTreeViewer.VIEWER_KEY.equals(viewKey)) {
        delEditor.setEditor(delLabel, indicatorItem, 4);
    } else if (AnalysisColumnSetTreeViewer.VIEWER_KEY.equals(viewKey)) {
        delEditor.setEditor(delLabel, indicatorItem, 3);
    }
    indicatorItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { optionEditor, delEditor });
    if (indicatorType.hasChildren()) {
        indicatorItem.setData(treeItem.getData(MODELELEMENT_INDICATOR_KEY));
        createIndicatorItems(indicatorItem, indicatorUnit.getChildren());
    }
    if (hasIndicatorParameters(indicatorUnit)) {
        optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
    }
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) TreeEditor(org.eclipse.swt.custom.TreeEditor) TreeItem(org.eclipse.swt.widgets.TreeItem) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) Label(org.eclipse.swt.widgets.Label) MouseAdapter(org.eclipse.swt.events.MouseAdapter) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 25 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum 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

IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)33 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)10 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)7 Indicator (org.talend.dataquality.indicators.Indicator)7 ArrayList (java.util.ArrayList)6 TableIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)4 RangeIndicator (org.talend.dataquality.indicators.RangeIndicator)4 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)4 TalendGridItem (org.eclipse.nebula.widgets.grid.TalendGridItem)3 Point (org.eclipse.swt.graphics.Point)3 TreeItem (org.eclipse.swt.widgets.TreeItem)3 BoxIndicator (org.talend.dataquality.indicators.BoxIndicator)3 CountsIndicator (org.talend.dataquality.indicators.CountsIndicator)3 IQRIndicator (org.talend.dataquality.indicators.IQRIndicator)3 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)3 IIndicatorNode (org.talend.dq.nodes.indicator.IIndicatorNode)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)2 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)2