Search in sources :

Example 16 with TableIndicatorUnit

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

the class AnalysisTableTreeViewer method openIndicatorOptionDialog.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataprofiler.core.ui.editor.composite.AbstractColumnDropTree#openIndicatorOptionDialog(org.eclipse
     * .swt.widgets.Shell, org.eclipse.swt.widgets.TreeItem)
     */
@Override
public boolean openIndicatorOptionDialog(Shell shell, TreeItem indicatorItem) {
    if (isDirty()) {
        masterPage.doSave(null);
    }
    TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) indicatorItem.getData(INDICATOR_UNIT_KEY);
    if (FormEnum.isExsitingForm(indicatorUnit)) {
        TableIndicatorOptionsWizard wizard = new TableIndicatorOptionsWizard(indicatorUnit);
        String href = FormEnum.getFirstFormHelpHref(indicatorUnit);
        OpeningHelpWizardDialog optionDialog = new OpeningHelpWizardDialog(shell, wizard, href);
        optionDialog.create();
        if (Window.OK == optionDialog.open()) {
            setDirty(wizard.isDirty());
            return hasIndicatorParameters(indicatorUnit);
        }
    } else {
        openNoIndicatorOptionsMessageDialog(shell);
    }
    return false;
}
Also used : TableIndicatorOptionsWizard(org.talend.dataprofiler.core.ui.wizard.indicator.TableIndicatorOptionsWizard) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog)

Example 17 with TableIndicatorUnit

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

the class AnalysisTableTreeViewer method removeSelectedElements.

private void removeSelectedElements(Tree newTree) {
    TreeItem[] selection = newTree.getSelection();
    if (isRowCountIndicator(selection)) {
        return;
    }
    boolean branchIndicatorExist = false;
    for (TreeItem item : selection) {
        TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
        if (indicatorUnit != null) {
            deleteIndicatorItems((TableIndicator) item.getData(TABLE_INDICATOR_KEY), indicatorUnit);
        } else {
            deleteTableItems((TableIndicator) item.getData(TABLE_INDICATOR_KEY));
        }
        if (item.getParentItem() != null && item.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
            branchIndicatorExist = true;
            continue;
        } else {
            removeItemBranch(item);
            removeTreeItem(item);
        }
    }
    if (branchIndicatorExist) {
        setElements(tableIndicators);
    }
// MOD mzhao 2005-05-05 bug 6587.
// MOD mzhao 2009-06-8, bug 5887.
// updateBindConnection(masterPage, getTableIndicator(), tree);
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)

Example 18 with TableIndicatorUnit

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

the class AnalysisTableTreeViewer method showAddDQRuleDialog.

/**
 * DOC xqliu Comment method "showAddDQRuleDialog".
 *
 * @param treeItem
 * @param tableIndicator
 */
private void showAddDQRuleDialog(final TreeItem treeItem, final TableIndicator tableIndicator) {
    // MOD xqliu 2009-04-30 bug 6808
    IndicatorCheckedTreeSelectionDialog dialog = new IndicatorCheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
    dialog.setInput(AnalysisUtils.getSelectDialogInputData(EResourceConstant.RULES_SQL));
    dialog.setValidator(new ISelectionStatusValidator() {

        public IStatus validate(Object[] selection) {
            for (Object ruleNode : selection) {
                if (ruleNode instanceof RuleRepNode) {
                    IndicatorDefinition findWhereRule = ((RuleRepNode) ruleNode).getRule();
                    boolean validStatus = TaggedValueHelper.getValidStatus(findWhereRule);
                    if (!validStatus) {
                        return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
                        "AnalysisTableTreeViewer.chooseValidDQRules"));
                    }
                }
            }
            // $NON-NLS-1$
            return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", null);
        }
    });
    dialog.setContainerMode(true);
    // $NON-NLS-1$
    dialog.setTitle(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.dqruleSelector"));
    // $NON-NLS-1$
    dialog.setMessage(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.dqrules"));
    dialog.setSize(80, 30);
    dialog.create();
    // MOD xqliu 2009-04-30 bug 6808
    Object[] ownedWhereRuleNodes = getOwnedWhereRuleNodes(tableIndicator);
    dialog.setCheckedElements(ownedWhereRuleNodes);
    if (dialog.open() == Window.OK) {
        Object[] result = dialog.getResult();
        removeUncheckedWhereRuleIndicator(ownedWhereRuleNodes, result, tableIndicator);
        Object[] results = clearAddedResult(ownedWhereRuleNodes, result);
        for (Object obj : results) {
            if (obj instanceof RuleRepNode) {
                RuleRepNode node = (RuleRepNode) obj;
                TableIndicatorUnit addIndicatorUnit = DQRuleUtilities.createIndicatorUnit(node, tableIndicator, getAnalysis());
                if (addIndicatorUnit != null) {
                    createOneUnit(treeItem, addIndicatorUnit);
                    setDirty(true);
                } else {
                    IndicatorDefinition whereRule = node.getRule();
                    MessageUI.openError(// $NON-NLS-1$
                    DefaultMessagesImpl.getString(// $NON-NLS-1$
                    "AnalysisTableTreeViewer.ErrorWhenAddWhereRule", whereRule.getName()));
                }
            }
        }
    }
// ~
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) RuleRepNode(org.talend.dq.nodes.RuleRepNode) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) IndicatorCheckedTreeSelectionDialog(org.talend.dataprofiler.core.ui.dialog.IndicatorCheckedTreeSelectionDialog) DQRepositoryViewLabelProvider(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider)

Example 19 with TableIndicatorUnit

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

the class AnalysisTableTreeViewer method dropWhereRules.

public void dropWhereRules(Object data, List<RuleRepNode> nodes, int index, TreeItem item) {
    TreeItem treeItem = null;
    if (item == null) {
        if (getTree().getItemCount() > 0) {
            treeItem = getTree().getItem(0);
        }
    } else {
        treeItem = item;
    }
    if (data != null && treeItem != null && nodes.size() > 0) {
        Analysis analysis = getAnalysis();
        for (RuleRepNode node : nodes) {
            TableIndicatorUnit addIndicatorUnit = DQRuleUtilities.createIndicatorUnit(node, (TableIndicator) data, analysis);
            if (addIndicatorUnit != null) {
                createOneUnit(treeItem, addIndicatorUnit);
                setDirty(true);
            }
        }
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) Analysis(org.talend.dataquality.analysis.Analysis) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) RuleRepNode(org.talend.dq.nodes.RuleRepNode)

Example 20 with TableIndicatorUnit

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

the class AnalysisTableTreeViewer method isExpressionNull.

private String isExpressionNull(TreeItem item) {
    String expressContent = null;
    TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
    TableIndicator tableIndicator = (TableIndicator) item.getData(TABLE_INDICATOR_KEY);
    NamedColumnSet set = tableIndicator.getColumnSet();
    Connection dataprovider = ConnectionHelper.getTdDataProvider(ColumnSetHelper.getParentCatalogOrSchema(set));
    DbmsLanguage dbmsLang = DbmsLanguageFactory.createDbmsLanguage(dataprovider);
    Expression expression = dbmsLang.getInstantiatedExpression(indicatorUnit.getIndicator());
    if (expression != null) {
        expressContent = expression.getBody();
    }
    return expressContent;
}
Also used : DbmsLanguage(org.talend.dq.dbms.DbmsLanguage) TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) Expression(orgomg.cwm.objectmodel.core.Expression) Connection(org.talend.core.model.metadata.builder.connection.Connection) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet)

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