Search in sources :

Example 81 with StreamInterface

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();
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 82 with StreamInterface

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();
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) MessageDialogWithToggle(org.eclipse.jface.dialogs.MessageDialogWithToggle) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 83 with StreamInterface

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();
}
Also used : StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 84 with StreamInterface

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;
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Aggregations

StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)84 KettleException (org.pentaho.di.core.exception.KettleException)31 KettleStepException (org.pentaho.di.core.exception.KettleStepException)26 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)19 StepIOMetaInterface (org.pentaho.di.trans.step.StepIOMetaInterface)19 StepMeta (org.pentaho.di.trans.step.StepMeta)19 Stream (org.pentaho.di.trans.step.errorhandling.Stream)10 TableItem (org.eclipse.swt.widgets.TableItem)8 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)8 Test (org.junit.Test)7 CheckResult (org.pentaho.di.core.CheckResult)7 KettleRowException (org.pentaho.di.core.exception.KettleRowException)7 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)7 ArrayList (java.util.ArrayList)6 TransHopMeta (org.pentaho.di.trans.TransHopMeta)6 StepIOMeta (org.pentaho.di.trans.step.StepIOMeta)6 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)5 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)5 Point (org.pentaho.di.core.gui.Point)5 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)5