Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
title:Warning
title:Warning
borderColorblack
bgColor#ffff00
borderStylesolid

(warning) PLEASE NOTE: This documentation applies to Pentaho 8.1 and an earlier version. For Pentaho 8.2 and later, see User Defined Java Class on the most recent documentation, visit the Pentaho Enterprise Edition documentation site.

Description

This step allows you to enter User Defined Java Class to drive the functionality of a complete step.  In essence, this step allows you to program your own plugin in a step.

...

IMPORTANT: The Java data types that you get from previous steps always corresponds to the Kettle data type as described on the PDI Rows Of Data page.

Output fields

You can define all the new fields you want in the output of the step in the "Fields" section of the steps dialog:
Doing this will automatically calculate the layout of the output row metadata and store it in "data.outputRowMeta".  That in turn allows you to create the output row.  In case the step writes as many (or less) rows as it reads, you can simply resize the row you get on input:

...

At runtime this will return the "year" String value.

Processing rows

The processRow() method is the heart of the step.  This method is called by the transformation in a tight loop and will continue until false is returned.  A very simple example that calculates firstname+" "+lastname and stores it into a "name" field is this:

...