Search in sources :

Example 16 with ERSchema

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);
    }
}
Also used : ERSchema(com.cubrid.common.ui.er.model.ERSchema) ERException(com.cubrid.common.ui.er.ERException)

Aggregations

ERSchema (com.cubrid.common.ui.er.model.ERSchema)16 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)6 ERTable (com.cubrid.common.ui.er.model.ERTable)5 Constraint (com.cubrid.common.core.common.model.Constraint)3 ERSchemaEditor (com.cubrid.common.ui.er.editor.ERSchemaEditor)3 CubridTableParser (com.cubrid.common.ui.er.model.CubridTableParser)3 ERTableColumn (com.cubrid.common.ui.er.model.ERTableColumn)3 List (java.util.List)3 ArrayList (java.util.ArrayList)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 DBAttribute (com.cubrid.common.core.common.model.DBAttribute)1 SerialInfo (com.cubrid.common.core.common.model.SerialInfo)1 AddFKDialog (com.cubrid.common.ui.cubrid.table.dialog.AddFKDialog)1 ERException (com.cubrid.common.ui.er.ERException)1 SchemaEditorInput (com.cubrid.common.ui.er.SchemaEditorInput)1 AddTableCommand (com.cubrid.common.ui.er.commands.AddTableCommand)1 DeleteTableCommand (com.cubrid.common.ui.er.commands.DeleteTableCommand)1 ERSchemaTableNodesLoader (com.cubrid.common.ui.er.loader.ERSchemaTableNodesLoader)1 PhysicalLogicRelation (com.cubrid.common.ui.er.logic.PhysicalLogicRelation)1 Relationship (com.cubrid.common.ui.er.model.Relationship)1