use of org.pentaho.di.trans.steps.yamlinput.YamlReader in project pentaho-kettle by pentaho.
the class YamlInputDialog method get.
private void get() {
YamlReader yaml = null;
try {
YamlInputMeta meta = new YamlInputMeta();
getInfo(meta);
FileInputList inputList = meta.getFiles(transMeta);
if (inputList.getFiles().size() > 0) {
wFields.removeAll();
yaml = new YamlReader();
yaml.loadFile(inputList.getFile(0));
RowMeta row = yaml.getFields();
for (int i = 0; i < row.size(); i++) {
ValueMetaInterface value = row.getValueMeta(i);
TableItem item = new TableItem(wFields.table, SWT.NONE);
item.setText(1, value.getName());
item.setText(2, value.getName());
item.setText(3, value.getTypeDesc());
}
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.ErrorParsingData.DialogMessage"), e);
} finally {
if (yaml != null) {
try {
yaml.close();
} catch (Exception e) {
/* Ignore */
}
}
}
}
Aggregations