Iterator uniqueConstraints = _uniques.iterator();
Table table = cm.getTable();
Collection result = new ArrayList();
while (uniqueConstraints.hasNext()) {
Unique template = (Unique) uniqueConstraints.next();
Column[] templateColumns = template.getColumns();
Column[] uniqueColumns = new Column[templateColumns.length];
boolean missingColumn = true;
for (int i=0; i<uniqueColumns.length; i++) {
String columnName = templateColumns[i].getName();
Column uniqueColumn = table.getColumn(columnName);
missingColumn = (uniqueColumn == null);
if (missingColumn) {
throw new UserException(_loc.get("missing-unique-column",
cm, table, columnName));
}
uniqueColumns[i] = uniqueColumn;
}
Unique unique = super.createUnique(cm, "unique", template,
uniqueColumns, adapt);
if (unique != null)
result.add(unique);
}
return (Unique[]) result.toArray(new Unique[result.size()]);