Importing Flat File Definitions
The E2E Flat File Definition Importer allows to import flat file definitions enabling the parsing and composing of flat files with delimited or fixed width fields. The importer uses this existing documentation and generates all necessary classes in the UML model. The only requirement for these flat file definitions is that the records and its attributes are described in a table or column oriented text file.
For more details on using these classes and the Flat File adapter refer to the description of the Flat File Adapter.
Start the import of flat file definitions by selecting Import > Flat File Definition from the E2E Model Compiler menu.
On the Flat File Importer dialog, select the appropriate settings for the import as described in the following sections.
Flat File Definition Import Dialog
First, select the flat file definition by clicking as displayed in the picture. | |
Navigate to the flat file definition and select it. | |
The importer reads the flat file definition and enables all options on the dialog to specify the format of the definitions and the records of the flat file that will be processed by the service. |
The dialog window is split into four sections.
The first section defines the name of the import package and the name of the class and the record class, which will represent flat file records. These classes and another class representing the flat file itself will be generated by the importer. It is possible to select only a range of data lines of the flat file definitions to import different classes from the same definition file. | |
The second section Split Flat File Definitions by defines the column delimiter of the flat file definitions. After choosing the correct setting, the identified fields are shown in the table at the bottom of the dialog window. The values should be clearly separated in columns. Otherwise, choose another delimiter. | |
The third section defines the type of the flat file itself. Select, if it is a fixed width or separated file. If it is separated, the correct delimiter has to be chosen. | |
The fields identified in the flat file definitions are shown in the table at the bottom of the dialog window, the fourth section of the dialog window. The field specifications are separated by columns. |
Composition of the Field Specification Table
The field specification table is composed as follows:
Element | Description |
---|---|
Line Number | The first column shows the line number of the flat file definition file. |
Bridge Type | The Bridge Type can be selected for each field. The importer will assign the selected Bridge base type to each attribute of the generated flat file record class. |
Column Specification | Assign some pre-defined E2E parameters to specify the content of the column. |
Bridge Type
In the third column, the Bridge Type can be selected for each field. The importer will assign the selected Bridge base type to each attribute of the generated flat file record class. By default, all attributes are defined as String. Choose one of the following base types by clicking the field for each data line:
Column Specification
In the next step, the content of the remaining columns needs to be assigned to some pre-defined E2E parameters defining the content of a column.
Clicking the header of each column with the right mouse button will open a context menu providing all possible parameters. Depending whether the flat file contains fixed width or delimited fields, the available parameters for each field can be selected as shown in the table below. Each parameter can only be selected once except for the parameters Additional Info and Ignore. |
Parameter | Description | Fixed Length (FIX) / Delimited (DEL) |
---|---|---|
Name | The data of this column contains the name of the attribute, which will be added to the flat file record class. | FIX / DEL |
Description | The data of this column contains the description of the attribute, which will be added to the documentation field of the class attribute. | FIX / DEL |
Additional Info | The data of this column will be appended to the documentation field of the class attribute. If defined more than once, each additional info will be shown in a separated line. This parameter can be selected several times. | FIX / DEL |
Ignore | This column will not be imported. You may ignore more than one columns. Ignored columns are displayed in orange. | FIX / DEL |
Offset | This column contains the position within a flat file record where the field begins. The position counting starts at position zero. This information is stored in the tagged value offset of each class attribute. | FIX |
Length | This column contains the length of the field in number of characters. This information is stored in the tagged value externalLength of each class attribute. | FIX |
All columns need to be assigned to a parameter. Otherwise, the OK button of the dialog remains disabled. If all settings are done, click OK to start the import. | |
If your parameter definitions are violating constraints (e.g. if you're omitting the length parameter), you'll get a warning like the one on the left. You can Ignore the warning and continue with importing the flat file, accepting that some information will be lost during the import. To return to the flat file definition import dialog click Review. | |
The flat file definitions can be imported into either an existing or a new UML model. See sections
|
Importing Flat File Definitions into an Existing UML Model
Wanting to import a flat file definition into an existing UML model, proceed as follows.
Importing Flat File Definitions into a New UML Model
Wanting to import a flat file definition into a new UML model, proceed as follows.
Generated Classes of the Flat File Definition Importer
The Importer generates two classes. One with the settings for the flat file, having the stereotype <<Flat File>> . The other class represents the flat file records and has the stereotype <<Flat File Record>> . Between these two classes, a directed association is generated by default. The association end belonging to the record definition is adorned with the stereotype <<E2E Attribute>> and a multiplicity. For more details, refer to the description of the Flat File Adapter in the Reference Guide.
The settings made in the Importer are cached. If you open the Importer again, all the settings of the last import are shown again. For importing an additional class from the same flat file definition file, change the name of the class in the first section of the dialog and define a divergent range of data lines.
The settings of the Importer are cached, as long MagicDraw is open.