Search in sources :

Example 76 with StreamInterface

use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.

the class AppendMeta method readRep.

public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases) throws KettleException {
    try {
        List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams();
        StreamInterface headStream = infoStreams.get(0);
        StreamInterface tailStream = infoStreams.get(1);
        headStream.setSubject(rep.getStepAttributeString(id_step, "head_name"));
        tailStream.setSubject(rep.getStepAttributeString(id_step, "tail_name"));
    } catch (Exception e) {
        throw new KettleException(BaseMessages.getString(PKG, "AppendMeta.Exception.UnexpectedErrorReadingStepInfo"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 77 with StreamInterface

use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.

the class AppendMeta method check.

public void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore) {
    CheckResult cr;
    List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams();
    StreamInterface headStream = infoStreams.get(0);
    StreamInterface tailStream = infoStreams.get(1);
    if (headStream.getStepname() != null && tailStream.getStepname() != null) {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "AppendMeta.CheckResult.SourceStepsOK"), stepMeta);
        remarks.add(cr);
    } else if (headStream.getStepname() == null && tailStream.getStepname() == null) {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(PKG, "AppendMeta.CheckResult.SourceStepsMissing"), stepMeta);
        remarks.add(cr);
    } else {
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(PKG, "AppendMeta.CheckResult.OneSourceStepMissing"), stepMeta);
        remarks.add(cr);
    }
}
Also used : CheckResult(org.pentaho.di.core.CheckResult) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 78 with StreamInterface

use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.

the class AppendMeta method saveRep.

public void saveRep(Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step) throws KettleException {
    try {
        List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams();
        StreamInterface headStream = infoStreams.get(0);
        StreamInterface tailStream = infoStreams.get(1);
        rep.saveStepAttribute(id_transformation, id_step, "head_name", headStream.getStepname());
        rep.saveStepAttribute(id_transformation, id_step, "tail_name", tailStream.getStepname());
    } catch (Exception e) {
        throw new KettleException(BaseMessages.getString(PKG, "AppendMeta.Exception.UnableToSaveStepInfo") + id_step, e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 79 with StreamInterface

use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.

the class FuzzyMatchDialog method getData.

/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
    if (isDebug()) {
        logDebug(BaseMessages.getString(PKG, "FuzzyMatchDialog.Log.GettingKeyInfo"));
    }
    wAlgorithm.setText(FuzzyMatchMeta.getAlgorithmTypeDesc(input.getAlgorithmType()));
    if (input.getMainStreamField() != null) {
        wMainStreamField.setText(input.getMainStreamField());
    }
    if (input.getLookupField() != null) {
        wLookupField.setText(input.getLookupField());
    }
    wcaseSensitive.setSelection(input.isCaseSensitive());
    wgetCloserValue.setSelection(input.isGetCloserValue());
    if (input.getMinimalValue() != null) {
        wminValue.setText(input.getMinimalValue());
    }
    if (input.getMaximalValue() != null) {
        wmaxValue.setText(input.getMaximalValue());
    }
    if (input.getOutputMatchField() != null) {
        wmatchField.setText(input.getOutputMatchField());
    }
    if (input.getOutputValueField() != null) {
        wvalueField.setText(input.getOutputValueField());
    }
    if (input.getSeparator() != null) {
        wseparator.setText(input.getSeparator());
    }
    if (input.getValue() != null) {
        for (int i = 0; i < input.getValue().length; i++) {
            TableItem item = wReturn.table.getItem(i);
            if (input.getValue()[i] != null) {
                item.setText(1, input.getValue()[i]);
            }
            if (input.getValueName()[i] != null && !input.getValueName()[i].equals(input.getValue()[i])) {
                item.setText(2, input.getValueName()[i]);
            }
        }
    }
    StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
    wStep.setText(Const.NVL(infoStream.getStepname(), ""));
    wReturn.setRowNums();
    wReturn.optWidth(true);
    wStepname.selectAll();
    wStepname.setFocus();
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 80 with StreamInterface

use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.

the class MergeJoinDialog method getData.

/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
    List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
    wStep1.setText(Const.NVL(infoStreams.get(0).getStepname(), ""));
    wStep2.setText(Const.NVL(infoStreams.get(1).getStepname(), ""));
    String joinType = input.getJoinType();
    if (joinType != null && joinType.length() > 0) {
        wType.setText(joinType);
    } else {
        wType.setText(MergeJoinMeta.join_types[0]);
    }
    for (int i = 0; i < input.getKeyFields1().length; i++) {
        TableItem item = wKeys1.table.getItem(i);
        if (input.getKeyFields1()[i] != null) {
            item.setText(1, input.getKeyFields1()[i]);
        }
    }
    for (int i = 0; i < input.getKeyFields2().length; i++) {
        TableItem item = wKeys2.table.getItem(i);
        if (input.getKeyFields2()[i] != null) {
            item.setText(1, input.getKeyFields2()[i]);
        }
    }
    wStepname.selectAll();
    wStepname.setFocus();
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) 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