Search in sources :

Example 6 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class JobDialog method getJobEntryLogTableOptions.

private void getJobEntryLogTableOptions(JobEntryLogTable jobEntryLogTable) {
    // The connection...
    // 
    jobEntryLogTable.setConnectionName(wLogconnection.getText());
    jobEntryLogTable.setSchemaName(wLogSchema.getText());
    jobEntryLogTable.setTableName(wLogTable.getText());
    jobEntryLogTable.setTimeoutInDays(wLogTimeout.getText());
    for (int i = 0; i < jobEntryLogTable.getFields().size(); i++) {
        TableItem item = wOptionFields.table.getItem(i);
        LogTableField field = jobEntryLogTable.getFields().get(i);
        field.setEnabled(item.getChecked());
        field.setFieldName(item.getText(1));
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem)

Example 7 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class JobDialog method getJobLogTableOptions.

private void getJobLogTableOptions(JobLogTable jobLogTable) {
    // The connection...
    // 
    jobLogTable.setConnectionName(wLogconnection.getText());
    jobLogTable.setSchemaName(wLogSchema.getText());
    jobLogTable.setTableName(wLogTable.getText());
    jobLogTable.setLogInterval(wLogInterval.getText());
    jobLogTable.setLogSizeLimit(wLogSizeLimit.getText());
    jobLogTable.setTimeoutInDays(wLogTimeout.getText());
    for (int i = 0; i < jobLogTable.getFields().size(); i++) {
        TableItem item = wOptionFields.table.getItem(i);
        LogTableField field = jobLogTable.getFields().get(i);
        field.setEnabled(item.getChecked());
        field.setFieldName(item.getText(1));
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem)

Example 8 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class JobDialog method getChannelLogTableOptions.

private void getChannelLogTableOptions(ChannelLogTable channelLogTable) {
    // The connection...
    // 
    channelLogTable.setConnectionName(wLogconnection.getText());
    channelLogTable.setSchemaName(wLogSchema.getText());
    channelLogTable.setTableName(wLogTable.getText());
    channelLogTable.setTimeoutInDays(wLogTimeout.getText());
    for (int i = 0; i < channelLogTable.getFields().size(); i++) {
        TableItem item = wOptionFields.table.getItem(i);
        LogTableField field = channelLogTable.getFields().get(i);
        field.setEnabled(item.getChecked());
        field.setFieldName(item.getText(1));
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem)

Example 9 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class TransHistoryDelegate method showLogEntry.

private void showLogEntry() {
    TransHistoryLogTab model = models[tabFolder.getSelectionIndex()];
    Text text = model.logDisplayText;
    if (text == null || text.isDisposed()) {
        return;
    }
    List<Object[]> list = model.rows;
    if (list == null || list.size() == 0) {
        String message;
        if (model.logTable.isDefined()) {
            message = BaseMessages.getString(PKG, "TransHistory.PleaseRefresh.Message");
        } else {
            message = BaseMessages.getString(PKG, "TransHistory.HistoryConfiguration.Message");
        }
        text.setText(message);
        return;
    }
    // grab the selected line in the table:
    int nr = model.logDisplayTableView.table.getSelectionIndex();
    if (nr >= 0 && nr < list.size()) {
        // OK, grab this one from the buffer...
        Object[] row = list.get(nr);
        // What is the name of the log field?
        // 
        LogTableField logField = model.logTable.getLogField();
        if (logField != null) {
            int index = model.logTableFields.indexOf(logField);
            if (index >= 0) {
                String logText = row[index].toString();
                text.setText(Const.NVL(logText, ""));
                text.setSelection(text.getText().length());
                text.showSelection();
            } else {
                text.setText(BaseMessages.getString(PKG, "TransHistory.HistoryConfiguration.NoLoggingFieldDefined"));
            }
        }
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) Text(org.eclipse.swt.widgets.Text) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 10 with LogTableField

use of org.pentaho.di.core.logging.LogTableField in project pentaho-kettle by pentaho.

the class TransHistoryDelegate method displayHistoryData.

private void displayHistoryData(final int index) {
    TransHistoryLogTab model = models[index];
    ColumnInfo[] colinf = model.logDisplayTableView.getColumns();
    // 
    if (model.logDisplayTableView == null || model.logDisplayTableView.isDisposed()) {
        return;
    }
    int selectionIndex = model.logDisplayTableView.getSelectionIndex();
    model.logDisplayTableView.table.clearAll();
    List<Object[]> rows = model.rows;
    if (rows != null && rows.size() > 0) {
        // 
        for (Object[] rowData : rows) {
            TableItem item = new TableItem(model.logDisplayTableView.table, SWT.NONE);
            for (int c = 0; c < colinf.length; c++) {
                ColumnInfo column = colinf[c];
                ValueMetaInterface valueMeta = column.getValueMeta();
                String string = null;
                try {
                    string = valueMeta.getString(rowData[c]);
                } catch (KettleValueException e) {
                    log.logError("history data conversion issue", e);
                }
                item.setText(c + 1, Const.NVL(string, ""));
            }
            // Add some color
            // 
            Long errors = null;
            LogStatus status = null;
            LogTableField errorsField = model.logTable.getErrorsField();
            if (errorsField != null) {
                int index1 = model.logTableFields.indexOf(errorsField);
                try {
                    errors = colinf[index1].getValueMeta().getInteger(rowData[index1]);
                } catch (KettleValueException e) {
                    log.logError("history data conversion issue", e);
                }
            }
            LogTableField statusField = model.logTable.getStatusField();
            if (statusField != null) {
                int index1 = model.logTableFields.indexOf(statusField);
                String statusString = null;
                try {
                    statusString = colinf[index1].getValueMeta().getString(rowData[index1]);
                } catch (KettleValueException e) {
                    log.logError("history data conversion issue", e);
                }
                if (statusString != null) {
                    status = LogStatus.findStatus(statusString);
                }
            }
            if (errors != null && errors > 0L) {
                item.setBackground(GUIResource.getInstance().getColorRed());
            } else if (status != null && LogStatus.STOP.equals(status)) {
                item.setBackground(GUIResource.getInstance().getColorYellow());
            }
        }
        model.logDisplayTableView.removeEmptyRows();
        model.logDisplayTableView.setRowNums();
        model.logDisplayTableView.optWidth(true);
    } else {
        model.logDisplayTableView.clearAll(false);
    // new TableItem(wFields.get(tabIndex).table, SWT.NONE); // Give it an item to prevent errors on various
    // platforms.
    }
    if (selectionIndex >= 0 && selectionIndex < model.logDisplayTableView.getItemCount()) {
        model.logDisplayTableView.table.select(selectionIndex);
        showLogEntry();
    }
}
Also used : LogTableField(org.pentaho.di.core.logging.LogTableField) TableItem(org.eclipse.swt.widgets.TableItem) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) LogStatus(org.pentaho.di.core.logging.LogStatus) KettleValueException(org.pentaho.di.core.exception.KettleValueException)

Aggregations

LogTableField (org.pentaho.di.core.logging.LogTableField)25 TableItem (org.eclipse.swt.widgets.TableItem)18 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)10 FormAttachment (org.eclipse.swt.layout.FormAttachment)8 FormData (org.eclipse.swt.layout.FormData)8 Label (org.eclipse.swt.widgets.Label)8 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)8 TextVar (org.pentaho.di.ui.core.widget.TextVar)8 FieldDisabledListener (org.pentaho.di.ui.core.widget.FieldDisabledListener)7 KettleValueException (org.pentaho.di.core.exception.KettleValueException)6 TableView (org.pentaho.di.ui.core.widget.TableView)5 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)3 Database (org.pentaho.di.core.database.Database)3 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)3 ResultSet (java.sql.ResultSet)2 ArrayList (java.util.ArrayList)2 Text (org.eclipse.swt.widgets.Text)2 KettleException (org.pentaho.di.core.exception.KettleException)2 LogStatus (org.pentaho.di.core.logging.LogStatus)2 LogTableInterface (org.pentaho.di.core.logging.LogTableInterface)2