use of org.pentaho.di.core.row.RowMetaInterface in project pentaho-kettle by pentaho.
the class PGBulkLoaderDialog method setTableFieldCombo.
private void setTableFieldCombo() {
Runnable fieldLoader = new Runnable() {
public void run() {
if (!wTable.isDisposed() && !wConnection.isDisposed() && !wSchema.isDisposed()) {
final String tableName = wTable.getText(), connectionName = wConnection.getText(), schemaName = wSchema.getText();
// clear
for (ColumnInfo colInfo : tableFieldColumns) {
colInfo.setComboValues(new String[] {});
}
if (!Utils.isEmpty(tableName)) {
DatabaseMeta ci = transMeta.findDatabase(connectionName);
if (ci != null) {
Database db = new Database(loggingObject, ci);
try {
db.connect();
String schemaTable = ci.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(schemaName), transMeta.environmentSubstitute(tableName));
RowMetaInterface r = db.getTableFields(schemaTable);
if (null != r) {
String[] fieldNames = r.getFieldNames();
if (null != fieldNames) {
for (ColumnInfo colInfo : tableFieldColumns) {
colInfo.setComboValues(fieldNames);
}
}
}
} catch (Exception e) {
for (ColumnInfo colInfo : tableFieldColumns) {
colInfo.setComboValues(new String[] {});
}
// ignore any errors here. drop downs will not be
// filled, but no problem for the user
} finally {
try {
if (db != null) {
db.disconnect();
}
} catch (Exception ignored) {
// ignore any errors here.
db = null;
}
}
}
}
}
}
};
shell.getDisplay().asyncExec(fieldLoader);
}
use of org.pentaho.di.core.row.RowMetaInterface in project pentaho-kettle by pentaho.
the class PGPDecryptStreamDialog method get.
private void get() {
if (!gotPreviousFields) {
try {
String fieldvalue = wStreamFieldName.getText();
String passphrasefieldvalue = wPassphraseFieldName.getText();
wStreamFieldName.removeAll();
wPassphraseFieldName.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
String[] fields = r.getFieldNames();
wStreamFieldName.setItems(fields);
wPassphraseFieldName.setItems(fields);
}
if (fieldvalue != null) {
wStreamFieldName.setText(fieldvalue);
}
if (passphrasefieldvalue != null) {
wPassphraseFieldName.setText(passphrasefieldvalue);
}
gotPreviousFields = true;
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogMessage"), ke);
}
}
}
use of org.pentaho.di.core.row.RowMetaInterface in project pentaho-kettle by pentaho.
the class PGPEncryptStreamDialog method get.
private void get() {
if (!gotPreviousFields) {
try {
String fieldvalue = wStreamFieldName.getText();
wStreamFieldName.removeAll();
String Keyfieldvalue = wKeyNameFieldName.getText();
wKeyNameFieldName.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
wStreamFieldName.setItems(r.getFieldNames());
wKeyNameFieldName.setItems(r.getFieldNames());
}
if (fieldvalue != null) {
wStreamFieldName.setText(fieldvalue);
}
if (Keyfieldvalue != null) {
wKeyNameFieldName.setText(Keyfieldvalue);
}
gotPreviousFields = true;
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PGPEncryptStreamDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PGPEncryptStreamDialog.FailedToGetFields.DialogMessage"), ke);
}
}
}
use of org.pentaho.di.core.row.RowMetaInterface in project pentaho-kettle by pentaho.
the class ProcessFilesDialog method get.
private void get() {
if (!gotPreviousFields) {
gotPreviousFields = true;
try {
String source = wSourceFileNameField.getText();
String target = wTargetFileNameField.getText();
wSourceFileNameField.removeAll();
wTargetFileNameField.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
wSourceFileNameField.setItems(r.getFieldNames());
wTargetFileNameField.setItems(r.getFieldNames());
if (source != null) {
wSourceFileNameField.setText(source);
}
if (target != null) {
wTargetFileNameField.setText(target);
}
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "ProcessFilesDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "ProcessFilesDialog.FailedToGetFields.DialogMessage"), ke);
}
}
}
use of org.pentaho.di.core.row.RowMetaInterface in project pentaho-kettle by pentaho.
the class PropertyInputDialog method setFileField.
private void setFileField() {
try {
String value = wFilenameField.getText();
wFilenameField.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
r.getFieldNames();
for (int i = 0; i < r.getFieldNames().length; i++) {
wFilenameField.add(r.getFieldNames()[i]);
}
}
if (value != null) {
wFilenameField.setText(value);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PropertyInputDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PropertyInputDialog.FailedToGetFields.DialogMessage"), ke);
}
}
Aggregations