Search in sources :

Example 6 with DBCatalogRepNode

use of org.talend.dq.nodes.DBCatalogRepNode in project tdq-studio-se by Talend.

the class DQRepNodeCreateFactory method createDBCatalogRepNode.

/**
 * this method is used to create a DBCatalogRepNode. And Sybase is a specal case because we don't create schema
 * level when the version of stdio is lower than 5.0.0.So we will create DBSybaseCatalogRepNode to deal with this
 * special case
 *
 * @param viewObject
 * @param parent parent of repositoryNode
 * @param type
 * @return
 */
public static RepositoryNode createDBCatalogRepNode(IRepositoryViewObject viewObject, RepositoryNode parent, ENodeType type, org.talend.core.model.general.Project inWhichProject) {
    Item databaseItem = viewObject.getProperty().getItem();
    DatabaseConnection dbConnection = (DatabaseConnection) ((DatabaseConnectionItem) databaseItem).getConnection();
    SupportDBUrlType dbTypeByKey = SupportDBUrlType.getDBTypeByKey(dbConnection.getDatabaseType());
    switch(dbTypeByKey == null ? SupportDBUrlType.MYSQLDEFAULTURL : dbTypeByKey) {
        case SYBASEDEFAULTURL:
            return new DBSybaseCatalogRepNode(viewObject, parent, type, inWhichProject);
        default:
            return new DBCatalogRepNode(viewObject, parent, type, inWhichProject);
    }
}
Also used : Item(org.talend.core.model.properties.Item) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) DBSybaseCatalogRepNode(org.talend.dq.nodes.DBSybaseCatalogRepNode) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) SupportDBUrlType(org.talend.core.model.metadata.builder.database.dburl.SupportDBUrlType)

Example 7 with DBCatalogRepNode

use of org.talend.dq.nodes.DBCatalogRepNode 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;
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ReportRepNode(org.talend.dq.nodes.ReportRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) DFTableRepNode(org.talend.dq.nodes.DFTableRepNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) PatternRepNode(org.talend.dq.nodes.PatternRepNode) DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DFColumnFolderRepNode(org.talend.dq.nodes.DFColumnFolderRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) RuleRepNode(org.talend.dq.nodes.RuleRepNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) RecycleBinRepNode(org.talend.dq.nodes.RecycleBinRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) ExchangeCategoryRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Example 8 with DBCatalogRepNode

use of org.talend.dq.nodes.DBCatalogRepNode 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 9 with DBCatalogRepNode

use of org.talend.dq.nodes.DBCatalogRepNode in project tdq-studio-se by Talend.

the class RepositoryNodeHelper method recursiveFindSchema.

public static DBSchemaRepNode recursiveFindSchema(Schema schema) {
    if (schema == null) {
        return null;
    }
    String uuidSchema = getUUID(schema);
    if (uuidSchema == null) {
        return null;
    }
    Catalog catalog = CatalogHelper.getParentCatalog(schema);
    // Schema's parent is catalog (MS SQL Server)
    if (catalog != null) {
        DBCatalogRepNode catalogNode = recursiveFindCatalog(catalog);
        List<IRepositoryNode> children = catalogNode.getChildren();
        if (children.size() > 0) {
            IRepositoryNode iRepositoryNode = children.get(0);
            if (iRepositoryNode != null && iRepositoryNode instanceof DBSchemaRepNode) {
                for (IRepositoryNode childNode : children) {
                    if (childNode != null && childNode instanceof DBSchemaRepNode) {
                        DBSchemaRepNode dbSchemaRepNode = (DBSchemaRepNode) childNode;
                        if (uuidSchema.equals(getUUID(dbSchemaRepNode.getSchema()))) {
                            return dbSchemaRepNode;
                        }
                    }
                }
            }
        }
    }
    // schema's parent is connection (e.g Oracle)
    IRepositoryNode connNode = recursiveFind(ConnectionHelper.getTdDataProvider(schema));
    if (connNode != null) {
        List<IRepositoryNode> children = connNode.getChildren();
        if (children.size() > 0) {
            IRepositoryNode iRepositoryNode = children.get(0);
            if (iRepositoryNode != null && iRepositoryNode instanceof DBSchemaRepNode) {
                for (IRepositoryNode childNode : children) {
                    if (childNode != null && childNode instanceof DBSchemaRepNode) {
                        DBSchemaRepNode dbSchemaRepNode = (DBSchemaRepNode) childNode;
                        if (uuidSchema.equals(getUUID(dbSchemaRepNode.getSchema()))) {
                            return dbSchemaRepNode;
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Catalog(orgomg.cwm.resource.relational.Catalog)

Example 10 with DBCatalogRepNode

use of org.talend.dq.nodes.DBCatalogRepNode in project tdq-studio-se by Talend.

the class RepositoryNodeHelper method recursiveFindCatalog.

public static DBCatalogRepNode recursiveFindCatalog(Catalog catalog) {
    if (catalog == null) {
        return null;
    }
    String uuidCatalog = getUUID(catalog);
    if (uuidCatalog == null) {
        return null;
    }
    IRepositoryNode connNode = recursiveFind(ConnectionHelper.getTdDataProvider(catalog));
    if (connNode == null) {
        return null;
    }
    List<IRepositoryNode> children = connNode.getChildren();
    if (children.size() > 0) {
        IRepositoryNode iRepositoryNode = children.get(0);
        if (iRepositoryNode != null && iRepositoryNode instanceof DBCatalogRepNode) {
            for (IRepositoryNode childNode : children) {
                if (childNode != null && childNode instanceof DBCatalogRepNode) {
                    DBCatalogRepNode dbCatalogRepNode = (DBCatalogRepNode) childNode;
                    if (uuidCatalog.equals(getUUID(dbCatalogRepNode.getCatalog()))) {
                        return dbCatalogRepNode;
                    }
                }
            }
        }
    }
    return null;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode)

Aggregations

DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)17 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)13 IRepositoryNode (org.talend.repository.model.IRepositoryNode)11 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)9 ArrayList (java.util.ArrayList)8 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)6 RepositoryNode (org.talend.repository.model.RepositoryNode)6 List (java.util.List)5 Connection (org.talend.core.model.metadata.builder.connection.Connection)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 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 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)4 PackagesAnalyisParameter (org.talend.dq.analysis.parameters.PackagesAnalyisParameter)4 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)4 Catalog (orgomg.cwm.resource.relational.Catalog)4 ExchangeCategoryRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode)3 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)3