use of com.cubrid.cubridmanager.core.cubrid.table.task.GetViewAllColumnsTask in project cubrid-manager by CUBRID.
the class GetInfoDataTask method initDDLText.
/**
* Initial DDL text
*/
private void initDDLText() {
final StringBuffer sqlScript = new StringBuffer();
if (!isTable) {
/*Get class info*/
GetAllClassListTask getAllClassListTask = new GetAllClassListTask(schemaNode.getDatabase().getDatabaseInfo());
getAllClassListTask.setTableName(schemaNode.getName());
getAllClassListTask.getClassInfoTaskExcute();
/*If failed*/
if (getAllClassListTask.getErrorMsg() != null || getAllClassListTask.isCancel()) {
LOGGER.error(getAllClassListTask.getErrorMsg());
openError(Messages.bind(Messages.titleGetMetaDataErr, schemaNode.getName()), Messages.bind(Messages.msgGetMetaDataErr, schemaNode.getName(), getAllClassListTask.getErrorMsg()));
return;
}
ClassInfo classInfo = getAllClassListTask.getClassInfo();
/*Get view column*/
GetViewAllColumnsTask getAllDBVclassTask = new GetViewAllColumnsTask(schemaNode.getDatabase().getDatabaseInfo());
getAllDBVclassTask.setClassName(schemaNode.getName());
getAllDBVclassTask.getAllVclassListTaskExcute();
/*If failed*/
if (getAllDBVclassTask.getErrorMsg() != null || getAllDBVclassTask.isCancel()) {
LOGGER.error(getAllDBVclassTask.getErrorMsg());
openError(Messages.bind(Messages.titleGetMetaDataErr, schemaNode.getName()), Messages.bind(Messages.msgGetMetaDataErr, schemaNode.getName(), getAllClassListTask.getErrorMsg()));
return;
}
/*Get query list*/
List<String> vclassList = getAllDBVclassTask.getAllVclassList();
List<Map<String, String>> queryListData = new ArrayList<Map<String, String>>();
for (String sql : vclassList) {
Map<String, String> map = new HashMap<String, String>();
map.put("0", sql);
queryListData.add(map);
}
/*Get all attribute*/
GetAllAttrTask getAllAttrTask = new GetAllAttrTask(schemaNode.getDatabase().getDatabaseInfo());
getAllAttrTask.setClassName(schemaNode.getName());
getAllAttrTask.getAttrList();
/*If failed*/
if (getAllAttrTask.getErrorMsg() != null) {
LOGGER.error(getAllAttrTask.getErrorMsg());
openError(Messages.bind(Messages.titleGetMetaDataErr, schemaNode.getName()), Messages.bind(Messages.msgGetMetaDataErr, schemaNode.getName(), getAllClassListTask.getErrorMsg()));
return;
}
List<DBAttribute> attrList = getAllAttrTask.getAllAttrList();
viewColListData = GetInfoDataUtil.getViewColMapList(attrList);
sqlScript.append(GetInfoDataUtil.getViewCreateSQLScript(false, schemaNode.getDatabase(), classInfo, schemaNode.getName(), viewColListData, queryListData));
} else {
String ddl = SQLGenerateUtils.getCreateSQL(schemaNode);
sqlScript.append(ddl == null ? "" : ddl);
}
Display.getDefault().syncExec(new Runnable() {
public void run() {
objectInfoComposite.getSqlText().setText(sqlScript.toString());
}
});
}
Aggregations