int no = 0;
for (ColumnInfo info : columnInfos) {
row++;
no++;
HSSFCell noCell = getCell(sheet, row, ConditionSheetItem.NO.getCol());
noCell.setCellStyle(centerAlignFixedValueStyle);
noCell.setCellValue(no);
HSSFCell columnNameCell = getCell(sheet, row, ConditionSheetItem.COLUMN_NAME.getCol());
columnNameCell.setCellStyle(fixedValueStyle);
columnNameCell.setCellValue(info.getColumnName());
HSSFCell columnCommentCell = getCell(sheet, row, ConditionSheetItem.COLUMN_COMMENT.getCol());
columnCommentCell.setCellStyle(fixedValueStyle);
columnCommentCell.setCellValue(info.getColumnComment());
HSSFCell dataTypeCell = getCell(sheet, row, ConditionSheetItem.DATA_TYPE.getCol());
dataTypeCell.setCellStyle(centerAlignFixedValueStyle);
dataTypeCell.setCellValue(info.getDataType().getDataTypeString());
HSSFCell widthCell = getCell(sheet, row, ConditionSheetItem.WIDTH.getCol());
widthCell.setCellStyle(centerAlignFixedValueStyle);
switch (info.getDataType()) {
case CHAR:
case VARCHAR:
widthCell.setCellValue(info.getCharacterMaximumLength());
break;
case DECIMAL:
widthCell.setCellValue(info.getNumericPrecision());
break;
case DATE:
case DATETIME:
case INT:
case LONG:
case SMALL_INT:
case TIMESTAMP:
case TINY_INT:
widthCell.setCellValue(CELL_EMPTY);
break;
default:
throw new RuntimeException(MessageFormat.format(
"Unkonwn data type: {0}",
info.getDataType().name()));
}
HSSFCell scaleCell = getCell(sheet, row, ConditionSheetItem.SCALE.getCol());
scaleCell.setCellStyle(centerAlignFixedValueStyle);
switch (info.getDataType()) {
case DECIMAL:
scaleCell.setCellValue(info.getNumericScale());
break;
case CHAR:
case DATE:
case DATETIME:
case INT:
case LONG:
case SMALL_INT:
case TIMESTAMP:
case TINY_INT:
case VARCHAR:
scaleCell.setCellValue(CELL_EMPTY);
break;
default:
throw new RuntimeException(MessageFormat.format(
"Unkonwn data type: {0}",
info.getDataType().name()));
}
HSSFCell nullableCell = getCell(sheet, row, ConditionSheetItem.NULLABLE.getCol());
nullableCell.setCellStyle(centerAlignFixedValueStyle);
if (info.isNullable()) {
nullableCell.setCellValue(CELL_TRUE);
} else {
nullableCell.setCellValue(CELL_FALSE);
}
HSSFCell pkCell = getCell(sheet, row, ConditionSheetItem.KEY_FLAG.getCol());
pkCell.setCellStyle(centerAlignStyle);
if (info.isKey()) {
pkCell.setCellValue(CELL_TRUE);
} else {
pkCell.setCellValue(CELL_FALSE);
}
HSSFCell machingCondtionCell = getCell(sheet, row, ConditionSheetItem.MATCHING_CONDITION.getCol());
machingCondtionCell.setCellStyle(centerAlignStyle);
machingCondtionCell.setCellValue(ColumnMatchingCondition.NONE.getJapaneseName());
HSSFCell nullValueConditionCell = getCell(sheet, row, ConditionSheetItem.NULL_VALUE_CONDITION.getCol());
nullValueConditionCell.setCellStyle(centerAlignStyle);
nullValueConditionCell.setCellValue(NullValueCondition.NORMAL.getJapaneseName());
}
int endRow = row;
return endRow;
}