/** Get all referenced columns in this reference key. This method is * provided as part of the implementation of the ReferenceKey interface * but should only be used when a ReferenceKey object is used or by * the runtime. * @return the columns */ public ColumnElement[] getReferencedColumns () { ColumnPairElement[] columnPairs = getColumnPairs(); int i, count = ((columnPairs != null) ? columnPairs.length : 0); ColumnElement[] columns = new ColumnElement[count]; for (i = 0; i < count ; i++) columns[i] = columnPairs[i].getReferencedColumn(); return columns; }
/** Get all local columns in this reference key. This method is * provided as part of the implementation of the ReferenceKey interface * but should only be used when a ReferenceKey object is used or by * the runtime. * @return the columns */ public ColumnElement[] getLocalColumns () { ColumnPairElement[] columnPairs = getColumnPairs(); int i, count = ((columnPairs != null) ? columnPairs.length : 0); ColumnElement[] columns = new ColumnElement[count]; for (i = 0; i < count ; i++) columns[i] = columnPairs[i].getLocalColumn(); return columns; }
/** Get all referenced columns in this reference key. This method is * provided as part of the implementation of the ReferenceKey interface * but should only be used when a ReferenceKey object is used or by * the runtime. * @return the columns */ public ColumnElement[] getReferencedColumns () { ColumnPairElement[] columnPairs = getColumnPairs(); int i, count = ((columnPairs != null) ? columnPairs.length : 0); ColumnElement[] columns = new ColumnElement[count]; for (i = 0; i < count ; i++) columns[i] = columnPairs[i].getReferencedColumn(); return columns; }
/** Get all local columns in this reference key. This method is * provided as part of the implementation of the ReferenceKey interface * but should only be used when a ReferenceKey object is used or by * the runtime. * @return the columns */ public ColumnElement[] getLocalColumns () { ColumnPairElement[] columnPairs = getColumnPairs(); int i, count = ((columnPairs != null) ? columnPairs.length : 0); ColumnElement[] columns = new ColumnElement[count]; for (i = 0; i < count ; i++) columns[i] = columnPairs[i].getLocalColumn(); return columns; }
/** Get the referenced table of the reference key. This method is * provided as part of the implementation of the ReferenceKey interface * but should only be used when a ReferenceKey object is used or by * the runtime. * @return the referenced table */ public TableElement getReferencedTable () { ColumnPairElement[] columnPairs = getColumnPairs(); if ((columnPairs != null) && (columnPairs.length > 0)) return columnPairs[0].getReferencedColumn().getDeclaringTable(); return null; }
/** Get the referenced table of the reference key. This method is * provided as part of the implementation of the ReferenceKey interface * but should only be used when a ReferenceKey object is used or by * the runtime. * @return the referenced table */ public TableElement getReferencedTable () { ColumnPairElement[] columnPairs = getColumnPairs(); if ((columnPairs != null) && (columnPairs.length > 0)) return columnPairs[0].getReferencedColumn().getDeclaringTable(); return null; }
/** Find a column pair by name. * @param name the name of the column pair for which to look * @return the column pair or <code>null</code> if not found */ public ColumnPairElement getColumnPair (DBIdentifier name) { ColumnPairElement[] myPairs = getColumnPairs(); int count = ((myPairs != null) ? myPairs.length : 0); String databaseRoot = getDeclaringClass().getDatabaseRoot(); if (count > 0) { String absoluteTableName = NameUtil.getAbsoluteTableName( databaseRoot, getTable().getName()); ColumnPairElement searchPair = (ColumnPairElement) TableElement.forName(absoluteTableName).getMember(name); int i; for (i = 0; i < count; i++) { if (myPairs[i].equals(searchPair)) return searchPair; } } return null; }
/** Find a column pair by name. * @param name the name of the column pair for which to look * @return the column pair or <code>null</code> if not found */ public ColumnPairElement getColumnPair (DBIdentifier name) { ColumnPairElement[] myPairs = getColumnPairs(); int count = ((myPairs != null) ? myPairs.length : 0); String databaseRoot = getDeclaringClass().getDatabaseRoot(); if (count > 0) { String absoluteTableName = NameUtil.getAbsoluteTableName( databaseRoot, getTable().getName()); ColumnPairElement searchPair = (ColumnPairElement) TableElement.forName(absoluteTableName).getMember(name); int i; for (i = 0; i < count; i++) { if (myPairs[i].equals(searchPair)) return searchPair; } } return null; }