if (imd.isUnique() != null && imd.isUnique().booleanValue())
{
unique = true;
}
Index index = new Index(table, unique, imd.getValueForExtension("extended-setting"));
// Set the index name if required
if (imd.getName() != null)
{
IdentifierFactory idFactory = table.getStoreManager().getIdentifierFactory();
DatastoreIdentifier idxId = idFactory.newIdentifier(IdentifierFactory.INDEX, imd.getName());
index.setName(idxId.toString());
}
// Field-level index so use all columns for the field
int countFields = fieldMapping.getNumberOfDatastoreFields();
for (int j=0; j<countFields; j++)
{
index.addDatastoreField(fieldMapping.getDataStoreMapping(j).getDatastoreField());
}
return index;
}