Search in sources :

Example 1 with MetadataCatalogRepositoryObject

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

the class AbstractCommonActionProviderRealProjectTest method testGetConnectionCase7.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.action.provider.AbstractCommonActionProvider#getConnection(java.lang.Object)}
 * . case7 :input parameter is DBViewFolderRepNode
 */
@Test
public void testGetConnectionCase7() {
    // create FileConnection
    // connection
    IRepositoryViewObject lastVersion = null;
    String propertyID = createConnectionItem(connectionName, null, null);
    // $NON-NLS-1$
    Catalog createCatalog = createCatalog("catalog1");
    try {
        lastVersion = factory.getLastVersion(propertyID);
        lastVersion = new MetadataCatalogRepositoryObject(lastVersion, createCatalog);
    } catch (PersistenceException e) {
        log.error(e, e);
        Assert.fail(e.getMessage());
    }
    // ~connection data
    // ~FileConnection
    // create DFColumnFolderRepNode
    Assert.assertFalse(lastVersion == null);
    RepositoryNode dbCatalogRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(lastVersion, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
    DBViewFolderRepNode dbViewFolderRepNode = new DBViewFolderRepNode(null, dbCatalogRepNode, null, null);
    // ~DFColumnFolderRepNode
    AbstractCommonActionProvider provider = new AbstractCommonActionProvider();
    Connection connection = provider.getConnection(dbViewFolderRepNode);
    Assert.assertTrue(connection != null);
}
Also used : 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) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) RepositoryNode(org.talend.repository.model.RepositoryNode) Catalog(orgomg.cwm.resource.relational.Catalog) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) Test(org.junit.Test)

Example 2 with MetadataCatalogRepositoryObject

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

the class AbstractCommonActionProviderRealProjectTest method testGetConnectionCase4.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.action.provider.AbstractCommonActionProvider#getConnection(java.lang.Object)}
 * . case4 :input parameter is DBCatalogRepNode
 */
@Test
public void testGetConnectionCase4() {
    // create FileConnection
    // connection
    IRepositoryViewObject lastVersion = null;
    String propertyID = createConnectionItem(connectionName, null, null);
    // $NON-NLS-1$
    Catalog createCatalog = createCatalog("catalog1");
    try {
        lastVersion = factory.getLastVersion(propertyID);
        lastVersion = new MetadataCatalogRepositoryObject(lastVersion, createCatalog);
    } catch (PersistenceException e) {
        log.error(e, e);
        Assert.fail(e.getMessage());
    }
    // ~connection data
    // ~FileConnection
    // create DFColumnFolderRepNode
    Assert.assertFalse(lastVersion == null);
    RepositoryNode dbCatalogRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(lastVersion, null, null, null);
    // ~DFColumnFolderRepNode
    AbstractCommonActionProvider provider = new AbstractCommonActionProvider();
    Connection connection = provider.getConnection(dbCatalogRepNode);
    Assert.assertTrue(connection != null);
}
Also used : 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) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) RepositoryNode(org.talend.repository.model.RepositoryNode) Catalog(orgomg.cwm.resource.relational.Catalog) Test(org.junit.Test)

Example 3 with MetadataCatalogRepositoryObject

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

the class CatalogAnalysisDPSelectionPage method addListeners.

@Override
protected void addListeners() {
    addListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (object instanceof Catalog) {
                advanceToNextPageOrFinish();
            }
        }
    });
    addListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            try {
                Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
                PackagesAnalyisParameter catalogPanameter = (PackagesAnalyisParameter) getConnectionParams();
                List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
                if (object instanceof DBCatalogRepNode) {
                    DBCatalogRepNode catalogNode = (DBCatalogRepNode) object;
                    Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
                    Connection tdProvider = ConnectionHelper.getTdDataProvider(SwitchHelpers.PACKAGE_SWITCH.doSwitch(catalog));
                    nodes.add(catalogNode);
                    if (tdProvider != null && catalogPanameter != null) {
                        catalogPanameter.setTdDataProvider(tdProvider);
                        catalogPanameter.setConnectionRepNode((DBConnectionRepNode) catalogNode.getParent());
                        catalogPanameter.setPackages(nodes);
                    }
                    setPageComplete(true);
                } else {
                    setPageComplete(false);
                }
            } catch (Exception e) {
                log.error(e, e);
            }
        }
    });
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Connection(org.talend.core.model.metadata.builder.connection.Connection) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Catalog(orgomg.cwm.resource.relational.Catalog) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with MetadataCatalogRepositoryObject

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

the class DBTableFolderRepNode method createParentNode.

/**
 * create the node of parent.
 *
 * @return
 */
private RepositoryNode createParentNode() {
    RepositoryNode dbParentRepNode = null;
    if (viewObject instanceof MetadataCatalogRepositoryObject) {
        dbParentRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
    } else if (viewObject instanceof MetadataSchemaRepositoryObject) {
        dbParentRepNode = new DBSchemaRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
    }
    viewObject.setRepositoryNode(dbParentRepNode);
    return dbParentRepNode;
}
Also used : MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)

Example 5 with MetadataCatalogRepositoryObject

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

the class DBTableFolderRepNode method getChildrenCount.

private int getChildrenCount() {
    List<TdTable> tables = new ArrayList<TdTable>();
    IRepositoryViewObject object = this.getParent().getObject();
    if (object instanceof MetadataCatalogRepositoryObject) {
        catalog = ((MetadataCatalogRepositoryObject) object).getCatalog();
        tables = PackageHelper.getTables(catalog);
    } else {
        schema = ((MetadataSchemaRepositoryObject) object).getSchema();
        tables = PackageHelper.getTables(schema);
    }
    return tables.size();
}
Also used : TdTable(org.talend.cwm.relational.TdTable) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject)

Aggregations

MetadataCatalogRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject)20 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)13 RepositoryNode (org.talend.repository.model.RepositoryNode)12 Catalog (orgomg.cwm.resource.relational.Catalog)12 IRepositoryNode (org.talend.repository.model.IRepositoryNode)9 ArrayList (java.util.ArrayList)6 Connection (org.talend.core.model.metadata.builder.connection.Connection)6 MetadataSchemaRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)6 PersistenceException (org.talend.commons.exception.PersistenceException)4 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)4 Schema (orgomg.cwm.resource.relational.Schema)4 Test (org.junit.Test)3 TdTable (org.talend.cwm.relational.TdTable)3 TdView (org.talend.cwm.relational.TdView)3 Package (orgomg.cwm.objectmodel.core.Package)3 Indicator (org.talend.dataquality.indicators.Indicator)2 CatalogIndicator (org.talend.dataquality.indicators.schema.CatalogIndicator)2 PackagesAnalyisParameter (org.talend.dq.analysis.parameters.PackagesAnalyisParameter)2 List (java.util.List)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1