/** * Checks, if the column <code>ce</code> is part of the * primary key <code>pk</code>. * RESOLVE: Method isPrimaryKeyColumn in ModelValidator * implements similar functionality. * * @param ce Column element for the column to be tested. * @param pk Primary key element. The column to be tested * <b>must</b> be defined in the same table. * @return True, if the column is part of the primary key, * false otherwise. * @see com.sun.jdo.api.persistence.model.util.ModelValidator */ private boolean isPartOfPrimaryKey(ColumnElement ce, UniqueKeyElement pk) { return null != pk && ce.equals(pk.getColumn(ce.getName())); }
/** * Checks, if the column <code>ce</code> is part of one * of the foreign key constraints defined in <code>fks</code>. * RESOLVE: Method matchesFK in ModelValidator implements similar * functionality. * * @param ce Column element for the column to be tested. * @param fks Array of foreign key elements. The column to be * tested <b>must</b> be defined in the same table. * @return True, if the column is part of one of the foreign keys, * false otherwise. * @see com.sun.jdo.api.persistence.model.util.ModelValidator */ private boolean isPartOfForeignKey(ColumnElement ce, ForeignKeyElement[] fks) { // RESOLVE: Column ce might be included in multiple foreign // keys. The foreign key check applies to ALL relationships // mapped to column ce. How can we find out, that a foreign // key matches exactly the relationship being checked here? if (fks != null) { for (int index = 0; index < fks.length; index++) { if (ce.equals(fks[index].getColumn(ce.getName()))) { // The current ce is part of the foreign key. return true; } } } return false; }
if (candidatePK != null && candidatePK.equals(aCol)) { candidatePK = null;