Search in sources :

Example 1 with TdViewRepositoryObject

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

the class RepositoryNodeHelper method createDBViewRepNode.

/**
 * DOC talend Comment method "createDBViewRepNode".
 *
 * @param findModelElement
 * @param lastVersion
 * @return
 */
private static RepositoryNode createDBViewRepNode(TdView findModelElement, IRepositoryViewObject lastVersion) {
    TdViewRepositoryObject tdViewRepositoryObject = new TdViewRepositoryObject(lastVersion, findModelElement);
    tdViewRepositoryObject.setId(findModelElement.getName());
    tdViewRepositoryObject.setLabel(findModelElement.getName());
    DBViewRepNode dbViewRepNode = new DBViewRepNode(tdViewRepositoryObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
    dbViewRepNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_COLUMN);
    dbViewRepNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_COLUMN);
    tdViewRepositoryObject.setRepositoryNode(dbViewRepNode);
    return dbViewRepNode;
}
Also used : TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode)

Example 2 with TdViewRepositoryObject

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

the class DBViewFolderRepNode method createViewRepositoryNode.

/**
 * DOC klliu Comment method "createTableRepositoryNode".
 *
 * @param tables
 */
private void createViewRepositoryNode(List<TdView> views, List<IRepositoryNode> node) {
    if (views != null) {
        for (TdView view : views) {
            // create view object
            TdViewRepositoryObject metadataView = new TdViewRepositoryObject(viewObject, view);
            metadataView.setTableName(view.getName());
            metadataView.setLabel(view.getName());
            metadataView.setId(view.getName());
            // create a node for ui
            DBViewRepNode viewNode = new DBViewRepNode(metadataView, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            viewNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_TABLE);
            viewNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_VIEW);
            metadataView.setRepositoryNode(viewNode);
            node.add(viewNode);
        }
    }
}
Also used : TdView(org.talend.cwm.relational.TdView) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject)

Example 3 with TdViewRepositoryObject

use of org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject 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 4 with TdViewRepositoryObject

use of org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject 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 5 with TdViewRepositoryObject

use of org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject 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)

Aggregations

TdViewRepositoryObject (org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject)11 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)8 TdTableRepositoryObject (org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject)8 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 TdView (org.talend.cwm.relational.TdView)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 ICommonViewerWorkbenchSite (org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)3 RepositoryNode (org.talend.repository.model.RepositoryNode)3 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)2 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)2 TdColumn (org.talend.cwm.relational.TdColumn)2 TdTable (org.talend.cwm.relational.TdTable)2 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)2 Catalog (orgomg.cwm.resource.relational.Catalog)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Test (org.junit.Test)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)1 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)1 ConnectionItem (org.talend.core.model.properties.ConnectionItem)1