use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class SemanticDiscoveryActionProvider 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());
Object firstElement = currentSelection.getFirstElement();
boolean selectedMoreThanOne = currentSelection.size() > 1;
// keep all of columns belong to same one table and create SemanticDiscoveryAction.
if (selectedMoreThanOne || firstElement instanceof ColumnRepNode) {
Set<String> currentTableSet = new HashSet<String>();
MetadataTable createTable = ConnectionFactory.eINSTANCE.createMetadataTable();
List<String> filterNames = new ArrayList<String>();
Iterator<Object> columnIterator = currentSelection.iterator();
while (columnIterator.hasNext()) {
Object columnNode = columnIterator.next();
MetadataColumn metadataColumn = null;
if (DBColumnRepNode.class.isInstance(columnNode)) {
metadataColumn = ((DBColumnRepNode) columnNode).getTdColumn();
createTable = ColumnHelper.getColumnOwnerAsMetadataTable(metadataColumn);
} else if (DFColumnRepNode.class.isInstance(columnNode)) {
metadataColumn = ((DFColumnRepNode) columnNode).getMetadataColumn();
createTable = ColumnHelper.getColumnOwnerAsMetadataTable(metadataColumn);
} else {
// If not all of elements which be selected is columns
return;
}
currentTableSet.add(ResourceHelper.getUUID(createTable));
// all of columns should come from same table
if (currentTableSet.size() > 1) {
return;
}
filterNames.add(metadataColumn.getName());
}
MetadataTable metadataTableWithFilter = new MetadataTableWithFilter(filterNames, createTable);
semanticDiscoveryAction = new SemanticDiscoveryAction(metadataTableWithFilter);
} else {
// otherwise the selection is valid, only two possible status: only one columnset is select.
if (firstElement instanceof DBTableRepNode) {
DBTableRepNode node = (DBTableRepNode) firstElement;
semanticDiscoveryAction = new SemanticDiscoveryAction(node.getTdTable());
} else if (firstElement instanceof DBViewRepNode) {
DBViewRepNode node = (DBViewRepNode) firstElement;
semanticDiscoveryAction = new SemanticDiscoveryAction(node.getTdView());
} else if (firstElement instanceof DFTableRepNode) {
DFTableRepNode node = (DFTableRepNode) firstElement;
semanticDiscoveryAction = new SemanticDiscoveryAction(node.getMetadataTable());
}
}
menu.add(semanticDiscoveryAction);
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class PreviewColumnProvider method fillContextMenu.
@Override
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
TreeSelection treeSelection = ((TreeSelection) this.getContext().getSelection());
List<TdColumn> list = new ArrayList<TdColumn>();
Object[] selectedObjs = treeSelection.toArray();
for (Object obj : selectedObjs) {
// MOD msjian 2011-12-7 TDQ-4091: the tdColumn info is not correct
if (obj instanceof DBColumnRepNode) {
list.add(((DBColumnRepNode) obj).getTdColumn());
}
// TDQ-4091 ~
}
if (!list.isEmpty()) {
PreviewColumnAction action = new PreviewColumnAction(list.toArray(new TdColumn[list.size()]));
menu.add(action);
}
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method createMetadataColumnRepNode.
/**
* create a temp RepNode there is a lack of parent attribute
*
* @param findColumn
*/
private static DBColumnRepNode createMetadataColumnRepNode(TdColumn findColumn, IRepositoryViewObject lastVersion) {
MetadataColumnRepositoryObject metadataColumn = new MetadataColumnRepositoryObject(lastVersion, findColumn);
metadataColumn.setId(findColumn.getName());
metadataColumn.setLabel(findColumn.getName());
DBColumnRepNode columnNode = new DBColumnRepNode(metadataColumn, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
columnNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_COLUMN);
columnNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_COLUMN);
metadataColumn.setRepositoryNode(columnNode);
return columnNode;
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method recursiveFindTdColumn.
public static DBColumnRepNode recursiveFindTdColumn(TdColumn tdColumn) {
if (tdColumn == null) {
return null;
}
String uuidTdColumn = getUUID(tdColumn);
if (uuidTdColumn == null) {
return null;
}
IRepositoryNode columnSetNode = recursiveFind(ColumnHelper.getColumnOwnerAsColumnSet(tdColumn));
if (columnSetNode == null) {
return null;
}
// MOD gdbu 2011-7-18 bug 23161
List<IRepositoryNode> childrens = columnSetNode.getChildren();
if (childrens.size() == 0) {
return null;
}
List<IRepositoryNode> children = childrens.get(0).getChildren();
if (children.size() == 0) {
return null;
}
// ~23161
IRepositoryNode iRepositoryNode = children.get(0);
if (iRepositoryNode != null && iRepositoryNode instanceof DBColumnRepNode) {
for (IRepositoryNode childNode : children) {
if (childNode != null && childNode instanceof DBColumnRepNode) {
DBColumnRepNode dbColumnRepNode = (DBColumnRepNode) childNode;
if (uuidTdColumn.equals(getUUID(dbColumnRepNode.getTdColumn()))) {
return dbColumnRepNode;
}
}
}
}
return null;
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class CorrelationAnalysisDetailsPage method canSave.
@Override
public ReturnCode canSave() {
// MOD by gdbu 2011-3-21 bug 19179
ReturnCode canModRetCode = super.canSave();
if (!canModRetCode.isOk()) {
return canModRetCode;
}
// ~19179
String message = null;
List<RepositoryNode> columnSetMultiValueList = getTreeViewer().getColumnSetMultiValueList();
if (!columnSetMultiValueList.isEmpty()) {
// MOD qiongli 2010-8-19.bug 14436.move some codes to the method of 'canDrop()', which judge to come
// from same table
List<RepositoryNode> nodes = treeViewer.getColumnSetMultiValueList();
if (ColumnsetPackage.eINSTANCE.getCountAvgNullIndicator() == columnSetMultiIndicator.eClass() || ColumnsetPackage.eINSTANCE.getMinMaxDateIndicator() == columnSetMultiIndicator.eClass()) {
message = verifyColumn(nodes, columnSetMultiIndicator.eClass());
} else if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
List<DBColumnRepNode> columnNodes = RepositoryNodeHelper.getColumnNodeList(nodes.toArray());
for (DBColumnRepNode columNode : columnNodes) {
TdColumn tdColumn = columNode.getTdColumn();
if (correlationAnalysisHandler.getDatamingType(tdColumn) != DataminingType.NOMINAL) {
// $NON-NLS-1$
message = DefaultMessagesImpl.getString("ColumnCorrelationNominalAndIntervalMasterPage.NotAllNominal");
break;
}
}
}
}
if (message == null) {
return new ReturnCode(true);
}
return new ReturnCode(message, false);
}
Aggregations