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);
}
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);
}
}
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();
}
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;
}
Aggregations