use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class MergeRowsDialog method getData.
/**
* Copy information from the meta-data input to the dialog fields.
*/
public void getData() {
List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
wReference.setText(Const.NVL(infoStreams.get(0).getStepname(), ""));
wCompare.setText(Const.NVL(infoStreams.get(1).getStepname(), ""));
if (input.getFlagField() != null) {
wFlagfield.setText(input.getFlagField());
}
for (int i = 0; i < input.getKeyFields().length; i++) {
TableItem item = wKeys.table.getItem(i);
if (input.getKeyFields()[i] != null) {
item.setText(1, input.getKeyFields()[i]);
}
}
for (int i = 0; i < input.getValueFields().length; i++) {
TableItem item = wValues.table.getItem(i);
if (input.getValueFields()[i] != null) {
item.setText(1, input.getValueFields()[i]);
}
}
wStepname.selectAll();
wStepname.setFocus();
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class MergeRowsDialog method ok.
private void ok() {
if (Utils.isEmpty(wStepname.getText())) {
return;
}
List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
infoStreams.get(0).setStepMeta(transMeta.findStep(wReference.getText()));
infoStreams.get(1).setStepMeta(transMeta.findStep(wCompare.getText()));
input.setFlagField(wFlagfield.getText());
int nrKeys = wKeys.nrNonEmpty();
int nrValues = wValues.nrNonEmpty();
input.allocate(nrKeys, nrValues);
// CHECKSTYLE:Indentation:OFF
for (int i = 0; i < nrKeys; i++) {
TableItem item = wKeys.getNonEmpty(i);
input.getKeyFields()[i] = item.getText(1);
}
// CHECKSTYLE:Indentation:OFF
for (int i = 0; i < nrValues; i++) {
TableItem item = wValues.getNonEmpty(i);
input.getValueFields()[i] = item.getText(1);
}
// return value
stepname = wStepname.getText();
// PDI-13509 Fix
if (nrKeys > 0 && "Y".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y"))) {
MessageDialogWithToggle md = new MessageDialogWithToggle(shell, BaseMessages.getString(PKG, "MergeRowsDialog.MergeRowsWarningDialog.DialogTitle"), null, BaseMessages.getString(PKG, "MergeRowsDialog.MergeRowsWarningDialog.DialogMessage", Const.CR) + Const.CR, MessageDialog.WARNING, new String[] { BaseMessages.getString(PKG, "MergeRowsDialog.MergeRowsWarningDialog.Option1") }, 0, BaseMessages.getString(PKG, "MergeRowsDialog.MergeRowsWarningDialog.Option2"), "N".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y")));
MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
md.open();
props.setCustomParameter(STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y");
props.saveProps();
}
dispose();
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class AppendDialog method getData.
/**
* Copy information from the meta-data input to the dialog fields.
*/
public void getData() {
List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
StreamInterface headStream = infoStreams.get(0);
StreamInterface tailStream = infoStreams.get(1);
wHeadHop.setText(Const.NVL(headStream.getStepname(), ""));
wTailHop.setText(Const.NVL(tailStream.getStepname(), ""));
wStepname.selectAll();
wStepname.setFocus();
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pdi-dataservice-server-plugin by pentaho.
the class TransMutatorsTest method prepareTrans.
private TransMeta prepareTrans(String stepname, BiConsumer<String, TransMeta> mutator) throws KettleException {
String transPath = this.getClass().getResource("/TransMutatorsTest.ktr").getPath();
TransMeta transMeta = new TransMeta(transPath);
StreamInterface mockStream = mock(StreamInterface.class);
when(mockStream.getStreamType()).thenReturn(StreamInterface.StreamType.TARGET);
transMeta.findStep("Filter Rows").getStepMetaInterface().getStepIOMeta().addStream(mockStream);
mutator.accept(stepname, transMeta);
return transMeta;
}
Aggregations