/**
* INTERNAL:
* Process the index metadata
*/
public void process(MetadataDescriptor descriptor, String defaultColumnName) {
IndexDefinition indexDefinition = new IndexDefinition();
if (m_columnNames.isEmpty() && defaultColumnName != null) {
indexDefinition.getFields().add(defaultColumnName);
} else {
indexDefinition.getFields().addAll(m_columnNames);
}
// Process the name value.
if (m_name != null && m_name.length() != 0) {
indexDefinition.setName(m_name);
} else {
String name = "INDEX_" + descriptor.getPrimaryTableName();
for (String column : indexDefinition.getFields()) {
name = name + "_" + column;
}
indexDefinition.setName(name);
}
// 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.
if (m_unique != null) {
indexDefinition.setIsUnique(m_unique);
}
// Process table value.
if (m_table == null || m_table.length() == 0) {
indexDefinition.setTargetTable(descriptor.getPrimaryTable().getQualifiedName());
descriptor.getPrimaryTable().getIndexes().add(indexDefinition);
} else if (m_table.equals(descriptor.getPrimaryTable().getQualifiedName()) || m_table.equals(descriptor.getPrimaryTableName())) {
indexDefinition.setTargetTable(m_table);
descriptor.getPrimaryTable().getIndexes().add(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.getIndexes().add(indexDefinition);
found = true;