Search in sources :

Example 1 with TdTableRepositoryObject

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

the class AbstractCommonActionProviderRealProjectTest method testGetConnectionCase8.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.action.provider.AbstractCommonActionProvider#getConnection(java.lang.Object)}
 * . case8 :input parameter is DBColumnFolderRepNode
 */
@Test
public void testGetConnectionCase8() {
    // create FileConnection
    // connection
    IRepositoryViewObject lastVersion = null;
    String propertyID = createConnectionItem(connectionName, null, null);
    TdTable createTdTable = RelationalFactoryImpl.eINSTANCE.createTdTable();
    RepositoryNode dbCatalogRepNode = null;
    // $NON-NLS-1$
    createTdTable.setName("table1");
    try {
        lastVersion = factory.getLastVersion(propertyID);
        dbCatalogRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(lastVersion, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
        lastVersion = new TdTableRepositoryObject(lastVersion, createTdTable);
    } catch (PersistenceException e) {
        log.error(e, e);
        Assert.fail(e.getMessage());
    }
    // ~connection data
    // ~FileConnection
    // create DFColumnFolderRepNode
    Assert.assertFalse(lastVersion == null);
    DBTableRepNode dbTableRepNode = new DBTableRepNode(lastVersion, dbCatalogRepNode, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
    DBColumnFolderRepNode dbColumnFolderRepNode = new DBColumnFolderRepNode(null, dbTableRepNode, null, null);
    // ~DFColumnFolderRepNode
    AbstractCommonActionProvider provider = new AbstractCommonActionProvider();
    Connection connection = provider.getConnection(dbColumnFolderRepNode);
    Assert.assertTrue(connection != null);
}
Also used : DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) TdTable(org.talend.cwm.relational.TdTable) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) RepositoryNode(org.talend.repository.model.RepositoryNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) Test(org.junit.Test)

Example 2 with TdTableRepositoryObject

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

the class DBColumnRepNode method getParentViewObject.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dq.nodes.DQRepositoryNode#getParentViewObject(org.talend.core.model.repository.IRepositoryViewObject)
     */
@Override
protected IRepositoryViewObject getParentViewObject() {
    IRepositoryViewObject returnViewObject = null;
    MetadataTable columnOwnerAsMetadataTable = ColumnHelper.getColumnOwnerAsMetadataTable(getTdColumn());
    if (columnOwnerAsMetadataTable instanceof TdTable) {
        returnViewObject = new TdTableRepositoryObject(metadataColumnRepositoryObject.getViewObject(), (TdTable) columnOwnerAsMetadataTable);
    } else if (columnOwnerAsMetadataTable instanceof TdView) {
        returnViewObject = new TdViewRepositoryObject(metadataColumnRepositoryObject.getViewObject(), (TdView) columnOwnerAsMetadataTable);
    }
    return returnViewObject;
}
Also used : TdTable(org.talend.cwm.relational.TdTable) TdView(org.talend.cwm.relational.TdView) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject)

Example 3 with TdTableRepositoryObject

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

the class DBColumnFolderRepNode method getChildren.

@Override
public List<IRepositoryNode> getChildren() {
    if (!this.isReload() && !children.isEmpty()) {
        // MOD gdbu 2011-6-29 bug : 22204
        return filterResultsIfAny(children);
    }
    children.clear();
    String filterCharater = null;
    IRepositoryViewObject meataColumnSetObject = this.getParent().getObject();
    EList<MetadataColumn> columns = null;
    if (meataColumnSetObject instanceof TdTableRepositoryObject) {
        TdTableRepositoryObject tdTableRepositoryObject = (TdTableRepositoryObject) meataColumnSetObject;
        // MOD klliu 2011-09-06 bug TDQ-3414
        setItem((ConnectionItem) tdTableRepositoryObject.getViewObject().getProperty().getItem());
        if (tdTableRepositoryObject.getTdTable().eIsProxy()) {
            // reload the connection to make sure the connection(and all it's owned elements) is not proxy
            reloadConnectionViewObject();
        }
        tdTable = tdTableRepositoryObject.getTdTable();
        columns = tdTable.getColumns();
        filterCharater = ColumnHelper.getColumnFilter(tdTable);
    } else if (meataColumnSetObject instanceof TdViewRepositoryObject) {
        TdViewRepositoryObject tdViewRepositoryObject = (TdViewRepositoryObject) meataColumnSetObject;
        // MOD klliu 2011-09-06 bug TDQ-3414
        setItem((ConnectionItem) tdViewRepositoryObject.getViewObject().getProperty().getItem());
        if (tdViewRepositoryObject.getTdView().eIsProxy()) {
            // reload the connection to make sure the connection(and all it's owned elements) is not proxy
            reloadConnectionViewObject();
        }
        tdView = tdViewRepositoryObject.getTdView();
        columns = tdView.getColumns();
        filterCharater = ColumnHelper.getColumnFilter(tdView);
    }
    setConnection(getItem().getConnection());
    // MOD TDQ-8718 20140430 the repository view cares about if use the filter or not, the column select dialog
    // cares about if connect to DB or not.
    List<TdColumn> tdcolumns = null;
    if (columns.size() <= 0) {
        if (isCallingFromColumnDialog()) {
            tdcolumns = loadColumns(isLoadDBFromDialog());
        } else if (!isOnFilterring()) {
            // MOD gdbu 2011-6-28 bug : 22204
            tdcolumns = loadColumns(true);
        }
    } else {
        tdcolumns = new ArrayList<TdColumn>();
        for (MetadataColumn mec : columns) {
            tdcolumns.add((TdColumn) mec);
        }
    }
    if (tdcolumns != null && filterCharater != null && !filterCharater.equals("")) {
        // $NON-NLS-1$
        tdcolumns = RepositoryNodeHelper.filterColumns(tdcolumns, filterCharater);
    }
    createTdcolumnsNode(tdcolumns, children);
    this.setReload(false);
    // MOD gdbu 2011-6-28 bug : 22204
    return filterResultsIfAny(children);
// return children;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) TdColumn(org.talend.cwm.relational.TdColumn) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject)

Example 4 with TdTableRepositoryObject

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

the class DBColumnFolderRepNode method createParentNode.

/**
 * create the node of parent.
 *
 * @param object
 * @return
 */
private RepositoryNode createParentNode(IRepositoryViewObject object) {
    RepositoryNode dbParentRepNode = null;
    if (object instanceof TdTableRepositoryObject) {
        dbParentRepNode = new DBTableRepNode(object, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
    } else if (object instanceof TdViewRepositoryObject) {
        dbParentRepNode = new DBViewRepNode(object, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
    }
    object.setRepositoryNode(dbParentRepNode);
    return dbParentRepNode;
}
Also used : TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject)

Example 5 with TdTableRepositoryObject

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

the class AbstractPredefinedTableActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection currentSelection = ((TreeSelection) this.getContext().getSelection());
    Object fe = currentSelection.getFirstElement();
    if (fe instanceof IRepositoryNode) {
        IRepositoryViewObject object = ((IRepositoryNode) fe).getObject();
        if (object instanceof TdTableRepositoryObject || object instanceof TdViewRepositoryObject) {
            action.setSelection(currentSelection);
            if (action.isAllowed()) {
                menu.add(action);
            }
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) 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)

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