use of org.dbflute.logic.jdbc.metadata.info.DfPrimaryKeyMeta in project dbflute-core by dbflute.
the class DfSchemaXmlSerializer method doProcessTable.
protected boolean doProcessTable(Connection conn, DatabaseMetaData metaData, DfTableMeta tableMeta) throws SQLException {
final String tableFullQualifiedName = tableMeta.getTableFullQualifiedName();
if (tableMeta.isOutOfGenerateTarget()) {
// for example, sequence synonym and so on...
_log.info("$ " + tableFullQualifiedName + " is out of generation target!");
return false;
}
_log.info("$ " + tableMeta.toString());
final Element tableElement = _doc.createElement("table");
tableElement.setAttribute("name", tableMeta.getTableName());
tableElement.setAttribute("type", tableMeta.getTableType());
final UnifiedSchema unifiedSchema = tableMeta.getUnifiedSchema();
if (unifiedSchema.hasSchema()) {
tableElement.setAttribute("schema", unifiedSchema.getIdentifiedSchema());
}
final String tableComment = tableMeta.getTableComment();
if (Srl.is_NotNull_and_NotTrimmedEmpty(tableComment)) {
tableElement.setAttribute("comment", tableComment);
}
final DfPrimaryKeyMeta pkInfo = getPrimaryColumnMetaInfo(metaData, tableMeta);
final List<DfColumnMeta> columns = getColumns(metaData, tableMeta);
for (int j = 0; j < columns.size(); j++) {
final DfColumnMeta columnMeta = columns.get(j);
final Element columnElement = _doc.createElement("column");
processColumnName(columnMeta, columnElement);
processColumnType(columnMeta, columnElement);
processColumnDbType(columnMeta, columnElement);
processColumnJavaType(columnMeta, columnElement);
processColumnSize(columnMeta, columnElement);
processDatetimePrecision(columnMeta, columnElement);
processRequired(columnMeta, columnElement);
processPrimaryKey(columnMeta, pkInfo, columnElement);
processColumnComment(columnMeta, columnElement);
processDefaultValue(columnMeta, columnElement);
processAutoIncrement(tableMeta, columnMeta, pkInfo, conn, columnElement);
tableElement.appendChild(columnElement);
}
processForeignKey(conn, metaData, tableMeta, tableElement);
final Map<String, Map<Integer, String>> uniqueKeyMap = processUniqueKey(metaData, tableMeta, pkInfo, tableElement);
processIndex(metaData, tableMeta, tableElement, uniqueKeyMap);
_tableElementStagingMap.put(tableFullQualifiedName, tableElement);
return true;
}
Aggregations