use of org.talend.dq.nodes.DBViewRepNode 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.DBViewRepNode in project tdq-studio-se by Talend.
the class TablesSelectionDialog method addCheckedListener.
@Override
protected void addCheckedListener() {
// When user checks a checkbox in the tree, check all its children
getTreeViewer().addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
TreePath treePath = new TreePath(new Object[] { event.getElement() });
getTreeViewer().setSelection(new TreeSelection(treePath));
if (event.getChecked()) {
Object element = event.getElement();
getTreeViewer().setSubtreeChecked(element, true);
if (element instanceof IRepositoryNode) {
setOutput(element);
handleTablesChecked((IRepositoryNode) element, true);
}
} else {
Object element = event.getElement();
getTreeViewer().setSubtreeChecked(element, false);
if (element instanceof IRepositoryNode) {
setOutput(element);
handleTablesChecked((IRepositoryNode) element, false);
}
}
updateOKStatus();
}
});
getTableViewer().addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
Object element = event.getElement();
if (element instanceof DBTableRepNode || element instanceof DBViewRepNode) {
handleTableChecked((IRepositoryNode) element, event.getChecked());
}
}
});
}
use of org.talend.dq.nodes.DBViewRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method recursiveFindTdView.
public static DBViewRepNode recursiveFindTdView(TdView tdView) {
if (tdView == null) {
return null;
}
String uuidTdView = getUUID(tdView);
if (uuidTdView == null) {
return null;
}
IRepositoryNode schemaOrCatalogNode = recursiveFind(ColumnSetHelper.getParentCatalogOrSchema(tdView));
if (schemaOrCatalogNode == null) {
return null;
}
List<IRepositoryNode> children = schemaOrCatalogNode.getChildren().get(1).getChildren();
if (children.size() > 0) {
IRepositoryNode iRepositoryNode = children.get(0);
if (iRepositoryNode != null && iRepositoryNode instanceof DBViewRepNode) {
for (IRepositoryNode childNode : children) {
if (childNode != null && childNode instanceof DBViewRepNode) {
DBViewRepNode dbViewRepNode = (DBViewRepNode) childNode;
if (uuidTdView.equals(getUUID(dbViewRepNode.getTdView()))) {
return dbViewRepNode;
}
}
}
}
}
return null;
}
use of org.talend.dq.nodes.DBViewRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method createDBViewRepNode.
/**
* DOC talend Comment method "createDBViewRepNode".
*
* @param findModelElement
* @param lastVersion
* @return
*/
private static RepositoryNode createDBViewRepNode(TdView findModelElement, IRepositoryViewObject lastVersion) {
TdViewRepositoryObject tdViewRepositoryObject = new TdViewRepositoryObject(lastVersion, findModelElement);
tdViewRepositoryObject.setId(findModelElement.getName());
tdViewRepositoryObject.setLabel(findModelElement.getName());
DBViewRepNode dbViewRepNode = new DBViewRepNode(tdViewRepositoryObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
dbViewRepNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_COLUMN);
dbViewRepNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_COLUMN);
tdViewRepositoryObject.setRepositoryNode(dbViewRepNode);
return dbViewRepNode;
}
use of org.talend.dq.nodes.DBViewRepNode in project tdq-studio-se by Talend.
the class ImageLib method getImageNameByRepositoryNode.
public static String getImageNameByRepositoryNode(IRepositoryNode node) {
String imageName = null;
IRepositoryViewObject viewObject = node.getObject();
ENodeType type = node.getType();
if (node instanceof ReportAnalysisRepNode) {
imageName = ImageLib.ANALYSIS_OBJECT;
} else if (node instanceof RecycleBinRepNode) {
imageName = ImageLib.RECYCLEBIN_EMPTY;
} else if (type.equals(ENodeType.SYSTEM_FOLDER)) {
String label = viewObject.getLabel();
if (label.equals(EResourceConstant.DATA_PROFILING.getName())) {
imageName = ImageLib.DATA_PROFILING;
} else if (label.equals(EResourceConstant.METADATA.getName())) {
imageName = ImageLib.METADATA;
} else if (node instanceof DBConnectionFolderRepNode) {
imageName = ImageLib.CONNECTION;
} else if (label.equals(EResourceConstant.FILEDELIMITED.getName())) {
imageName = ImageLib.FILE_DELIMITED;
} else if (label.equals(EResourceConstant.HADOOP_CLUSTER.getName())) {
imageName = ImageLib.HADOOP_CLUSTER;
} else if (label.equals(EResourceConstant.LIBRARIES.getName())) {
imageName = ImageLib.LIBRARIES;
} else if (label.equals(EResourceConstant.EXCHANGE.getName())) {
imageName = ImageLib.EXCHANGE;
} else {
imageName = ImageLib.FOLDERNODE_IMAGE;
}
} else if (type.equals(ENodeType.SIMPLE_FOLDER)) {
imageName = ImageLib.FOLDERNODE_IMAGE;
} else if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
if (node instanceof DBConnectionRepNode) {
imageName = ImageLib.TD_DATAPROVIDER;
} else if (node instanceof DFConnectionRepNode) {
imageName = ImageLib.FILE_DELIMITED;
} else if (node instanceof AnalysisRepNode) {
imageName = ImageLib.ANALYSIS_OBJECT;
} else if (node instanceof ReportRepNode) {
imageName = ImageLib.REPORT_OBJECT;
} else if (node instanceof SysIndicatorDefinitionRepNode) {
imageName = ImageLib.IND_DEFINITION;
} else if (node instanceof PatternRepNode) {
imageName = ImageLib.PATTERN_REG;
} else if (node instanceof RuleRepNode) {
imageName = ImageLib.DQ_RULE;
} else if (node instanceof SourceFileRepNode) {
imageName = ImageLib.SOURCE_FILE;
} else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
imageName = ImageLib.EXCHANGE;
} else if (node instanceof JrxmlTempleteRepNode) {
imageName = ImageLib.JRXML_ICON;
}
} else if (type.equals(ENodeType.TDQ_REPOSITORY_ELEMENT)) {
if (node instanceof DBCatalogRepNode) {
imageName = ImageLib.CATALOG;
} else if (node instanceof DBSchemaRepNode) {
imageName = ImageLib.SCHEMA;
} else if (node instanceof DBTableFolderRepNode) {
imageName = ImageLib.FOLDERNODE_IMAGE;
} else if (node instanceof DBViewFolderRepNode) {
imageName = ImageLib.FOLDERNODE_IMAGE;
} else if (node instanceof DBTableRepNode || node instanceof DFTableRepNode) {
imageName = ImageLib.TABLE;
} else if (node instanceof DBViewRepNode) {
imageName = ImageLib.VIEW;
} else if (node instanceof DBColumnRepNode) {
if (((DBColumnRepNode) node).isKey()) {
imageName = ImageLib.PK_COLUMN;
} else {
imageName = ImageLib.TD_COLUMN;
}
} else if (node instanceof DFColumnRepNode) {
imageName = ImageLib.TD_COLUMN;
} else if (node instanceof DBColumnFolderRepNode || node instanceof DFColumnFolderRepNode) {
imageName = ImageLib.FOLDERNODE_IMAGE;
}
}
return imageName;
}
Aggregations