Search in sources :

Example 6 with DBColumnFolderRepNode

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

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

Example 8 with DBColumnFolderRepNode

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

the class TableViewComparisonLevel method findDataProvider.

@Override
protected Connection findDataProvider() {
    Connection provider = null;
    if (selectedObj instanceof DBColumnFolderRepNode) {
        DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
        ColumnSet columnSet = columnFolderRepNode.getColumnSet();
        if (columnSet != null) {
            Package parentCatalogOrSchema = ColumnSetHelper.getParentCatalogOrSchema(columnSet);
            provider = ConnectionHelper.getTdDataProvider(parentCatalogOrSchema);
        }
    } else if (selectedObj instanceof RepositoryNode) {
        Item connItem = ((RepositoryNode) selectedObj).getObject().getProperty().getItem();
        provider = ((ConnectionItem) connItem).getConnection();
    } else {
        ColumnSet columnSet = (ColumnSet) selectedObj;
        Package parentCatalogOrSchema = ColumnSetHelper.getParentCatalogOrSchema(columnSet);
        provider = ConnectionHelper.getTdDataProvider(parentCatalogOrSchema);
    }
    return provider;
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) Package(orgomg.cwm.objectmodel.core.Package) RepositoryNode(org.talend.repository.model.RepositoryNode) DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode)

Example 9 with DBColumnFolderRepNode

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

the class TableViewComparisonLevel method getRightResource.

@Override
protected Resource getRightResource() throws ReloadCompareException {
    ColumnSet selectedColumnSet = null;
    if (selectedObj instanceof RepositoryNode) {
        selectedColumnSet = (ColumnSet) RepositoryNodeHelper.getMetadataElement((RepositoryNode) selectedObj);
    } else if (selectedObj instanceof DBColumnFolderRepNode) {
        DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
        selectedColumnSet = columnFolderRepNode.getColumnSet();
    } else {
        selectedColumnSet = (ColumnSet) selectedObj;
    }
    ColumnSet findMatchedColumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, tempReloadProvider);
    List<TdColumn> columns = null;
    try {
        // MOD scorreia 2009-01-29 clear content of findMatchedColumnSet
        ColumnSetHelper.setColumns(findMatchedColumnSet, EMPTY_COLUMN_LIST);
        columns = DqRepositoryViewService.getColumns(tempReloadProvider, findMatchedColumnSet, true);
    } catch (Exception e1) {
        throw new ReloadCompareException(e1);
    }
    // MOD scorreia 2009-01-29 columns are stored in the table
    // ColumnSetHelper.addColumns(findMatchedColumnSet, columns);
    URI uri = tempReloadProvider.eResource().getURI();
    Resource rightResource = null;
    rightResource = EMFSharedResources.getInstance().getResource(uri, true);
    if (rightResource == null) {
        // $NON-NLS-1$
        throw new ReloadCompareException(DefaultMessagesImpl.getString("TableViewComparisonLevel.NoFactoryFoundForURI", uri));
    }
    rightResource.getContents().clear();
    for (TdColumn column : columns) {
        DQStructureComparer.clearSubNode(column);
        rightResource.getContents().add(column);
    }
    EMFSharedResources.getInstance().saveResource(rightResource);
    return upperCaseResource(rightResource);
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) Resource(org.eclipse.emf.ecore.resource.Resource) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) RepositoryNode(org.talend.repository.model.RepositoryNode) DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode) URI(org.eclipse.emf.common.util.URI) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException)

Example 10 with DBColumnFolderRepNode

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

the class TableViewComparisonLevel method getCurrentColumnSet.

/**
 * DOC msjian Comment method "getCurrentColumnSet".
 *
 * @return
 */
private ColumnSet getCurrentColumnSet() {
    ColumnSet columnSet = null;
    if (selectedObj instanceof DBColumnFolderRepNode) {
        DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
        columnSet = columnFolderRepNode.getColumnSet();
    } else if (selectedObj instanceof ColumnSet) {
        columnSet = (ColumnSet) selectedObj;
    }
    return columnSet;
}
Also used : ColumnSet(orgomg.cwm.resource.relational.ColumnSet) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode)

Aggregations

DBColumnFolderRepNode (org.talend.dq.nodes.DBColumnFolderRepNode)14 RepositoryNode (org.talend.repository.model.RepositoryNode)9 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 DBTableFolderRepNode (org.talend.dq.nodes.DBTableFolderRepNode)6 DBViewFolderRepNode (org.talend.dq.nodes.DBViewFolderRepNode)6 ArrayList (java.util.ArrayList)4 Connection (org.talend.core.model.metadata.builder.connection.Connection)4 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)4 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 ColumnSet (orgomg.cwm.resource.relational.ColumnSet)3 List (java.util.List)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 Test (org.junit.Test)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 ConnectionItem (org.talend.core.model.properties.ConnectionItem)2 Item (org.talend.core.model.properties.Item)2