Creating a Generated File

The Generated Files category contains an entry for each type of file that will be generated for the metaclass, stereotype, or criterion. Only files defined for objects belonging directly to a model or a package collection will be generated. Sub-objects, like attributes, columns, or parameters do not support file generation, but it can be interesting to see the code generated for these sub-objects in their Preview tab.

Note:

If an extension attached to the model contains a generated file name identical to one defined in the main resource file, then the extension generated file will be generated.

  1. Right-click a metaclass, stereotype, or criterion, and select New > Generated File.
  2. Enter a name in the Name box, specify a file name, and select a file type to provide syntax coloring.
  3. Enter the template for the contents of the generated file in the text zone:


  4. Click Apply to save your changes.

Each generated file has the following properties:

Property

Description

Name

Specifies a name for the file entry in the resource editor.

File Name

Specifies the name of the file that will be generated. This field can contain GTL variables. For example, to generate an XML file with the code of the object for its name, you would enter %code%.xml.

If you leave this field empty, then no file will be generated, but you can view the code produced in the object's Preview tab.

If this field contains a recognized extension, the code is displayed with the corresponding language editor and syntactic coloring.

Type

Specifies the type of file to provide appropriate syntax coloring in the Preview window.

Encoding

Specifies the encoding format for the file. Click the ellipsis tool to the right of the field to choose an alternate encoding from the Text Output Encoding Format dialog, where you can specify the following options:
  • Encoding - Encoding format of the generated file
  • Abort on character loss - Specifies to stop generation if characters cannot be identified and are to be lost in current encoding

Comment

Specifies additional information about the generated file

Use package hierarchy as file path

Specifies that the package hierarchy should be used to generate the hierarchy of file directories.

Generated file template (text zone)

Specifies the template of the file to generate. You can enter the template directly here or reference a template defined elsewhere in the profile (see Customizing Generation with GTL).