Sar-K background

Sar-K is a code generator tool that retrieves its model from a database schema, with all the tables and the relationships that defines it.
Sar-K tool is able to read the user database schema and transform it into an UML internal representation.

This representation is hierarchical, and it is organized as depicted below:

As you can see from this picture, there is just one model in Sar-K internal representation. This model contains a list of each database table, that in Sar-K language are called Classes. Each class contains some attributes, that correspond to the database columns. Each attribute is defined by a data type also, that is obtained from the database column definition.

Database data types are mapped into Sar-K internal types.

The model stores also the association between class attributes. Those association reflects the database foreign key mappings.

This model is used code production phase and it must contain all the data required to output the code.

Thus the model acquisition is the first step of Sar-K code generation. Unfortunately not all the model constraints can be stored in the database structure. So Sar-K allows you to give an additional input in a specific xml format to complete the data acquired from the database.

Second step for the Sar-K code production is the template configuration. Template configuration is used in order to customize the specific output template that is currently used.
It is possible to customize this template in order to get it working according to specific needs of your model and this is of course the core of the template configuration phase.

After having customized the template, only last phase is missing, that is the code production. This is an automatic phase, it is required to choose an output directory and to run the Sar-K internal Velocity engine to create the files.