Search in sources :

Example 1 with AnalyzeCasLogResultInfo

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;
}
Also used : AnalyzeCasLogResultList(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList) AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 2 with AnalyzeCasLogResultInfo

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());
        }
    }
}
Also used : AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo) TableItem(org.eclipse.swt.widgets.TableItem)

Example 3 with AnalyzeCasLogResultInfo

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);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 4 with AnalyzeCasLogResultInfo

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);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 5 with AnalyzeCasLogResultInfo

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());
        }
    }
}
Also used : AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo) TableItem(org.eclipse.swt.widgets.TableItem)

Aggregations

AnalyzeCasLogResultInfo (com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo)12 AnalyzeCasLogResultList (com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)2 TableColumn (org.eclipse.swt.widgets.TableColumn)2 TableItem (org.eclipse.swt.widgets.TableItem)2 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)1 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)1 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)1 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)1 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)1 GetExecuteCasRunnerResultInfo (com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)1 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)1 GetExecuteCasRunnerContentResultTask (com.cubrid.cubridmanager.core.logs.task.GetExecuteCasRunnerContentResultTask)1 List (java.util.List)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Group (org.eclipse.swt.widgets.Group)1