Search in sources :

Example 11 with DBConnectionRepNode

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);
}
Also used : AbstractViewerFilter(org.talend.dataprofiler.core.ui.filters.AbstractViewerFilter) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) Viewer(org.eclipse.jface.viewers.Viewer) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) ISubRepositoryObject(org.talend.core.model.repository.ISubRepositoryObject) Property(org.talend.core.model.properties.Property)

Example 12 with DBConnectionRepNode

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();
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 13 with DBConnectionRepNode

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;
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DataProviderComparisonLevel(org.talend.cwm.compare.factory.comparisonlevel.DataProviderComparisonLevel) DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) RepositoryObjectComparisonLevel(org.talend.cwm.compare.factory.comparisonlevel.RepositoryObjectComparisonLevel) Connection(org.talend.core.model.metadata.builder.connection.Connection) CatalogSchemaComparisonLevel(org.talend.cwm.compare.factory.comparisonlevel.CatalogSchemaComparisonLevel) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) TableViewComparisonLevel(org.talend.cwm.compare.factory.comparisonlevel.TableViewComparisonLevel) FileMetadataTableComparisonLevel(org.talend.cwm.compare.factory.comparisonlevel.FileMetadataTableComparisonLevel) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode)

Example 14 with DBConnectionRepNode

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);
        }
    }
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ISubRepositoryObject(org.talend.core.model.repository.ISubRepositoryObject)

Example 15 with DBConnectionRepNode

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;
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ISubRepositoryObject(org.talend.core.model.repository.ISubRepositoryObject)

Aggregations

DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)26 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)14 IRepositoryNode (org.talend.repository.model.IRepositoryNode)12 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)9 Connection (org.talend.core.model.metadata.builder.connection.Connection)8 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)8 RepositoryNode (org.talend.repository.model.RepositoryNode)8 ArrayList (java.util.ArrayList)6 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)6 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)4 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)4 PersistenceException (org.talend.commons.exception.PersistenceException)4 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)4 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)4 DFConnectionRepNode (org.talend.dq.nodes.DFConnectionRepNode)4 List (java.util.List)3 Test (org.junit.Test)3 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)3