Search in sources :

Example 6 with DBTableFolderRepNode

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

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

the class TestComparisonLevelFactoryTest method testCreatComparisonLevelObject_2.

/**
 * Test method for
 * {@link org.talend.cwm.compare.factory.ComparisonLevelFactory#creatComparisonLevel(java.lang.Object)}. test for
 * the type of : table folder rep node
 */
@Test
public void testCreatComparisonLevelObject_2() {
    RepositoryNode dbCatalogRepNode = createCatalogRepNode();
    DBTableFolderRepNode dbTableFolderRepNode = new DBTableFolderRepNode(null, dbCatalogRepNode, null, null);
    IComparisonLevel level = ComparisonLevelFactory.creatComparisonLevel(dbTableFolderRepNode);
    Assert.assertTrue(level instanceof CatalogSchemaComparisonLevel);
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) CatalogSchemaComparisonLevel(org.talend.cwm.compare.factory.comparisonlevel.CatalogSchemaComparisonLevel) Test(org.junit.Test)

Example 8 with DBTableFolderRepNode

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

the class CatalogSchemaComparisonLevel method findDataProvider.

@Override
protected Connection findDataProvider() {
    Connection provider = null;
    if (selectedObj instanceof RepositoryNode) {
        if (selectedObj instanceof DBTableFolderRepNode || selectedObj instanceof DBViewFolderRepNode) {
            provider = ConnectionHelper.getTdDataProvider(getPackageFromObject(selectedObj));
        }
        Item connItem = null;
        IRepositoryViewObject object = ((RepositoryNode) selectedObj).getObject();
        if (null != object) {
            connItem = object.getProperty().getItem();
        } else {
            connItem = ((RepositoryNode) selectedObj).getParent().getObject().getProperty().getItem();
        }
        provider = ((ConnectionItem) connItem).getConnection();
    } else if (selectedObj instanceof Package) {
        provider = ConnectionHelper.getTdDataProvider((Package) selectedObj);
    }
    return provider;
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) Connection(org.talend.core.model.metadata.builder.connection.Connection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Package(orgomg.cwm.objectmodel.core.Package) RepositoryNode(org.talend.repository.model.RepositoryNode) DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode)

Example 9 with DBTableFolderRepNode

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

the class ReloadDatabaseProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    // MOD bug 16532 scorreia 2010-10-19 hide menu when not in TOP standalone
    // if (!PluginChecker.isOnlyTopLoaded()) {
    // return;
    // }
    // ~
    Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
    if (obj instanceof RepositoryNode) {
        RepositoryNode node = (RepositoryNode) obj;
        if (shouldShowReloadMenu(node)) {
            String menuText = RELOADDATABASE_MENUTEXT;
            if (node instanceof DBTableFolderRepNode) {
                menuText = RELOADTABLES_MENUTEXT;
            } else if (node instanceof DBViewFolderRepNode) {
                menuText = RELOADVIEWS_MENUTEXT;
            } else if (node instanceof DBColumnFolderRepNode) {
                menuText = RELOADCOLUMNS_MENUTEXT;
            }
            // menu.add(new ReloadDatabaseAction(node.getObject(), menuText));
            menu.add(new ReloadDatabaseAction(node, menuText));
        }
    }
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) ReloadDatabaseAction(org.talend.cwm.compare.ui.actions.ReloadDatabaseAction) TreeSelection(org.eclipse.jface.viewers.TreeSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryNode(org.talend.repository.model.RepositoryNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode)

Example 10 with DBTableFolderRepNode

use of org.talend.dq.nodes.DBTableFolderRepNode 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)

Aggregations

DBTableFolderRepNode (org.talend.dq.nodes.DBTableFolderRepNode)15 DBViewFolderRepNode (org.talend.dq.nodes.DBViewFolderRepNode)11 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)8 RepositoryNode (org.talend.repository.model.RepositoryNode)8 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 DBColumnFolderRepNode (org.talend.dq.nodes.DBColumnFolderRepNode)6 ArrayList (java.util.ArrayList)3 Connection (org.talend.core.model.metadata.builder.connection.Connection)3 ExchangeCategoryRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode)3 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)3 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)3 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)3 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)3 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)3 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)3 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)3 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 Test (org.junit.Test)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)2