Search in sources :

Example 1 with ColumnSetRepNode

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

the class MatchAnalysisActionProvider method fillContextMenu.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
     */
@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection currentSelection = ((TreeSelection) this.getContext().getSelection());
    // Added TDQ-8647 yyin 20140221 :only when the selection is valid, the menu will be added
    if (currentSelection != null && !RepNodeUtils.isValidSelectionFromSameTable(currentSelection.toList())) {
        return;
    }
    matchAnalysisAction.setColumnSelection(currentSelection);
    // columns in the same columnset are selected; so only check the fist node in the selection is enough.
    if (currentSelection.toList().get(0) instanceof ColumnSetRepNode) {
        // $NON-NLS-1$
        matchAnalysisAction.setText(DefaultMessagesImpl.getString("MatchAnalysisAction.matchAnalysis"));
    } else {
        // $NON-NLS-1$
        matchAnalysisAction.setText(DefaultMessagesImpl.getString("MatchAnalysisAction.analyzeMatches"));
    }
    menu.add(matchAnalysisAction);
}
Also used : TreeSelection(org.eclipse.jface.viewers.TreeSelection) ColumnSetRepNode(org.talend.dq.nodes.ColumnSetRepNode)

Example 2 with ColumnSetRepNode

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

the class AnalysisColumnSetTreeViewer method setInput.

@Override
public void setInput(Object[] objs) {
    if (objs != null && objs.length != 0) {
        List<DBColumnRepNode> columnList = new ArrayList<DBColumnRepNode>();
        for (Object obj : objs) {
            // default is should be sql engine.
            if (obj instanceof DBTableRepNode || obj instanceof DBViewRepNode) {
                columnList.addAll((Collection<? extends DBColumnRepNode>) ((ColumnSetRepNode) obj).getAllColumns());
            } else if (obj instanceof DBColumnRepNode) {
                columnList.add((DBColumnRepNode) obj);
            }
        }
        // MOD yyi 2010-05-13 12828
        Collections.reverse(columnList);
        // MOD qiongli 2011-3-15 set DataFilterText disabled except TdColumn.
        if (masterPage.getDataFilterComp() != null) {
            masterPage.getDataFilterComp().getDataFilterText().setEnabled(!columnList.isEmpty());
            if (columnList.isEmpty()) {
                // when the selected column is not DB type,will disable the execute engine
                // combobox.
                masterPage.changeExecuteLanguageToJava(true);
            } else {
                // when the selected column is back to DB type, should enable the execute engine combobox again.
                masterPage.enableExecuteLanguage();
            }
        }
        ModelElementIndicator[] newSelects = translateSelectedNodeIntoIndicator(objs);
        List<ModelElementIndicator> indicatorList = new ArrayList<ModelElementIndicator>();
        if (newSelects != null) {
            // indicator;
            for (ModelElementIndicator column : newSelects) {
                // if the modelElementIndicators contains selected column, add the column in modelElementIndicators
                // to ColumnIndicatorList
                boolean isOld = false;
                for (ModelElementIndicator oldColumn : modelElementIndicators) {
                    if (oldColumn.getModelElementRepositoryNode().equals(column.getModelElementRepositoryNode())) {
                        indicatorList.add(oldColumn);
                        isOld = true;
                        break;
                    }
                }
                // else add this column in filterInputData to ColumnIndicatorList
                if (!isOld) {
                    indicatorList.add(column);
                }
            }
            this.modelElementIndicators = indicatorList.toArray(new ModelElementIndicator[indicatorList.size()]);
            this.setElements(modelElementIndicators);
        }
    } else {
        TreeItem[] items = this.tree.getItems();
        for (TreeItem item : items) {
            this.removeItemBranch(item);
        }
        super.setInput(objs);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) ArrayList(java.util.ArrayList) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) ColumnSetRepNode(org.talend.dq.nodes.ColumnSetRepNode) EObject(org.eclipse.emf.ecore.EObject) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 3 with ColumnSetRepNode

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

the class MatchAnalysisDetailsPage method updateAllKeys.

/**
 * if some columns are deleted : remove the blocking/match key which used this column ; if some column still there :
 * update the index info in their keys; if some new columns added : do nothing
 *
 * @param oldSelectedColumns
 */
private void updateAllKeys(List<IRepositoryNode> oldSelectedColumns) {
    for (IRepositoryNode oldSelectNode : oldSelectedColumns) {
        int newPosition = positionInNewSelectColumns(oldSelectNode);
        if (newPosition > -1) {
            // update the position of the column
            addColumnGivenIndex(oldSelectNode, newPosition);
        } else {
            // delete all keys which used this column
            if (selectAlgorithmSection.isVSRMode()) {
                matchingKeySection.removeKeyFromAllTab(oldSelectNode.getLabel());
            } else {
                matchAndSurvivorKeySection.removeKeyFromAllTab(oldSelectNode.getLabel());
            }
            blockingKeySection.removeBlockingKey(oldSelectNode.getLabel());
            this.particularDefaultSurvivorshipSection.removeParticularKey(oldSelectNode.getLabel());
        }
    }
    // add new columns
    for (IRepositoryNode selectedOne : this.selectedNodes) {
        if (!oldSelectedColumns.contains(selectedOne)) {
            // the old doesnot contain the current, it need to be added to the columnMap
            int positionInNewSelectColumns = positionInNewSelectColumns(selectedOne);
            if (selectedOne instanceof ColumnRepNode) {
                addColumnGivenIndex(selectedOne, positionInNewSelectColumns);
            } else if (selectedOne instanceof ColumnSetRepNode) {
                List<IRepositoryNode> colNodes = ((ColumnSetRepNode) selectedOne).getAllColumns();
                for (IRepositoryNode colNode : colNodes) {
                    addColumnGivenIndex(colNode, positionInNewSelectColumns);
                }
            }
        }
    }
    if (selectAlgorithmSection.isVSRMode()) {
        this.matchingKeySection.redrawnSubTableContent();
    } else {
        matchAndSurvivorKeySection.redrawnSubTableContent();
    }
    this.blockingKeySection.redrawnSubTableContent();
    this.particularDefaultSurvivorshipSection.redrawnSubTableContent();
}
Also used : ColumnRepNode(org.talend.dq.nodes.ColumnRepNode) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ColumnSetRepNode(org.talend.dq.nodes.ColumnSetRepNode) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList)

Example 4 with ColumnSetRepNode

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

the class RepNodeUtils method isSupportPatternFrequency.

/**
 * check whether the nodes can support pattern Frequency indicator for sql engine.
 *
 * @param nodes
 * @return
 */
public static boolean isSupportPatternFrequency(List<IRepositoryNode> nodes) {
    if (nodes != null && !nodes.isEmpty()) {
        Connection connection = null;
        if (nodes.get(0) instanceof ColumnRepNode) {
            MetadataColumn column = ((MetadataColumnRepositoryObject) nodes.get(0).getObject()).getTdColumn();
            connection = ConnectionHelper.getTdDataProvider(column);
        } else if (nodes.get(0) instanceof ColumnSetRepNode) {
            MetadataTable table = ((MetadataTableRepositoryObject) nodes.get(0).getObject()).getTable();
            connection = ConnectionHelper.getTdDataProvider(table);
        }
        if (connection != null && (ConnectionHelper.isTeradata(connection) || ConnectionHelper.isIngress(connection) || ConnectionHelper.isSybase(connection))) {
            return false;
        }
    }
    return true;
}
Also used : DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) ColumnRepNode(org.talend.dq.nodes.ColumnRepNode) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) Connection(org.talend.core.model.metadata.builder.connection.Connection) ColumnSetRepNode(org.talend.dq.nodes.ColumnSetRepNode) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)

Aggregations

ColumnSetRepNode (org.talend.dq.nodes.ColumnSetRepNode)4 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)3 ArrayList (java.util.ArrayList)2 ColumnRepNode (org.talend.dq.nodes.ColumnRepNode)2 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)1 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)1 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)1 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)1 DFColumnRepNode (org.talend.dq.nodes.DFColumnRepNode)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1