Search in sources :

Example 1 with DelimitedFileIndicator

use of org.talend.dataprofiler.core.model.DelimitedFileIndicator 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 2 with DelimitedFileIndicator

use of org.talend.dataprofiler.core.model.DelimitedFileIndicator in project tdq-studio-se by Talend.

the class ModelElementIndicatorHelper method getColumn.

/**
 * Get column from modelElementIndicator
 *
 * @param modelElementIndicator
 * @return MetadataColumn if convert is normal else return null
 */
public static final MetadataColumn getColumn(ModelElementIndicator modelElementIndicator) {
    if (modelElementIndicator == null) {
        return null;
    }
    ColumnIndicator switchColumnIndicator = switchColumnIndicator(modelElementIndicator);
    if (switchColumnIndicator != null) {
        return switchColumnIndicator.getTdColumn();
    }
    // TDQ-10198: support Delimited File connection column
    DelimitedFileIndicator switchDelimitedFileIndicator = switchDelimitedFileIndicator(modelElementIndicator);
    if (switchDelimitedFileIndicator != null) {
        return switchDelimitedFileIndicator.getMetadataColumn();
    }
    return null;
}
Also used : ColumnIndicator(org.talend.dataprofiler.core.model.ColumnIndicator) DelimitedFileIndicator(org.talend.dataprofiler.core.model.DelimitedFileIndicator)

Example 3 with DelimitedFileIndicator

use of org.talend.dataprofiler.core.model.DelimitedFileIndicator in project tdq-studio-se by Talend.

the class AnalysisColumnTreeViewer method addItemElements.

private void addItemElements(final ModelElementIndicator[] elements, boolean isExpandAll) {
    for (ModelElementIndicator element : elements) {
        final TreeItem treeItem = new TreeItem(tree, SWT.NONE);
        treeItem.setImage(ImageLib.getImage(ImageLib.TD_COLUMN));
        final ModelElementIndicator meIndicator = element;
        treeItem.setText(0, ModelElementIndicatorHelper.getModelElementDisplayName(meIndicator));
        treeItem.setData(MODELELEMENT_INDICATOR_KEY, meIndicator);
        TreeEditor comboEditor = new TreeEditor(tree);
        final CCombo combo = new CCombo(tree, SWT.BORDER);
        for (DataminingType type : DataminingType.values()) {
            // MODSCA 2008-04-10 use literal
            combo.add(type.getLiteral());
        // for presentation
        }
        final ModelElement modelElement = RepositoryNodeHelper.getSubModelElement(meIndicator.getModelElementRepositoryNode());
        DataminingType dataminingType = MetadataHelper.getDataminingType(modelElement);
        // MOD qiongli 2010-11-15 feature 16796
        if (meIndicator instanceof DelimitedFileIndicator) {
            dataminingType = MetadataHelper.getDefaultDataminingType(meIndicator.getJavaType());
        }
        if (dataminingType == null) {
            combo.select(0);
        } else {
            combo.setText(dataminingType.getLiteral());
        }
        combo.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                MetadataHelper.setDataminingType(DataminingType.get(combo.getText()), modelElement);
                setDirty(true);
            }
        });
        combo.setEditable(false);
        comboEditor.minimumWidth = WIDTH1_CELL;
        comboEditor.setEditor(combo, treeItem, 1);
        TreeEditor addPatternEditor = new TreeEditor(tree);
        // $NON-NLS-1$
        Label addPatternLabl = createTreeItemLabel(tree, ImageLib.ADD_PATTERN, "AnalysisColumnTreeViewer.addPattern");
        // MOD mzhao feature:13040, 2010-05-21
        addPatternLabl.addMouseListener(new PatternMouseAdapter(this, masterPage, meIndicator, treeItem));
        addPatternEditor.minimumWidth = addPatternLabl.getImage().getBounds().width;
        addPatternEditor.setEditor(addPatternLabl, treeItem, 2);
        // ADD xqliu 2010-02-23 feature 11617
        TreeEditor addUdiEditor = addColumnUdi(treeItem, meIndicator, 3);
        // ~
        TreeEditor delLabelEditor = new TreeEditor(tree);
        // $NON-NLS-1$
        Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisColumnTreeViewer.delete");
        delLabel.setData(treeItem);
        delLabel.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDown(MouseEvent e) {
                // // here is the delLable which is behind of column, so need to remove current column and it's all
                // of
                TreeItem currentTreeItem = (TreeItem) e.widget.getData();
                removeSelectedElements(new TreeItem[] { currentTreeItem });
                notifyObservers();
            }
        });
        delLabelEditor.minimumWidth = delLabel.getImage().getBounds().width;
        delLabelEditor.horizontalAlignment = SWT.CENTER;
        delLabelEditor.setEditor(delLabel, treeItem, 4);
        treeItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { comboEditor, delLabelEditor, addPatternEditor, addUdiEditor });
        if (meIndicator.hasIndicators()) {
            createIndicatorItems(treeItem, meIndicator.getIndicatorUnits());
        }
        treeItem.setExpanded(isExpandAll);
    }
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) TreeEditor(org.eclipse.swt.custom.TreeEditor) TreeItem(org.eclipse.swt.widgets.TreeItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) MouseAdapter(org.eclipse.swt.events.MouseAdapter) DataminingType(org.talend.dataquality.indicators.DataminingType) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) CCombo(org.eclipse.swt.custom.CCombo) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DelimitedFileIndicator(org.talend.dataprofiler.core.model.DelimitedFileIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

DelimitedFileIndicator (org.talend.dataprofiler.core.model.DelimitedFileIndicator)3 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)2 CCombo (org.eclipse.swt.custom.CCombo)1 TreeEditor (org.eclipse.swt.custom.TreeEditor)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Label (org.eclipse.swt.widgets.Label)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 ColumnIndicator (org.talend.dataprofiler.core.model.ColumnIndicator)1 DataminingType (org.talend.dataquality.indicators.DataminingType)1 DatePatternFreqIndicator (org.talend.dataquality.indicators.DatePatternFreqIndicator)1 Indicator (org.talend.dataquality.indicators.Indicator)1 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)1 IIndicatorNode (org.talend.dq.nodes.indicator.IIndicatorNode)1 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)1