use of org.jkiss.dbeaver.ext.db2.model.DB2IndexColumn in project dbeaver by dbeaver.
the class DB2IndexConfigurator method configureObject.
@Override
public DB2Index configureObject(DBRProgressMonitor monitor, Object container, DB2Index index) {
return UITask.run(() -> {
DB2TableBase table = (DB2TableBase) container;
EditIndexPage editPage = new EditIndexPage(DB2Messages.edit_db2_index_manager_dialog_title, index, IX_TYPES);
if (!editPage.edit()) {
return null;
}
String tableName = CommonUtils.escapeIdentifier(table.getName());
String colName = CommonUtils.escapeIdentifier(editPage.getSelectedAttributes().iterator().next().getName());
String indexBaseName = String.format(CONS_IX_NAME, tableName, colName);
String indexName = DBObjectNameCaseTransformer.transformName(table.getDataSource(), indexBaseName);
index.setName(indexName);
index.setIndexType(editPage.getIndexType());
index.setUniqueRule(editPage.isUnique() ? DB2UniqueRule.U : DB2UniqueRule.D);
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
index.addColumn(new DB2IndexColumn(index, (DB2TableColumn) tableColumn, colIndex++, !Boolean.TRUE.equals(editPage.getAttributeProperty(tableColumn, EditIndexPage.PROP_DESC))));
}
return index;
});
}
use of org.jkiss.dbeaver.ext.db2.model.DB2IndexColumn in project dbeaver by serge-rider.
the class DB2IndexConfigurator method configureObject.
@Override
public DB2Index configureObject(DBRProgressMonitor monitor, Object container, DB2Index index) {
return UITask.run(() -> {
DB2TableBase table = (DB2TableBase) container;
EditIndexPage editPage = new EditIndexPage(DB2Messages.edit_db2_index_manager_dialog_title, index, IX_TYPES);
if (!editPage.edit()) {
return null;
}
String tableName = CommonUtils.escapeIdentifier(table.getName());
String colName = CommonUtils.escapeIdentifier(editPage.getSelectedAttributes().iterator().next().getName());
String indexBaseName = String.format(CONS_IX_NAME, tableName, colName);
String indexName = DBObjectNameCaseTransformer.transformName(table.getDataSource(), indexBaseName);
index.setName(indexName);
index.setIndexType(editPage.getIndexType());
index.setUniqueRule(editPage.isUnique() ? DB2UniqueRule.U : DB2UniqueRule.D);
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
index.addColumn(new DB2IndexColumn(index, (DB2TableColumn) tableColumn, colIndex++, !Boolean.TRUE.equals(editPage.getAttributeProperty(tableColumn, EditIndexPage.PROP_DESC))));
}
return index;
});
}
Aggregations