use of org.talend.dq.nodes.DBConnectionRepNode in project tdq-studio-se by Talend.
the class TwoPartCheckSelectionDialog method addConnFilterListener.
/**
* DOC mzhao 2009-05-05 bug: 6587, Add connection metadata filter.
*/
private void addConnFilterListener() {
AbstractViewerFilter connFiler = new AbstractViewerFilter() {
@Override
public int getId() {
return 0;
}
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof DBConnectionRepNode) {
DBConnectionRepNode node = (DBConnectionRepNode) element;
Integer selectIndex = metadataFormPage.getConnCombo().getSelectionIndex();
Integer connectionIndex = null;
Property property = (node.getObject()).getProperty();
ModelElement modelelement = PropertyHelper.getModelElement(property);
String dataKey = property.getDisplayName() + RepositoryNodeHelper.getConnectionType(node);
// $NON-NLS-1$
Object value = metadataFormPage.getConnCombo().getData(modelelement == null ? "" : dataKey);
if (value != null && value instanceof Integer) {
connectionIndex = (Integer) value;
}
return (connectionIndex != null && selectIndex.intValue() == connectionIndex.intValue());
}
return true;
}
};
addFilter(connFiler);
}
use of org.talend.dq.nodes.DBConnectionRepNode in project tdq-studio-se by Talend.
the class OverviewAnalysisAction method run.
@Override
public void run() {
PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
catalogs.clear();
for (IRepositoryNode node : nodes) {
if (node instanceof DBConnectionRepNode) {
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) node);
connNode = (DBConnectionRepNode) node;
} else if (node instanceof DBCatalogRepNode) {
IRepositoryNode parent = ((DBCatalogRepNode) node).getParent();
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) parent);
catalogs.add(node);
packaFilterParameter.setPackages(catalogs);
cataNode = (DBCatalogRepNode) node;
} else if (node instanceof DBSchemaRepNode) {
IRepositoryNode parent = ((DBSchemaRepNode) node).getParent();
schemaNode = (DBSchemaRepNode) node;
if (parent instanceof DBCatalogRepNode) {
IRepositoryNode connNode = ((DBCatalogRepNode) parent).getParent();
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) connNode);
catalogs.add(schemaNode);
packaFilterParameter.setPackages(catalogs);
} else {
catalogs.add(schemaNode);
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) parent);
packaFilterParameter.setPackages(catalogs);
}
}
}
Wizard wizard = null;
if (connNode != null) {
packaFilterParameter.setConnectionRepNode(connNode);
wizard = WizardFactory.createAnalysisWizard(AnalysisType.CONNECTION, packaFilterParameter);
} else if (cataNode != null) {
wizard = WizardFactory.createAnalysisWizard(AnalysisType.CATALOG, packaFilterParameter);
} else if (schemaNode != null) {
wizard = WizardFactory.createAnalysisWizard(AnalysisType.SCHEMA, packaFilterParameter);
}
WizardDialog dialog = new WizardDialog(null, wizard);
dialog.setPageSize(WIDTH, HEIGHT);
dialog.open();
}
use of org.talend.dq.nodes.DBConnectionRepNode in project tdq-studio-se by Talend.
the class ComparisonLevelFactory method creatComparisonLevel.
public static IComparisonLevel creatComparisonLevel(Object selectedObject) {
IComparisonLevel comparisonLevel = null;
if (selectedObject instanceof DBConnectionRepNode) {
// MOD klliu 2011-02-24 bug 19015
IRepositoryViewObject resObject = ((DBConnectionRepNode) selectedObject).getObject();
comparisonLevel = new RepositoryObjectComparisonLevel(resObject);
} else if (selectedObject instanceof DBTableFolderRepNode) {
// MOD mzhao FolderNode param need to pass for later reloading from this folder.
DBTableFolderRepNode dbFolderNode = (DBTableFolderRepNode) selectedObject;
comparisonLevel = new CatalogSchemaComparisonLevel(dbFolderNode);
} else if (selectedObject instanceof DBViewFolderRepNode) {
// MOC yyin 20121101, TDQ-6092, add a condition for the db which donot have catalog, like oracle.
if ((null == ((DBViewFolderRepNode) selectedObject).getCatalog()) && (((DBViewFolderRepNode) selectedObject).getParent() instanceof DBConnectionFolderRepNode)) {
// MOD yyi 2011-07-14 21512:the selected obj is db connection in this case
IRepositoryViewObject resObject = ((DBViewFolderRepNode) selectedObject).getParent().getObject();
comparisonLevel = new RepositoryObjectComparisonLevel(resObject);
} else {
DBViewFolderRepNode dbFolderNode = (DBViewFolderRepNode) selectedObject;
comparisonLevel = new CatalogSchemaComparisonLevel(dbFolderNode);
}
} else if (selectedObject instanceof DBColumnFolderRepNode) {
DBColumnFolderRepNode dbFolderNode = (DBColumnFolderRepNode) selectedObject;
comparisonLevel = new TableViewComparisonLevel(dbFolderNode);
} else if (selectedObject instanceof MetadataTable) {
MetadataTable resObject = (MetadataTable) selectedObject;
comparisonLevel = new FileMetadataTableComparisonLevel(resObject);
} else if (selectedObject instanceof Connection) {
// MOD qiongli 2011-9-5 feature TDQ-3317.
comparisonLevel = new DataProviderComparisonLevel(selectedObject);
} else {
comparisonLevel = null;
}
return comparisonLevel;
}
use of org.talend.dq.nodes.DBConnectionRepNode in project tdq-studio-se by Talend.
the class AbstractAnalysisMetadataPage method setSampleDataShowWayStatus.
protected void setSampleDataShowWayStatus() {
if (sampleDataShowWayCombo != null) {
sampleDataShowWayCombo.setEnabled(true);
Object data = getConnComboSelectNode();
if (data != null) {
if (data instanceof DBConnectionRepNode) {
DBConnectionRepNode dbConnRepNode = (DBConnectionRepNode) data;
// $NON-NLS-1$
String databaseType = dbConnRepNode.getDatabaseConnection().getDatabaseType() == null ? "" : dbConnRepNode.getDatabaseConnection().getDatabaseType();
if (databaseType.toLowerCase().contains("informix") || databaseType.toLowerCase().contains("sybase")) {
// $NON-NLS-1$ //$NON-NLS-2$
sampleDataShowWayCombo.select(0);
sampleDataShowWayCombo.setEnabled(false);
}
} else if (data instanceof DFConnectionRepNode) {
sampleDataShowWayCombo.select(0);
sampleDataShowWayCombo.setEnabled(false);
}
} else {
sampleDataShowWayCombo.select(0);
sampleDataShowWayCombo.setEnabled(false);
}
}
}
use of org.talend.dq.nodes.DBConnectionRepNode in project tdq-studio-se by Talend.
the class AbstractAnalysisMetadataPage method getConnectionVersionDefault.
/**
* get the default connection's version of this analysis.
*
* @returnd efault connection's version
*/
private String getConnectionVersionDefault() {
// $NON-NLS-1$
String version = "Unknown";
Object data = getConnComboSelectNode();
if (data != null) {
if (data instanceof DBConnectionRepNode) {
DBConnectionRepNode dbConnRepNode = (DBConnectionRepNode) data;
if (dbConnRepNode.getObject() != null && dbConnRepNode.getObject().getProperty() != null) {
version = dbConnRepNode.getObject().getProperty().getVersion();
}
} else if (data instanceof DFConnectionRepNode) {
DFConnectionRepNode dfConnRepNode = (DFConnectionRepNode) data;
if (dfConnRepNode.getObject() != null && dfConnRepNode.getObject().getProperty() != null) {
version = dfConnRepNode.getObject().getProperty().getVersion();
}
}
}
return version;
}
Aggregations