* INTERNAL:
* Process the index metadata. This is called from EntityAccessor and
* BasicAccesor (for Basic, Id and Version)
*/
public void process(MetadataDescriptor descriptor, String defaultColumnName) {
IndexDefinition indexDefinition = new IndexDefinition();
DatabaseTable primaryTable = descriptor.getPrimaryTable();
if (m_columnNames.isEmpty() && defaultColumnName != null) {
indexDefinition.getFields().add(defaultColumnName);
} else {
indexDefinition.getFields().addAll(m_columnNames);
}
// Process the name value.
indexDefinition.setName(processName(primaryTable, indexDefinition));
// Process the schema value.
if (m_schema != null && m_schema.length() != 0) {
indexDefinition.setQualifier(m_schema);
} else if (descriptor.getDefaultSchema() != null && descriptor.getDefaultSchema().length() != 0) {
indexDefinition.setQualifier(descriptor.getDefaultSchema());
}
// Process the catalog value.
if (m_catalog != null && m_catalog.length() != 0) {
indexDefinition.setQualifier(m_catalog);
} else if (descriptor.getDefaultCatalog() != null && descriptor.getDefaultCatalog().length() != 0) {
indexDefinition.setQualifier(descriptor.getDefaultCatalog());
}
// Process the unique value.
indexDefinition.setIsUnique(isUnique());
// Process table value.
if (m_table == null || m_table.length() == 0) {
indexDefinition.setTargetTable(primaryTable.getQualifiedName());
primaryTable.addIndex(indexDefinition);
} else if (m_table.equals(primaryTable.getQualifiedName()) || m_table.equals(primaryTable.getName())) {
indexDefinition.setTargetTable(m_table);
primaryTable.addIndex(indexDefinition);
} else {
indexDefinition.setTargetTable(m_table);
boolean found = false;
for (DatabaseTable databaseTable : descriptor.getClassDescriptor().getTables()) {
if (m_table.equals(databaseTable.getQualifiedName()) || m_table.equals(databaseTable.getName())) {
databaseTable.addIndex(indexDefinition);
found = true;