Search in sources :

Example 1 with IIndicatorNode

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

the class ModelElementIndicatorRule method match.

public static boolean match(IIndicatorNode node, ModelElementIndicator meIndicator, ExecutionLanguage language) {
    IndicatorEnum indicatorType = node.getIndicatorEnum();
    if (indicatorType == null) {
        for (IIndicatorNode one : node.getChildren()) {
            if (match(one, meIndicator, language)) {
                return true;
            }
        }
        return false;
    }
    IRepositoryNode rd = meIndicator.getModelElementRepositoryNode();
    // return patternRule(indicatorType, ((MetadataColumnRepositoryObject) rd.getObject()).getTdColumn(), language);
    return patternRule(indicatorType, RepositoryNodeHelper.getSubModelElement(rd), language, node);
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode)

Example 2 with IIndicatorNode

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

the class IndicatorSelectDialog method updateIndicatorInfo.

public void updateIndicatorInfo(GridItem item) {
    // $NON-NLS-1$
    String DESCRIPTION = DefaultMessagesImpl.getString("IndicatorSelectDialog.description");
    // $NON-NLS-1$
    String PURPOSE = DefaultMessagesImpl.getString("IndicatorSelectDialog.purpose");
    IIndicatorNode indicatorNode = ((IIndicatorNode) item.getData());
    if (indicatorNode != null) {
        Indicator indicator = indicatorNode.getIndicatorInstance();
        if (indicator != null) {
            IndicatorDefinition indicatorDefinition = indicator.getIndicatorDefinition();
            if ("".equals(MetadataHelper.getPurpose(indicatorDefinition))) {
                purposeLabel.setText(PURPOSE + " " + indicator.getName());
            } else {
                purposeLabel.setText(PURPOSE + " " + MetadataHelper.getPurpose(indicatorDefinition));
            }
            String description = DESCRIPTION + " " + MetadataHelper.getDescription(indicatorDefinition);
            descriptionLabel.setText(description);
            return;
        }
    }
    purposeLabel.setText(PURPOSE + " " + item.getText());
    descriptionLabel.setText(DESCRIPTION + " " + item.getText());
}
Also used : IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode) DatePatternFreqIndicator(org.talend.dataquality.indicators.DatePatternFreqIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) DelimitedFileIndicator(org.talend.dataprofiler.core.model.DelimitedFileIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 3 with IIndicatorNode

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

the class IndicatorSelectDialog method isMatchCurrentIndicator.

public boolean isMatchCurrentIndicator(ModelElementIndicator currentIndicator, IIndicatorNode indicatorNode) {
    boolean returnValueForCurrentIndicator = true;
    IIndicatorNode parentNode = indicatorNode.getParent();
    boolean isParentPhoneStatistics = parentNode != null && parentNode.getIndicatorInstance() != null && parentNode.getIndicatorInstance() instanceof PhoneNumbStatisticsIndicator;
    if (!ModelElementIndicatorRule.match(indicatorNode, currentIndicator, this.language)) {
        returnValueForCurrentIndicator = false;
    }
    Indicator indicatorInstance = indicatorNode.getIndicatorInstance();
    if (null != indicatorInstance && !(indicatorInstance instanceof DatePatternFreqIndicator) && null != indicatorInstance.getIndicatorDefinition() && indicatorInstance.getIndicatorDefinition().getSqlGenericExpression().size() < 1 && ExecutionLanguage.SQL.equals(language) && !UDIHelper.isJavaUDI(indicatorInstance) && !indicatorNode.hasChildren() && !(currentIndicator instanceof DelimitedFileIndicator) && !isParentPhoneStatistics) {
        returnValueForCurrentIndicator = false;
    }
    return returnValueForCurrentIndicator;
}
Also used : DatePatternFreqIndicator(org.talend.dataquality.indicators.DatePatternFreqIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode) DatePatternFreqIndicator(org.talend.dataquality.indicators.DatePatternFreqIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) DelimitedFileIndicator(org.talend.dataprofiler.core.model.DelimitedFileIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) DelimitedFileIndicator(org.talend.dataprofiler.core.model.DelimitedFileIndicator)

Example 4 with IIndicatorNode

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

the class AbstractIndicatorSelectGrid method tickCell.

private void tickCell(Point cell, boolean tick) {
    if (!getItem(cell.y).getCheckable(cell.x)) {
        return;
    }
    if (cell.x == 1) {
        for (int i = 2; i < getColumnCount(); i++) {
            tickCell(new Point(i, cell.y), tick);
        }
    }
    getItem(cell.y).setChecked(cell.x, tick);
    getItem(cell.y).setGrayed(cell.x, false);
    IIndicatorNode indicatorNode = (IIndicatorNode) getItem(cell.y).getData();
    IndicatorEnum indicatorEnum = indicatorNode.getIndicatorEnum();
    ModelElementIndicator meIndicator = (ModelElementIndicator) getColumn(cell.x).getData();
    if (meIndicator != null && indicatorEnum != null) {
        if (tick) {
            if (IndicatorEnum.isSpecialIndicatorEnum(indicatorEnum)) {
                meIndicator.addTempSpecialIndicator(indicatorEnum, indicatorNode.createNewIndicatorInstance());
            } else {
                meIndicator.addTempIndicatorEnum(indicatorEnum);
            }
        } else {
            if (IndicatorEnum.isSpecialIndicatorEnum(indicatorEnum)) {
                meIndicator.removeTempSpecialIndicator(indicatorNode.getIndicatorInstance());
            } else {
                meIndicator.removeTempIndicatorEnum(indicatorEnum);
            }
        }
    }
    // select the entire indicator category
    if (getItem(cell.y).hasChildren()) {
        for (GridItem child : getItem(cell.y).getItems()) {
            tickCell(new Point(cell.x, indexOf(child)), tick);
        }
    }
}
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) Point(org.eclipse.swt.graphics.Point) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 5 with IIndicatorNode

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

the class AbstractIndicatorSelectGrid method createChildNodes.

/**
 * recursively create tree nodes and checked the existing indicators.
 *
 * @param grid
 * @param currentItem
 * @param indicatorNode
 */
void createChildNodes(GridItem parentItem, GridItem currentItem, IIndicatorNode indicatorNode) {
    Boolean[] hasCheckableInColumn = new Boolean[getColumnCount()];
    for (int j = 1; j < getColumnCount(); j++) {
        hasCheckableInColumn[j] = false;
    }
    for (int i = 0; i < indicatorNode.getChildren().length; i++) {
        IIndicatorNode childNode = indicatorNode.getChildren()[i];
        TalendGridItem childItem = new TalendGridItem(currentItem, SWT.NONE);
        childItem.setImage(ImageLib.getImage(childNode.getImageName()));
        if (childNode.hasChildren()) {
            createChildNodes(currentItem, childItem, childNode);
        }
        childItem.setText(childNode.getLabel());
        childItem.setData(childNode);
        if (parentItem == null) {
            childItem.setExpanded(true);
        }
        boolean hasCheckableInRow = false;
        for (int j = 2; j < getColumnCount(); j++) {
            // ignore indicator label column and row select column
            IndicatorEnum indicatorEnum = childNode.getIndicatorEnum();
            // DB columns
            ModelElementIndicator meIndicator = null;
            if (j - 2 < _modelElementIndicators.length) {
                meIndicator = _modelElementIndicators[j - 2];
            } else {
                meIndicator = _modelElementIndicators[0];
            }
            // Enable/disable the check box
            boolean isMatch = _dialog.isMatchCurrentIndicator(meIndicator, childNode);
            childItem.setCheckable(j, isMatch);
            if (isMatch) {
                hasCheckableInRow = true;
                hasCheckableInColumn[j] = true;
                // Check the box if it is already selected
                if (meIndicator != null && (meIndicator.tempContains(indicatorEnum) || meIndicator.specialTempContains(childNode.getIndicatorInstance()))) {
                    childItem.setChecked(j, true);
                }
            }
        }
        childItem.setCheckable(1, hasCheckableInRow);
    }
    boolean entireCategoryCheckable = false;
    for (int j = 2; j < getColumnCount(); j++) {
        if (hasCheckableInColumn[j]) {
            entireCategoryCheckable = true;
        } else {
            currentItem.setCheckable(j, false);
        }
    }
    currentItem.setCheckable(1, entireCategoryCheckable);
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) TalendGridItem(org.eclipse.nebula.widgets.grid.TalendGridItem) Point(org.eclipse.swt.graphics.Point) IIndicatorNode(org.talend.dq.nodes.indicator.IIndicatorNode) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

IIndicatorNode (org.talend.dq.nodes.indicator.IIndicatorNode)8 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)5 TalendGridItem (org.eclipse.nebula.widgets.grid.TalendGridItem)4 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)4 Point (org.eclipse.swt.graphics.Point)3 GridItem (org.eclipse.nebula.widgets.grid.GridItem)2 DelimitedFileIndicator (org.talend.dataprofiler.core.model.DelimitedFileIndicator)2 DatePatternFreqIndicator (org.talend.dataquality.indicators.DatePatternFreqIndicator)2 Indicator (org.talend.dataquality.indicators.Indicator)2 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)2 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1