Search in sources :

Example 11 with TdTableRepositoryObject

use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.

the class DBColumnFolderRepNode method getChildrenCount.

/**
 * TDQ-11431: use this way to get children count correctly.
 *
 * @return
 */
private int getChildrenCount() {
    List<TdColumn> columnsList = new ArrayList<TdColumn>();
    IRepositoryViewObject object = this.getParent().getObject();
    if (object instanceof TdTableRepositoryObject) {
        tdTable = (TdTable) ((TdTableRepositoryObject) object).getTable();
        columnsList = TableHelper.getColumns(tdTable);
    } else {
        tdView = ((TdViewRepositoryObject) object).getTdView();
        columnsList = ViewHelper.getColumns(tdView);
    }
    return columnsList.size();
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject)

Example 12 with TdTableRepositoryObject

use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.

the class DBTableFolderRepNode method createTableRepositoryNode.

/**
 * DOC klliu Comment method "createTableRepositoryNode".
 *
 * @param tables
 */
private void createTableRepositoryNode(List<TdTable> tables, List<IRepositoryNode> node) {
    if (tables != null) {
        for (TdTable table : tables) {
            // $NON-NLS-1$
            table.setTableType("TABLE");
            TdTableRepositoryObject metadataTable = new TdTableRepositoryObject(viewObject, table);
            metadataTable.setTableName(table.getName());
            metadataTable.setLabel(table.getName());
            metadataTable.setId(table.getName());
            DBTableRepNode tableNode = new DBTableRepNode(metadataTable, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            tableNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_TABLE);
            tableNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_TABLE);
            metadataTable.setRepositoryNode(tableNode);
            node.add(tableNode);
        }
    }
}
Also used : TdTable(org.talend.cwm.relational.TdTable) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject)

Example 13 with TdTableRepositoryObject

use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.

the class CreateColumnAnalysis method init.

@Override
public void init(ICommonActionExtensionSite site) {
    if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
        StructuredSelection selection = (StructuredSelection) site.getStructuredViewer().getSelection();
        Object fe = selection.getFirstElement();
        if (fe instanceof IRepositoryNode) {
            IRepositoryViewObject object = ((IRepositoryNode) fe).getObject();
            if (object instanceof TdTableRepositoryObject) {
                TdTableRepositoryObject tableObject = (TdTableRepositoryObject) object;
                modelElement = tableObject.getTdTable();
            } else if (object instanceof TdViewRepositoryObject) {
                TdViewRepositoryObject viewObject = (TdViewRepositoryObject) object;
                modelElement = viewObject.getTdView();
            }
        }
    }
    super.init(site);
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)

Aggregations

TdTableRepositoryObject (org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject)13 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)10 TdViewRepositoryObject (org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject)8 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 TdTable (org.talend.cwm.relational.TdTable)5 RepositoryNode (org.talend.repository.model.RepositoryNode)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 ICommonViewerWorkbenchSite (org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)3 TdColumn (org.talend.cwm.relational.TdColumn)3 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)3 Test (org.junit.Test)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)2 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)2 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)2 TdView (org.talend.cwm.relational.TdView)2 Catalog (orgomg.cwm.resource.relational.Catalog)2 ArrayList (java.util.ArrayList)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1