use of com.cubrid.common.ui.er.model.ERSchema in project cubrid-manager by CUBRID.
the class ColumnLabelHandler method checkFormat.
public void checkFormat(String fullText) throws ERException {
if (StringUtil.isEmpty(fullText)) {
throw new ERException(Messages.errEmptyColumn);
}
String[] colInfo = fullText.split(ERTableColumn.SPLIT);
if (colInfo.length == 2) {
if (StringUtil.isEmpty(colInfo[0]) | StringUtil.isEmpty(colInfo[1])) {
throw new ERException(Messages.errColumnFormat);
}
} else if (colInfo.length == 3) {
if (StringUtil.isEmpty(colInfo[0]) | StringUtil.isEmpty(colInfo[1]) | StringUtil.isEmpty(colInfo[2])) {
throw new ERException(Messages.errColumnFormat);
}
} else {
throw new ERException(Messages.errColumnFormat);
}
ERSchema schema = column.getERSchema();
if (schema.isPhysicModel()) {
String err = ERTableColumn.checkName(colInfo[0]);
if (!StringUtil.isEmpty(err)) {
throw new ERException(err);
}
}
String physicalShowType = colInfo[1];
if (!schema.isPhysicModel()) {
if (schema.hasLogicalTypeInMap(physicalShowType)) {
physicalShowType = schema.convert2UpPhysicalShowType(physicalShowType);
if (physicalShowType.startsWith(DataType.DATATYPE_ENUM)) {
physicalShowType = physicalShowType.replaceFirst(DataType.getUpperEnumType(), DataType.getLowerEnumType());
}
} else {
physicalShowType = column.getShowType(true);
}
}
String err = ERTableColumn.checkDataShowType(physicalShowType);
if (!StringUtil.isEmpty(err)) {
throw new ERException(err);
}
}
Aggregations