use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo in project cubrid-manager by CUBRID.
the class GetAnalyzeCasLogTask method getAnalyzeCasLogResultList.
/**
* <p>
* Get result from the response.
* </p>
*
* @return {@link AnalyzeCasLogResultList}
*/
public AnalyzeCasLogResultList getAnalyzeCasLogResultList() {
TreeNode response = getResponse();
if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
return null;
}
AnalyzeCasLogResultList analyzeCasLogResultList = new AnalyzeCasLogResultList();
String resultfile = response.getValue("resultfile");
analyzeCasLogResultList.setResultfile(resultfile);
// TOOLS-4132 CM can't make the broker_log_top result - fixed by cmserver https api bug
if (response != null && response.getValue("resultlist") != null && response.getValues("result") != null) {
String[] results = response.getValues("result");
for (int i = 0; i < results.length / 2; i++) {
AnalyzeCasLogResultInfo analyzeCasLogResultInfo = new AnalyzeCasLogResultInfo();
analyzeCasLogResultInfo.setQindex((response.getValues("qindex"))[i]);
if (response.getValue("max") == null) {
analyzeCasLogResultInfo.setExecTime((response.getValues("exec_time"))[i]);
} else {
analyzeCasLogResultInfo.setMax((response.getValues("max"))[i]);
analyzeCasLogResultInfo.setMin((response.getValues("min"))[i]);
analyzeCasLogResultInfo.setAvg((response.getValues("avg"))[i]);
analyzeCasLogResultInfo.setCnt((response.getValues("cnt"))[i]);
analyzeCasLogResultInfo.setErr((response.getValues("err"))[i]);
}
analyzeCasLogResultList.addResultFile(analyzeCasLogResultInfo);
}
}
return analyzeCasLogResultList;
}
use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo in project cubrid-manager by CUBRID.
the class SqlLogAnalyzeResultDialog method insertArrayToTable.
/**
* insert AnalyzeCasLogResult information to table.
*
* @param analyzeCasLogResultList AnalyzeCasLogResultList
*/
public void insertArrayToTable(AnalyzeCasLogResultList analyzeCasLogResultList) {
if (analyzeCasLogResultList == null || analyzeCasLogResultList.getLogFileInfoList() == null) {
return;
}
for (AnalyzeCasLogResultInfo logResult : analyzeCasLogResultList.getLogFileInfoList()) {
TableItem item = new TableItem(table, SWT.NONE);
item.setText(0, logResult.getQindex());
if (option) {
item.setText(1, logResult.getExecTime());
} else {
item.setText(1, logResult.getMax());
item.setText(2, logResult.getMin());
item.setText(3, logResult.getAvg());
item.setText(4, logResult.getCnt());
item.setText(5, logResult.getErr());
}
}
}
use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo in project cubrid-manager by CUBRID.
the class SqlLogAnalyzeResultDialog method createAnalyzeResultTableOptionY.
/**
* This method initializes table when option is yes
*
* @param tlayout TableLayout
*/
private void createAnalyzeResultTableOptionY(TableLayout tlayout) {
tlayout.addColumnData(new ColumnWeightData(20, 60, true));
tlayout.addColumnData(new ColumnWeightData(20, 60, true));
table.setLayout(tlayout);
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (analyzeCasLogResultList == null || analyzeCasLogResultList.getLogFileInfoList() == null) {
return;
}
int selectioncount = table.getSelectionCount();
int resultCount = analyzeCasLogResultList.getLogFileInfoList().size();
StringBuilder queryString = new StringBuilder();
AnalyzeCasLogResultInfo logResult;
for (int j = 0; j < selectioncount; j++) {
String qindex = table.getSelection()[j].getText(0);
for (int i = 0; i < resultCount; i++) {
logResult = (AnalyzeCasLogResultInfo) (analyzeCasLogResultList.getLogFileInfoList().get(i));
if (qindex.equals(logResult.getQindex())) {
currentResultIndex = i;
queryString = connect(logResult.getQindex(), queryString);
queryString.append(logResult.getQueryString());
queryString.append(NEXT_LINE);
buttonRunOriginalQuery.setEnabled(true);
buttonSaveToFile.setEnabled(true);
break;
}
}
}
textQuery.setText(queryString.toString());
}
});
TableColumn qindex = new TableColumn(table, SWT.LEFT);
qindex.addSelectionListener(new DirectionAwareSelectionAdapter("qindex"));
qindex.setText(Messages.tableIndex);
qindex.setWidth(100);
TableColumn execTime = new TableColumn(table, SWT.LEFT);
execTime.addSelectionListener(new DirectionAwareSelectionAdapter("execTime"));
execTime.setText(Messages.tableTransactionExeTime);
execTime.setWidth(100);
}
use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo in project cubrid-manager by CUBRID.
the class SqlLogAnalyzeResultDialog method createAnalyzeResultTableOptionN.
/**
* This method initializes table when option is no
*
* @param tlayout TableLayout
*/
private void createAnalyzeResultTableOptionN(TableLayout tlayout) {
tlayout.addColumnData(new ColumnWeightData(13, 60, true));
tlayout.addColumnData(new ColumnWeightData(14, 60, true));
tlayout.addColumnData(new ColumnWeightData(14, 60, true));
tlayout.addColumnData(new ColumnWeightData(14, 60, true));
tlayout.addColumnData(new ColumnWeightData(20, 60, true));
tlayout.addColumnData(new ColumnWeightData(20, 60, true));
table.setLayout(tlayout);
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (analyzeCasLogResultList == null || analyzeCasLogResultList.getLogFileInfoList() == null) {
return;
}
int selectioncount = table.getSelectionCount();
int resultCount = analyzeCasLogResultList.getLogFileInfoList().size();
StringBuilder queryString = new StringBuilder();
AnalyzeCasLogResultInfo logResult;
for (int j = 0; j < selectioncount; j++) {
String qindex = table.getSelection()[j].getText(0);
for (int i = 0; i < resultCount; i++) {
logResult = (AnalyzeCasLogResultInfo) (analyzeCasLogResultList.getLogFileInfoList().get(i));
if (qindex.equals(logResult.getQindex())) {
currentResultIndex = i;
queryString = connect(logResult.getQindex(), queryString);
queryString.append(logResult.getQueryString());
queryString.append(NEXT_LINE);
buttonRunOriginalQuery.setEnabled(true);
buttonSaveToFile.setEnabled(true);
break;
}
}
}
textQuery.setText(queryString.toString());
}
});
TableColumn qindex = makeQindexColumn();
TableColumn max = makeMaxColumn();
TableColumn min = makeMinColumn();
TableColumn avg = makeAvgColumn();
TableColumn cnt = makeCntColumn();
TableColumn err = makeErrColumn();
qindex.setText(Messages.tableIndex);
max.setText(Messages.tableMax);
max.setAlignment(SWT.RIGHT);
min.setText(Messages.tableMin);
min.setAlignment(SWT.RIGHT);
avg.setText(Messages.tableAvg);
avg.setAlignment(SWT.RIGHT);
cnt.setText(Messages.tableTotalCount);
cnt.setAlignment(SWT.RIGHT);
err.setText(Messages.tableErrCount);
err.setAlignment(SWT.RIGHT);
qindex.setWidth(60);
max.setWidth(60);
min.setWidth(60);
avg.setWidth(60);
cnt.setWidth(50);
err.setWidth(50);
}
use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo in project cubrid-manager by CUBRID.
the class SqlLogAnalyzeResultDialog method insertArrayToTableSort.
/**
* insert sorted AnalyzeCasLogResult information to table.
*
* @param obj Object[]
*/
public void insertArrayToTableSort(Object[] obj) {
int itemcount = obj.length;
for (int i = 0; i < itemcount; i++) {
AnalyzeCasLogResultInfo logResult = (AnalyzeCasLogResultInfo) (obj[i]);
TableItem item = new TableItem(table, SWT.NONE);
item.setText(0, logResult.getQindex());
if (option) {
item.setText(1, logResult.getExecTime());
} else {
item.setText(1, logResult.getMax());
item.setText(2, logResult.getMin());
item.setText(3, logResult.getAvg());
item.setText(4, logResult.getCnt());
item.setText(5, logResult.getErr());
}
}
}
Aggregations