use of com.cubrid.common.ui.cubrid.database.erwin.WrappedDatabaseInfo in project cubrid-manager by CUBRID.
the class ERSchemaEditor method compareDDL2DB.
public void compareDDL2DB() {
DatabaseInfo info = database.getDatabaseInfo();
if (info == null) {
CommonUITool.openErrorBox(Messages.errNoDatabase);
return;
}
if (!info.isLogined()) {
CommonUITool.openErrorBox(Messages.msgDBNotLogin);
return;
}
ServerInfo serverInfo = info.getServerInfo();
if (serverInfo != null && !serverInfo.isConnected()) {
CommonUITool.openErrorBox(Messages.msgDBNotLogin);
return;
}
Map<String, SchemaInfo> schemaInfos = erSchema.getAllSchemaInfo();
Map<String, TableSchema> tableSchemas = new HashMap<String, TableSchema>();
WrappedDatabaseInfo wrappedDatabaseInfo = new WrappedDatabaseInfo(info.getDbName(), info.getServerInfo());
ERXmlDatabaseInfoMapper.addWrappedDatabaseInfo(info, wrappedDatabaseInfo);
wrappedDatabaseInfo.addSchemaInfos(schemaInfos);
SchemaDDL ddl = new SchemaDDL(null, wrappedDatabaseInfo);
for (String tableName : schemaInfos.keySet()) {
SchemaInfo schemaInfo = schemaInfos.get(tableName);
if (schemaInfo == null || !tableName.equals(schemaInfo.getClassname())) {
continue;
}
// now do not support view table
String strDDL = ddl.getSchemaDDL(schemaInfo, true, true);
TableSchema tableSchema = new TableSchema(tableName, "");
tableSchema.setSchemaInfo(strDDL);
tableSchemas.put(tableSchema.getName(), tableSchema);
}
wrappedDatabaseInfo.addTableSchemas(tableSchemas);
compareTableSchemas(getEditorInput().getName(), tableSchemas, schemaInfos);
}
Aggregations