Search in sources :

Example 1 with DBTableFolderRepNode

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

the class OverviewResultPage method wapperInput.

/**
 * DOC klliu Comment method "wapperInput". relations
 *
 * @param indicatorTableList
 * @param parentNode
 * @return
 */
private List<OverviewIndUIElement> wapperInput(EList<TableIndicator> indicatorTableList, IRepositoryNode parentNode) {
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    List<IRepositoryNode> children = parentNode.getChildren();
    for (IRepositoryNode folderNode : children) {
        if (folderNode instanceof DBTableFolderRepNode) {
            List<IRepositoryNode> tableNodes = folderNode.getChildren();
            // MOD 20120315 klliu&yyin TDQ-2391, avoid getting many times for table nodes.
            for (TableIndicator indicator : indicatorTableList) {
                boolean equals = false;
                for (IRepositoryNode tableNode : tableNodes) {
                    MetadataTable table = ((MetadataTableRepositoryObject) tableNode.getObject()).getTable();
                    String name = table.getName();
                    String tableName = indicator.getTableName();
                    // String connUuid = ResourceHelper.getUUID(table);
                    // String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                    equals = name.equals(tableName);
                    if (equals) {
                        OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
                        tableUIEle.setNode(tableNode);
                        tableUIEle.setOverviewIndicator(indicator);
                        if (DqRepositoryViewService.isComeFromRefrenceProject(getTdDataProvider()) && ColumnSetHelper.getColumns((ColumnSet) table).isEmpty()) {
                            tableUIEle.setVirtualNode(true);
                        }
                        cataUIEleList.add(tableUIEle);
                        break;
                    }
                }
                if (!equals) {
                    OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
                    tableUIEle.setOverviewIndicator(indicator);
                    tableUIEle.setVirtualNode(true);
                    cataUIEleList.add(tableUIEle);
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) TableIndicator(org.talend.dataquality.indicators.schema.TableIndicator) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)

Example 2 with DBTableFolderRepNode

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

the class CatalogSchemaComparisonLevel method getPackageFromRepositoryNode.

/**
 * get the Package from the RepositoryNode.
 *
 * @param node
 * @return a Package or null
 */
private Package getPackageFromRepositoryNode(RepositoryNode node) {
    Package result = null;
    if (node instanceof DBTableFolderRepNode) {
        DBTableFolderRepNode tableFolderRepNode = (DBTableFolderRepNode) node;
        result = tableFolderRepNode.getPackage();
    } else if (node instanceof DBViewFolderRepNode) {
        DBViewFolderRepNode viewFolderRepNode = (DBViewFolderRepNode) node;
        result = viewFolderRepNode.getPackage();
    } else {
        result = (Package) RepositoryNodeHelper.getMetadataElement((RepositoryNode) selectedObj);
    }
    return result;
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) 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 3 with DBTableFolderRepNode

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

the class TablesSelectionDialog method getAllCheckedTables.

private List<IRepositoryNode> getAllCheckedTables() {
    Object[] checkedNodes = this.getTreeViewer().getCheckedElements();
    List<IRepositoryNode> tableList = new ArrayList<IRepositoryNode>();
    for (Object obj : checkedNodes) {
        if (!(obj instanceof DBTableFolderRepNode || obj instanceof DBViewFolderRepNode)) {
            continue;
        }
        IRepositoryNode node = (IRepositoryNode) obj;
        RepositoryNodeKey packageKey = new RepositoryNodeKey(node);
        if (packageCheckedMap.containsKey(packageKey)) {
            tableList.addAll(packageCheckedMap.get(packageKey));
        } else {
            tableList.addAll(RepositoryNodeHelper.getNamedColumnSetNodes(node));
        }
    }
    // ADD msjian 2011-7-8 feature 22206: Add filters
    // add the miss of before checked when use the filter
    Iterator<?> it = packageCheckedMap.keySet().iterator();
    while (it.hasNext()) {
        RepositoryNodeKey packageKey = (RepositoryNodeKey) it.next();
        List<?> checkedTableNodeList = packageCheckedMap.get(packageKey);
        if (checkedTableNodeList != null) {
            for (int i = 0; i < checkedTableNodeList.size(); i++) {
                if (!tableList.contains(checkedTableNodeList.get(i))) {
                    tableList.add((IRepositoryNode) checkedTableNodeList.get(i));
                }
            }
        }
    }
    return tableList;
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode)

Example 4 with DBTableFolderRepNode

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

the class ResourceViewContentProvider method getRepositoryNodeChildren.

/**
 * DOC talend Comment method "getRepositoryNodeChildren".
 *
 * @param element
 * @param instance
 * @return
 * @throws PersistenceException
 * @throws CoreException
 */
private Object[] getRepositoryNodeChildren(Object element) throws PersistenceException, CoreException {
    final DQRepositoryNode node = (DQRepositoryNode) element;
    // MOD gdbu 2011-7-20 bug : 23220
    DQRepositoryNode.setIsReturnAllNodesWhenFiltering(false);
    List<IRepositoryNode> children = node.getChildren();
    DQRepositoryNode.setIsReturnAllNodesWhenFiltering(true);
    if ((node instanceof DBTableFolderRepNode || node instanceof DBViewFolderRepNode || node instanceof DBColumnFolderRepNode) && !DQRepositoryNode.isOnFilterring()) {
        if (0 < children.size()) {
            try {
                StructuredSelection structSel = new StructuredSelection(node);
                if (null != treeViewer) {
                    ISelection tempSelection = treeViewer.getSelection();
                    treeViewer.setSelection(structSel);
                    TreeItem[] selectionItems = treeViewer.getTree().getSelection();
                    if (0 != selectionItems.length) {
                        selectionItems[0].setText(node.getLabel());
                        treeViewer.setSelection(tempSelection);
                    }
                } else {
                    ISelection dqTreeSelection = RepositoryNodeHelper.getDQCommonViewer().getSelection();
                    RepositoryNodeHelper.getDQCommonViewer().setSelection(structSel);
                    TreeItem[] selections = RepositoryNodeHelper.getDQCommonViewer().getTree().getSelection();
                    if (0 != selections.length) {
                        selections[0].setText(node.getLabel());
                    }
                    RepositoryNodeHelper.getDQCommonViewer().setSelection(dqTreeSelection);
                }
            } catch (Exception e) {
                log.error(e.toString());
            }
        }
    }
    if (children.size() <= 0) {
        // ~23220
        List<EResourceConstant> resContants = new ArrayList<EResourceConstant>();
        IRepositoryViewObject viewObject = node.getObject();
        String label = viewObject == null ? null : viewObject.getLabel();
        if (EResourceConstant.DATA_PROFILING.getName().equals(label)) {
            resContants.add(EResourceConstant.ANALYSIS);
            if (PluginChecker.isTDQLoaded()) {
                resContants.add(EResourceConstant.REPORTS);
            }
        } else if (EResourceConstant.LIBRARIES.getName().equals(label)) {
            // MOD TDQ-10933 msjian 20150915: Hide the Exchange node
            if (!TalendPropertiesUtil.isHideExchange()) {
                resContants.add(EResourceConstant.EXCHANGE);
            }
            // TDQ-10933~
            resContants.add(EResourceConstant.INDICATORS);
            if (PluginChecker.isTDQLoaded()) {
                resContants.add(EResourceConstant.JRXML_TEMPLATE);
            }
            resContants.add(EResourceConstant.PATTERNS);
            resContants.add(EResourceConstant.RULES);
            resContants.add(EResourceConstant.SOURCE_FILES);
        } else if (EResourceConstant.METADATA.getName().equals(label)) {
            resContants.add(EResourceConstant.DB_CONNECTIONS);
            resContants.add(EResourceConstant.FILEDELIMITED);
            if (PluginChecker.isTDQLoaded() && HadoopClusterUtils.getDefault().isServiceInstalled()) {
                resContants.add(EResourceConstant.HADOOP_CLUSTER);
            }
        }
        if (resContants.size() > 0) {
            RepositoryNodeBuilder.getInstance().createRepositoryNodeSystemFolders(node, resContants, node.getProject());
        }
    } else {
        // to avoid can not get reference project nodes when open the select udi/pattern/rule dialog
        if (EResourceConstant.REFERENCED_PROJECT.getName().equals(node.getProperties(EProperties.LABEL))) {
            if (!ProxyRepositoryManager.getInstance().isMergeRefProject()) {
                for (IRepositoryNode refProjectNode : node.getChildren()) {
                    for (IRepositoryNode refProjectItemNode : refProjectNode.getChildren()) {
                        getRepositoryNodeChildren(refProjectItemNode);
                    }
                }
            }
        }
    }
    if (node instanceof ContextFolderRepNode) {
        children = ((ContextFolderRepNode) node).getChildren();
    }
    return sortRepositoryNode(children.toArray());
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) EResourceConstant(org.talend.resource.EResourceConstant) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeItem(org.eclipse.swt.widgets.TreeItem) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArrayList(java.util.ArrayList) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) CoreException(org.eclipse.core.runtime.CoreException) MissingDriverException(org.talend.utils.exceptions.MissingDriverException) PersistenceException(org.talend.commons.exception.PersistenceException) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ContextFolderRepNode(org.talend.dq.nodes.ContextFolderRepNode)

Example 5 with DBTableFolderRepNode

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

the class TableUtils method getTableFolder.

/**
 * find the table folder node under selectedHive node. currently, only under default db. Added TDQ-10328
 *
 * @param hiveConnectionItem2
 * @return
 */
public static RepositoryNode getTableFolder(final DatabaseConnectionItem hiveConnectionItem) {
    RepositoryNode hiveNode = RepositoryNodeHelper.recursiveFind(hiveConnectionItem.getProperty());
    CorePlugin.getDefault().refreshDQView(hiveNode);
    List<IRepositoryNode> children = hiveNode.getChildren();
    RepositoryNode tableFolder = null;
    for (IRepositoryNode child : children) {
        if (StringUtils.equals("default", child.getLabel())) {
            // $NON-NLS-1$
            List<IRepositoryNode> folders = child.getChildren();
            for (IRepositoryNode folder : folders) {
                if (folder instanceof DBTableFolderRepNode) {
                    return (RepositoryNode) folder;
                }
            }
        }
    }
    return tableFolder;
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

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