final Command<Void> createCmd = new Command<Void>() {
@Override
public Void execute(ISession session, SeConnection connection) throws SeException,
IOException {
final SeTable table = new SeTable(connection, tableName);
try {
table.delete();
} catch (SeException e) {
LOGGER.fine("table " + tableName + " does not already exist");
}
final boolean isNullable = true;
// ROW_ID, INT_COL, DATE_COL, STRING_COL, SE_ANNO_CAD_DATA
final int numCols = 5;
final SeColumnDefinition[] colDefs = new SeColumnDefinition[numCols];
// first column to be SDE managed feature id
colDefs[0] = new SeColumnDefinition("ROW_ID", SeColumnDefinition.TYPE_INT32, 10, 0,
false);
colDefs[1] = new SeColumnDefinition("INT_COL", SeColumnDefinition.TYPE_INT32, 10,
0, isNullable);
colDefs[2] = new SeColumnDefinition("DATE_COL", SeColumnDefinition.TYPE_DATE, 1, 0,
isNullable);
colDefs[3] = new SeColumnDefinition("STRING_COL", SeColumnDefinition.TYPE_STRING,
25, 0, isNullable);
// use a blob type just to make sure they're correctly ignored
colDefs[4] = new SeColumnDefinition("SE_ANNO_CAD_DATA",
SeColumnDefinition.TYPE_BLOB, 4000, 0, isNullable);
/*
* Create the table using the DBMS default configuration keyword. Valid keywords are
* defined in the dbtune table.
*/
table.create(colDefs, configKeyword);
/*
* Register the column to be used as feature id and managed by sde
*/
if (SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_NONE != rowIdColumnType) {
SeRegistration reg = new SeRegistration(connection, table.getName());
LOGGER.fine("setting rowIdColumnName to ROW_ID in table " + reg.getTableName());
reg.setRowIdColumnName("ROW_ID");
reg.setRowIdColumnType(rowIdColumnType);
reg.alter();
}