Search in sources :

Example 1 with TableColumnInfo

use of net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo in project tdi-studio-se by Talend.

the class TableNode method isNodeSameToColumn.

/**
     * Check if ColumnNode and Column are the same.
     * 
     * @param node ColumnNode
     * @param column MetadataColumnImpl
     * @return isNodeSameToColumn
     * @exception
     */
private boolean isNodeSameToColumn(ColumnNode node, MetadataColumnImpl column) {
    SessionTreeNode sessionTreeNode = node.getSession();
    TableColumnInfo[] tableColumnInfo = null;
    try {
        tableColumnInfo = sessionTreeNode.getMetaData().getColumnInfo(ptableInfo);
    } catch (SQLException e) {
        SqlBuilderPlugin.log(e.getMessage(), e);
        return false;
    }
    // Retrive metadataColumns from Database
    IMetadataConnection iMetadataConnection = ConvertionHelper.convert(connection);
    List<TdColumn> metadataColumns = new ArrayList<TdColumn>();
    metadataColumns = ExtractMetaDataFromDataBase.returnMetadataColumnsFormTable(iMetadataConnection, getLabelText());
    Iterator iterate = metadataColumns.iterator();
    while (iterate.hasNext()) {
        MetadataColumn metadataColumn = (MetadataColumn) iterate.next();
        for (TableColumnInfo info : tableColumnInfo) {
            if (metadataColumn.getLabel().equals(node.getLabelText()) && info.getColumnName().equals(node.getLabelText())) {
                boolean divergency = isEquivalent(metadataColumn, column);
                metadataColumn.setDivergency(divergency);
                return divergency;
            }
        }
    }
    return true;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) TdColumn(org.talend.cwm.relational.TdColumn) SQLException(java.sql.SQLException) SessionTreeNode(org.talend.sqlbuilder.sessiontree.model.SessionTreeNode) TableColumnInfo(net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IMetadataConnection(org.talend.core.model.metadata.IMetadataConnection)

Aggregations

SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 TableColumnInfo (net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo)1 IMetadataConnection (org.talend.core.model.metadata.IMetadataConnection)1 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)1 TdColumn (org.talend.cwm.relational.TdColumn)1 SessionTreeNode (org.talend.sqlbuilder.sessiontree.model.SessionTreeNode)1