public static List<Reference> getParents (Database database, Table table) {
//return getParents(table);
// Duplicated code
List<Reference> list = new ArrayList<Reference>();
net.sf.minuteProject.configuration.bean.model.data.Reference ref;
Reference reference;
ForeignKey [] foreignKeys = table.getForeignKeys();
//logger.info("table = "+table.getName()+", count FK = "+foreignKeys.length);
for (int i = 0; i < foreignKeys.length; i++) {
ref = foreignKeys[i].getFirstReference();
String tablename = foreignKeys[i].getForeignTableName();
Table table2 = TableUtils.getTable(database,tablename);
String columnName = null;
if (ref!=null)
columnName = ref.getForeignColumnName();
Column column2 = ColumnUtils.getColumn (table2, columnName);
//reference = new Reference(table2, ColumnUtils.getColumn(table2, ref.getLocalColumnName()), tablename, ref.getLocalColumnName());
reference = new Reference(table2, column2, tablename, columnName);
reference.setLocalColumn(ref.getLocalColumn());
//logger.info("table = "+tablename+", columnName = "+columnName);
addReference(list, reference);
}
return list;