Java Edit Variable

Edit or add flow variables using java code. The node is analogous to the Java Snippet node: In the central panel, added java code to add or modify variables. The variables available at the input are listed on the left.

It is also possible to use external java libraries (that is, libraries that are not part of java boot classpath). In order to include such external jar or zip files, add their location in the "Additional Libraries" tab using the control buttons.

You can define reusable templates with the "Create templates..." button. Templates are stored in the users workspace by default and can be accessed via the "Templates" tab.

Options

Flow Variable List
The list contains the flow variables that are currently available at the node input. Double clicking any of the entries will insert the respective identifier at the current cursor position (replacing the selection, if any).
Snippet text area
Enter your java code here. You can access input flow variables by defining them in the Snippet fields for input. A second way is to use the method getFlowVariable(name, type) where name is the name of the flow variable, respectively. You can use the following values for the type parameter.
tString : String
tInt : Integer
tDouble : Double

Java Snippet Methods:
getFlowVariable(name, type) : Get value of a flow variable by name
getFlowVariables(type) : Get all flow variables by type. A name to value map is returned.
flowVariableExists(name) : Check if a flow variable with given name exists
isFlowVariableOfType(name, type) : Check if a flow variable is of type

You can hit ctrl+space to get an auto completion box with all available classes, methods and fields. When you select a class and hit enter a import statement will be generated if missing.

Note, that the snippet allows defining custom global variables and custom imports.

Exceptions in the snippet are caught by the framework and will cause the execution to fail. If you want to stop execution, please use an exception of class Abort. It gives the user a nice error message.

Input
Define system input fields for the snippet text area. Every field represents a flow variable of the input.
Output
Define flow variables that will be added to stack of flow variables at the output. Every row in the Output table defines a java field bound to a flow variable. Values assigned to this field in the snippet will set the value of the flow variable at the output.
Run script during node configuration or during node execution
In the former case, the snippet is run as soon as the node is configured (default). In the latter case, the snippet is run only once when the node is being executed, i.e. going from yellow to green state. This means that variables are populated later, often causing downstream nodes to be not configurable, as the created variables have a meaningless default value. However, sometimes this is necessary when, for instance, the snippet involves heavy computation, network access or another kind of I/O operation. If unsure, set this option to run the script during node configuration.

Input Ports

Icon
Input variables (optional).

Output Ports

Icon
Output variables.

Popular Predecessors

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.