Creating a Dictionary

The dictionary specification provides so called "interface" of the graph and is always required, even, for example, when the graph is used with Launch Service.

In the source code, the entries of the dictionary are specified inside the <Dictionary> element.

To create a dictionary, right-click the Dictionary item in the Outline pane and choose Edit from the context menu. The Dictionary editor will open.

Dictionary Dialog with Defined Entries

Figure 38.1. Dictionary Dialog with Defined Entries


Click the Plus sign button on the left to create a new dictionary entry.

After that, specify its Name. You must also specify other properties of the entry:

  1. Name

    Specifies the name of the dictionary entry.

    Names are case-sensitive and must be unique within the dictionary. Generally, the dictionary name does not have to be a valid java identifier. For example dictionary name in File URL attribute does not require this. We recommend using legal java identifiers as an access to dictionary in CTL requires the dictionary name to be a legal java identifier.

  2. As Input

    Specifies whether the dictionary entry can be used as input or not. Its value can be true or false.

  3. As Output

    Specifies whether the dictionary entry can be used as output or not. Its value can be true or false.

  4. Type

    Specifies the type of the dictionary entry.

    Dictionary types are the following primitive CloverETL data types:

    • boolean, byte, date, decimal, integer, long, number, and string.

    Any of these can also be accessed in CTL2. See Dictionary in CTL2 for detailed information.

    Additionally, there are two types of multi-value dictionary entries:

    • list - a generic list of elements

    • map - a generic mapping from keys to values

    See Multivalue Fields for further information about multi-value data types in CloverETL.

    [Tip]Tip

    Both list and map dictionary entries can also be accessed in CTL2, but you need to specify the type of elements of the list or map in the Content Type column, see the picture below:

    For example, if you create a dictionary entry of the type list and set the Content Type to integer, you can access the entry in CTL2 as integer[] - a list of integers.

    Similarly, if you create a dictionary entry of the type map and set the Content Type to number, you can access the entry in CTL2 as map[string, number] - a mapping from string keys to number values (the keys are always assumed to be of the string data type).

    There are three other data types of dictionary entries (available in Java):

    • object - CloverETL data type available with CloverETL Engine.

    • readable.channel - the input will be read directly from the entry by the Reader according to the configuration of the Reader. Therefore, the entry must contain data in valid format.

    • writable.channel - the output will be written directly to this entry in the format given by the output Writer (e.g., text file, XLS file, etc.)

  5. Content Type

    This specifies the content type of the output entry. This content type will be used, for example, when the graph is launched via Launch Service to send the results back to user.

  6. Initial Value

    Default value of an entry - useful when executing your graph without actually populating the dictionary with external data. Note that not you cannot edit this field for all data types (e.g. object). As you set a new Initial Value, a corresponding name-value pair is created in the right-hand Properties pane. Initial value is therefore the same as the first value you have created in that pane.

Each entry can have some properties (name and value). To specify them, click corresponding button on the right and specify the following two properties: