* @return The ForeignKeyMetaData
*/
public static ForeignKeyMetaData getFKMetaData(String name, String table, String unique, String deferred,
String deleteAction, String updateAction, String[] fields, Column[] columns)
{
ForeignKeyMetaData fkmd = new ForeignKeyMetaData();
fkmd.setName(name);
fkmd.setTable(table);
fkmd.setUnique(unique);
fkmd.setDeferred(deferred);
fkmd.setDeleteAction(org.datanucleus.metadata.ForeignKeyAction.getForeignKeyAction(deleteAction));
fkmd.setUpdateAction(org.datanucleus.metadata.ForeignKeyAction.getForeignKeyAction(updateAction));
if (fields != null && fields.length > 0)
{
for (int j=0;j<fields.length;j++)
{
FieldMetaData fmd = new FieldMetaData(fkmd, fields[j]);
fkmd.addMember(fmd);
}
}
if (fkmd.getNumberOfMembers() == 0 && columns != null && columns.length > 0)
{
for (int j=0;j<columns.length;j++)
{
ColumnMetaData colmd = JDOAnnotationUtils.getColumnMetaDataForColumnAnnotation(columns[j]);
fkmd.addColumn(colmd);
}
}
return fkmd;
}