use of com.cubrid.cubridmanager.core.cubrid.table.task.GetAllSchemaTask in project cubrid-manager by CUBRID.
the class ERSchemaEditor method getUpdateDescriptionTaskList.
/**
* Get UpdateDescriptionTaskList
*
* @param dbInfo
* @return
*/
private List<UpdateDescriptionTask> getUpdateDescriptionTaskList(DatabaseInfo dbInfo) {
List<UpdateDescriptionTask> updateDescriptionTaskList = new ArrayList<UpdateDescriptionTask>();
Map<String, SchemaInfo> schemaInfos = erSchema.getAllSchemaInfo();
Collection<SchemaInfo> erdSchemaInfos = schemaInfos.values();
GetAllSchemaTask task = new GetAllSchemaTask(dbInfo);
task.execute();
Map<String, SchemaInfo> dbSchemaInfoMap = task.getSchemas();
String taskName = com.cubrid.common.ui.cubrid.table.Messages.updateDescriptionTask;
for (SchemaInfo newSchemaInfo : erdSchemaInfos) {
String tableName = newSchemaInfo.getClassname();
SchemaInfo dbSchemaInfo = dbSchemaInfoMap.get(tableName);
if (dbSchemaInfo == null) {
continue;
}
for (DBAttribute newAttr : newSchemaInfo.getAttributes()) {
DBAttribute oldAttr = dbSchemaInfo.getDBAttributeByName(newAttr.getName(), newAttr.isClassAttribute());
if (oldAttr == null || StringUtil.isEqual(oldAttr.getDescription(), newAttr.getDescription())) {
continue;
}
updateDescriptionTaskList.add(new UpdateDescriptionTask(taskName, dbInfo, tableName, newAttr.getName(), newAttr.getDescription()));
}
if (!StringUtil.isEqual(dbSchemaInfo.getDescription(), newSchemaInfo.getDescription())) {
updateDescriptionTaskList.add(new UpdateDescriptionTask(taskName, dbInfo, tableName, "", newSchemaInfo.getDescription()));
}
}
return updateDescriptionTaskList;
}
Aggregations