Search in sources :

Example 1 with ColumnSetAnalysisDetailsPage

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

the class PatternMouseAdapter method mouseDown.

@Override
public void mouseDown(MouseEvent e) {
    DataManager dm = analysis.getContext().getConnection();
    if (dm == null) {
        masterPage.doSave(null);
    }
    // MOD gdbu 2011-8-26 bug : TDQ-2169
    IRepositoryNode patternFolderNode = getPatternSelectDialogInputData();
    if (patternFolderNode == null) {
        return;
    }
    CheckedTreeSelectionDialog dialog = PatternUtilities.createPatternCheckedTreeSelectionDialog(patternFolderNode);
    if (null != filters) {
        for (ViewerFilter filter : filters) {
            dialog.addFilter(filter);
        }
    }
    // ~TDQ-2169
    Object[] selectedRepNodes = PatternUtilities.getPatternRepNodesByIndicator(meIndicator);
    dialog.setInitialSelections(selectedRepNodes);
    dialog.create();
    if (dialog.open() == Window.OK) {
        // MOD qiongli 2012-10-17 TDQ-5923,just remove some deselected indicatorUnit,just create new indicatorUnit
        // for some new added pattern nodes.
        List<PatternRepNode> allSelectedPatternNodes = new ArrayList<PatternRepNode>();
        Set<String> allSelectedNodeNames = new HashSet<String>();
        for (Object obj : dialog.getResult()) {
            if (obj instanceof PatternRepNode) {
                PatternRepNode patternNode = (PatternRepNode) obj;
                allSelectedPatternNodes.add(patternNode);
                allSelectedNodeNames.add(patternNode.getLabel());
            }
        }
        Set<String> oldSelectedNodeNames = new HashSet<String>();
        Map<String, IndicatorUnit> oldSelectedUnits = new HashMap<String, IndicatorUnit>();
        for (IndicatorUnit indicatorUnit : meIndicator.getIndicatorUnits()) {
            Indicator indicator = indicatorUnit.getIndicator();
            if (indicator instanceof PatternMatchingIndicator) {
                if (!allSelectedNodeNames.contains(indicator.getName())) {
                    // this method will deal dependency with same time
                    columnDropTree.deleteIndicatorItems(meIndicator, indicatorUnit);
                    if (!columnDropTree.isDirty()) {
                        columnDropTree.setDirty(true);
                    }
                } else {
                    oldSelectedNodeNames.add(indicator.getName());
                    oldSelectedUnits.put(indicator.getName(), indicatorUnit);
                }
            }
        }
        // Added yyin 20121121 TDQ-6329: after remove all, should also add the old selected patterns
        // because the columnset does not have pagination, can not refresh automatically
        boolean addOldSelected = false;
        if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
            addOldSelected = true;
        }
        if (addOldSelected) {
            for (TreeItem child : treeItem.getItems()) {
                masterPage.getTreeViewer().removeItemBranch(child);
            }
        }
        // ~
        treeItem.removeAll();
        for (PatternRepNode patternNode : allSelectedPatternNodes) {
            if (oldSelectedNodeNames.contains(patternNode.getLabel()) && !addOldSelected) {
                continue;
            }
            TypedReturnCode<IndicatorUnit> trc = PatternUtilities.createIndicatorUnit(patternNode.getPattern(), meIndicator, analysis);
            if (trc.isOk()) {
                createOneUnit(trc.getObject());
                // TDQ-8860 add msjian 2014-4-30:check whether show allmatchindicator in the indicators section
                if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
                    EventManager.getInstance().publish(analysis, EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, null);
                }
            // TDQ-8860~
            }
        }
        treeItem.setExpanded(true);
        if (masterPage instanceof ColumnAnalysisDetailsPage) {
            ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) masterPage;
            page.refreshTheTree(page.getCurrentModelElementIndicators());
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) HashMap(java.util.HashMap) TreeItem(org.eclipse.swt.widgets.TreeItem) ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage) PatternRepNode(org.talend.dq.nodes.PatternRepNode) HashSet(java.util.HashSet)

Example 2 with ColumnSetAnalysisDetailsPage

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

the class AnalyzeColumnSetAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
    if (nodeColumns != null) {
        DQRepositoryNode tFolder = (DQRepositoryNode) nodeColumns.getParent();
        if (tFolder != null) {
            IRepositoryNode node = tFolder.getParent();
            if (node instanceof DBCatalogRepNode) {
                IRepositoryNode connNode = ((DBCatalogRepNode) node).getParent();
                packaFilterParameter.setConnectionRepNode(connNode);
                catalogs.add(node);
                packaFilterParameter.setPackages(catalogs);
            } else if (node instanceof DBSchemaRepNode) {
                schemaNode = (DBSchemaRepNode) node;
                RepositoryNode parent = schemaNode.getParent();
                if (parent instanceof DBCatalogRepNode) {
                    catalogs.add(parent);
                    packaFilterParameter.setConnectionRepNode(parent);
                } else {
                    catalogs.add(schemaNode);
                    packaFilterParameter.setConnectionRepNode(schemaNode);
                }
                packaFilterParameter.setPackages(catalogs);
            }
        }
    }
    if (needselection) {
        IRepositoryNode firstElement = (RepositoryNode) this.selection.getFirstElement();
        IRepositoryViewObject viewObject = firstElement.getObject();
        Item item = viewObject.getProperty().getItem();
        ConnectionItem connectionItem = (ConnectionItem) item;
        Connection connection = connectionItem.getConnection();
        IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(connection);
        packaFilterParameter.setConnectionRepNode(repositoryNode);
    }
    if (opencolumnSetAnalysisDialog(packaFilterParameter) == Window.OK) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor != null) {
            ColumnSetAnalysisDetailsPage page = (ColumnSetAnalysisDetailsPage) editor.getMasterPage();
            if (this.needselection && !this.selection.isEmpty()) {
                IRepositoryNode[] nodeArray = new IRepositoryNode[selection.size()];
                Iterator it = this.selection.iterator();
                int i = 0;
                while (it.hasNext()) {
                    nodeArray[i] = (IRepositoryNode) it.next();
                    i++;
                }
                page.setTreeViewInput(nodeArray);
            } else if (!this.needselection && null != this.nodeColumns) {
                List<IRepositoryNode> column = new ArrayList<IRepositoryNode>();
                for (IRepositoryNode columnFolder : nodeColumns.getChildren()) {
                    if (columnFolder instanceof DBColumnFolderRepNode) {
                        column.addAll(columnFolder.getChildren());
                    }
                }
                page.setTreeViewInput(column.toArray());
            }
            page.doSave(null);
        }
    }
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor)

Example 3 with ColumnSetAnalysisDetailsPage

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

the class ColumnWizard method openEditor.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataprofiler.core.ui.wizard.analysis.AbstractAnalysisWizard#openEditor(org.talend.repository.model.IRepositoryNode
     * )
     */
@Override
public void openEditor(IRepositoryNode repNode) {
    super.openEditor(repNode);
    if (this.selectionPage != null) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor != null) {
            AbstractAnalysisMetadataPage masterPage = editor.getMasterPage();
            List<IRepositoryNode> nodes = this.selectionPage.nodes;
            if (nodes != null && nodes.size() > 0) {
                // MOD msjian TDQ-6665 2013-1-7: after the wizard, make the editor is saved status
                if (masterPage instanceof ColumnAnalysisDetailsPage) {
                    ((ColumnAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                    ModelElementIndicator[] predefinedColumnIndicator = this.getPredefinedColumnIndicator();
                    if (predefinedColumnIndicator != null) {
                        ((ColumnAnalysisDetailsPage) masterPage).refreshPreviewTable(predefinedColumnIndicator, false);
                        ((ColumnAnalysisDetailsPage) masterPage).refreshTheTree(predefinedColumnIndicator);
                    }
                    // TDQ-12349: when the database can not support PatternFrequency, set to java engine automatically
                    if (this instanceof PatternFrequencyWizard && !RepNodeUtils.isSupportPatternFrequency(nodes)) {
                        masterPage.changeExecuteLanguageToJava(true);
                    }
                // TDQ-12349~
                } else if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
                    ((ColumnSetAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                } else {
                    masterPage.getTreeViewer().setInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                }
                masterPage.doSave(new NullProgressMonitor());
            // TDQ-6665~
            }
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) AbstractAnalysisMetadataPage(org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 4 with ColumnSetAnalysisDetailsPage

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

the class OpenColumnSelectorAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[],
     * org.eclipse.ui.cheatsheets.ICheatSheetManager)
     */
public void run(String[] params, ICheatSheetManager manager) {
    // ADD xqliu TDQ-4285 2011-12-27
    if (!CheatSheetActionHelper.canRun()) {
        return;
    }
    if (params == null || params.length == 0) {
        return;
    }
    Integer analysisCatigory = null;
    if (NumberUtils.isNumber(params[0])) {
        analysisCatigory = NumberUtils.toInt(params[0]);
    }
    if (analysisCatigory != null) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor == null) {
            return;
        }
        switch(analysisCatigory) {
            case AnalysisType.BUSINESS_RULE_VALUE:
                BusinessRuleAnalysisDetailsPage page4 = (BusinessRuleAnalysisDetailsPage) editor.getMasterPage();
                page4.openTableSelectionDialog();
                page4.doSave(null);
                break;
            case AnalysisType.TABLE_FUNCTIONAL_DEPENDENCY_VALUE:
                FunctionalDependencyAnalysisDetailsPage page3 = (FunctionalDependencyAnalysisDetailsPage) editor.getMasterPage();
                if (params[1] != null) {
                    if ("A".equalsIgnoreCase(params[1])) {
                        // $NON-NLS-1$
                        page3.openColumnsSetASelectionDialog();
                    } else {
                        page3.openColumnsSetBSelectionDialog();
                    }
                }
                // page3.doSave(null);
                break;
            case AnalysisType.COLUMN_SET_VALUE:
                ColumnSetAnalysisDetailsPage page0 = (ColumnSetAnalysisDetailsPage) editor.getMasterPage();
                page0.openColumnsSelectionDialog();
                page0.doSave(null);
                break;
            case AnalysisType.MULTIPLE_COLUMN_VALUE:
                ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) editor.getMasterPage();
                page.openColumnsSelectionDialog();
                page.doSave(null);
                break;
            case AnalysisType.COLUMNS_COMPARISON_VALUE:
                RedundancyAnalysisDetailsPage page1 = (RedundancyAnalysisDetailsPage) editor.getMasterPage();
                if (params[1] != null) {
                    if (NumberUtils.isNumber(params[1])) {
                        int pos = NumberUtils.toInt(params[1]);
                        if (pos == 0) {
                            page1.openColumnsSetASelectionDialog();
                        } else {
                            page1.openColumnsSetBSelectionDialog();
                        }
                    }
                }
                // page1.doSave(null);
                break;
            case AnalysisType.COLUMN_CORRELATION_VALUE:
                CorrelationAnalysisDetailsPage page2 = (CorrelationAnalysisDetailsPage) editor.getMasterPage();
                page2.openColumnsSelectionDialog();
                page2.doSave(null);
                break;
            default:
                break;
        }
    }
}
Also used : RedundancyAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.RedundancyAnalysisDetailsPage) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) FunctionalDependencyAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.FunctionalDependencyAnalysisDetailsPage) CorrelationAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.CorrelationAnalysisDetailsPage) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) BusinessRuleAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.BusinessRuleAnalysisDetailsPage) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage)

Aggregations

ColumnSetAnalysisDetailsPage (org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage)4 AnalysisEditor (org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor)3 ColumnAnalysisDetailsPage (org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 ArrayList (java.util.ArrayList)2 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)2 RepositoryNode (org.talend.repository.model.RepositoryNode)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 CheckedTreeSelectionDialog (org.eclipse.ui.dialogs.CheckedTreeSelectionDialog)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 ConnectionItem (org.talend.core.model.properties.ConnectionItem)1 Item (org.talend.core.model.properties.Item)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 AbstractAnalysisMetadataPage (org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage)1