Chapter 4 Extending your Models with Profiles


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   Priority of generated files
If an extended model definition attached to the model contains a generated file name identical to one defined in the main resource file, then the extended model definition generated file will be generated.

Steps To define a generated file:

  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.
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 box.. In this dialog box, select the Abort on Character Loss check box to stop generation if characters will be lost.
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 the Customizing Generation with GTL chapter).

 


Copyright (C) 2008. Sybase Inc. All rights reserved.