use of com.cubrid.common.ui.er.model.CubridTableParser in project cubrid-manager by CUBRID.
the class ERDNDController method addTables.
private void addTables(List<SchemaInfo> schemaInfoList, int x, int y) {
if (schemaInfoList == null) {
return;
}
List<String> existTables = new ArrayList<String>();
String message = "";
ERSchema erSchema = editor.getERSchema();
Iterator<SchemaInfo> it = schemaInfoList.iterator();
while (it.hasNext()) {
SchemaInfo table = (SchemaInfo) it.next();
ERTable existTable = erSchema.getTable(table.getClassname());
if (existTable != null) {
existTables.add(table.getClassname());
it.remove();
continue;
}
}
CubridTableParser tableParser = new CubridTableParser(erSchema);
if (schemaInfoList.size() == 1) {
tableParser.buildERTables(schemaInfoList, x, y, false);
} else {
tableParser.buildERTables(schemaInfoList, x, y, true);
}
erSchema.FireAddedTable(tableParser.getSuccessTables());
Map<String, Exception> failedTables = tableParser.getFailedTables();
Map<String, List<Constraint>> removedFKs = tableParser.getRemovedFKConstraints();
if (failedTables.size() > 0) {
message = Messages.bind(com.cubrid.common.ui.er.Messages.errorAddTables, failedTables.keySet());
}
if (existTables.size() > 0) {
if (!message.equals("")) {
message += "\n";
}
message += Messages.bind(com.cubrid.common.ui.er.Messages.errExistTables, existTables);
}
if (removedFKs.size() > 0) {
if (!message.equals("")) {
message += "\n";
}
message += Messages.bind(com.cubrid.common.ui.er.Messages.cannotBeBuiltFK, tableParser.getOneRemovedFK().getName());
if (tableParser.getRemovedFKCount() > 1) {
message += ", ...";
}
}
if (!message.equals("")) {
CommonUITool.openErrorBox(message);
}
}
Aggregations