JBoss.orgCommunity Documentation
This chapter includes detailed reference information on all tabs in the Smooks Configuration Editor.
The Process tab of the Smooks Configuration Editor provides a way to configure different types of transformations. By default the smooks configuration file is opened in this editor. If you have set another editor to open the file by default, you should right click on the smooks configuration file and select
→ .The Process tab has two sections:
You can see them on the picture below.
Using the popup menu in the Processing Task section you can select which types of technologies (templating or mapping ones) you will use for transformation:
The descriptions of the popup menu options are in the following table.
Table 3.1. Process Tab. Processing Task section.
Option | Description | Default |
---|---|---|
Add Task | Select one of the following tasks according to the required Source and Result file types:
| |
Delete | Click this option if you want to delete some task from the section. Note:you can't delete input task because it's required. | |
Input Methods | Choose one of the following methods:
| System |
The options available in this section depends on the selected task in the Processing Task section. Because there are 3 types of tasks there are 3 different sets of its options in the Selected Task Details Section. They will be described one by one.
On the picture below you can find an example of the Selected Task Details Section view if XML is selected as input type.
As you can see on the picture above the Input Configuration section is empty for XML input file. However, this section has special configuration options for CSV,EDI,JSON,Custom input files.
Here are the screens of these configuration options:
CSV:
EDI:
JSON:
Custom:
All the input task configuration positions can be found in the table below:
Table 3.2. Selected Task Details Section. Options for Input Task.
Option | Description | Default |
---|---|---|
Input type | Select your type of input file.
If you don't find your type in the list, you should use Custom type:
| XML |
Input configuration |
|
|
Input Data | You should select a data file using the | and buttons|
Input Model View | Using this view you can see the structure of your input file.If the file has been changed, to see the changes click the Refreshlink. |
Selected Task Details section for this task is presented by the graph, which eases the process of java mapping.
This graphical editor allows you to perform drag&drop operations with the nodes of transformed data to map the source data to target data. When you save the changes in the graphical editor the correct Smooks configuration file content will be generated.
Using the popup menu in the Selected Task Details section you can manage the diagram elements on the canvas.
The descriptions of the popup menu options are in the following table.
Table 3.3. Popup menu. Selected Task Details section.
Option | Description | Default |
---|---|---|
Add | Select one of the following tasks:
| |
Undo | This option allows you to revert any changes made in the previous step. | |
Redo | This option allows you to redo the changes made at the previous step. | |
Delete | This option is available only if you select an element on the canvas. Click this option if you want to delete the element from it. | |
Auto Layout | Sets the default layout of the elements on the canvas. | |
Properties | Click this option if you want to add the Properties view to the current perspective. The Properties view will automatically display the properties of the selected diagram element. | |
Input Methods | Choose one of the following methods:
| System |
Selected Task Details section for this task is presented by the graph, which is similar to what is described in the section Section 3.1.2.2, “Selected Task Details section for Java Mapping Task.”.
Popup menu similar to Table 3.3, “Popup menu. Selected Task Details section.”.
This section describes Options tab of the Smooks Configuration File editor, and gives short recommendations how this tab can be used during the project configuring.
The Smooks Configuration section in the Options Tab displays only the Smooks Platform Version value.
This value can not be modified, and is set according to the version of the Smooks libraries that are added to the project.
In Filter Settings section you can set the following global options responsible for the Smooks filtering configuration:
This behavior can be turned off using this global configuration parameter and can be overridden on a per fragment basis by targeting a Visitor implementation at that fragment that takes ownership of the Result writer (in the case of SAX filtering), or simply modifies the DOM (in the case of DOM filtering). As an example of this, see the FreeMarkerTemplateProcessor.
Table 3.4. Options Tab. Filter Settings section.
Option | Description | Default |
---|---|---|
Stream Filter Type | Determines the type of processing model that will be used. Please refer to the Filtering Process Selection section of the official Smooks User Guide for more information about these models:
| SAX |
Default Serialization is On | Defines whether the default serialization should be switched on. Default serialization being enabled leads to locating StreamResult/DOMResult to the Result objects provided to the Smooks.filterSource method and to serialization all the events to that Result. | false |
This section provides information about the Smooks Source Editor Page.
You can use this editor to edit the Smooks Configuration file directly.
If the Smooks tools can't understand the configuration file or the configuration file is illegal (e.g. XML structure isn't valid for a Smooks Configuration file), the error is underlined.
The Smooks configuration file validator will validate your Smooks configuration file. Just right-click on the file and then click on the
button. The validator can be enabled/disabled by selecting → → , as you can see in the image below:You can set up your Smooks validator to include and exclude groups to validate, and specify rules for validation. Just click on the
button and use the options provided, which you can see in the image below:Properties View is available for some elements on the canvas of Java Mapping and Apply Template Tasks, like:
Java mapping:java class members,its fields, links between input values and the class members;
Apply Template:output template.
To add Properties View to the opened perspective the user can either open → → in the toolbar or right click the element which properties he wants to inspect and select Properties in the popup menu. On the picture below you can see how this view looks like when some csv template is selected.
This view is fully synchronized with the canvas of the Smooks Configuration Editor. This means that when you change the selected element by clicking on it, the properties of a new element are immediately displayed in it. Using Properties View you can then edit all the properties of the selected item.
Smooks tools support decode parameter configuration through the Decode tab in Properties View activated by clicking the connection between input model and bean items.
On the picture below you can see an example of decode configurations for mapping an Input Model Item to a Date format:
The descriptions of the Decode Configuration tab options are listed in the following table:
Table 3.5. Decode Configuration tab in Properties View
Option | Description | |
---|---|---|
Decoder | Select from the dropdown list the type of decoder you need. | |
Decoder Parameters | For most of decoders the Decoder Parameters table is empty. But some of the decoders require additional configuration
(like Date decoder on the picture above), so you should configure them by editing the corresponding line in the Value row. For example, for the Date Decoder:
|
The Decoder Parameters section for EnumDecoder quite differs from other types of decoders. See the picture below:
The Decoder Parameters section for EnumDecoder in Properties View consists of 2 rows:
From Data Value - The lines in this row are editable. You can change them according to the names of enum types you used in input file.
To Enum Value - The lines in this row are not editable. Here a set of all constants declared in mapped Enum type is listed. The user is responsible for correspondence between the values in these two rows.
For more information about different decoder parameters read the Smooks Technology Documentation.
The Apply Template Wizard helps you to add a new Apply Template Task to the Smooks configuration file. You can call it from the popup menu when the Java Mapping item in the Processing Task section is selected by following → (see Figure 2.9, “Apply Template configuration” picture).
The wizard consists of several pages:
The first one includes only one option to adjust.The user should select in which of the two formats(XML or CSV) he prefers to create an output message:
The second page is specific for each of the output message formats:
If the CSV output message type was selected in the previous step the second wizard page will be the following :
The wizard page includes the next options to adjust:
Table 3.6. Apply Template Wizard. Second Page Options if CSV output format is selected.
Option | Description | Default |
---|---|---|
Fields | Comma separated list of CSV record field names. | Empty |
Separator Character | Field separator character in the output message. | , |
Quote Character | Quote character in the output message. | " |
Output Field name | Click the checkbox if you want the output CSV message to also include field names. |
The following second wizard page will appear if the XML output message type was selected in the previous step:
Here you should first select the XSD or Sample XML output template format and then click the Browse File System or the Browse Workspace button depending on what browse type you want to use. For example, if you click Browse Workspace the following view will appear:
In the workspace you should select the template you want to use and click the
button.If you selected XSD format after adjusting the template path you should click the
button:After that it is necessary to select the root node for the template in the Select Root Element. Then click the button.
If you have chosen Sample XML option after selecting the template XML file destination you should only click the
button: