Repository functions library


In the previous examples, some repository functions have been used, such as ColumnDefault in the ATTR's example, and PrimaryuniquekeyColumns in the CONN example. These repository functions are used in order to gather information from a ModelSphere project. The complete list of repository functions (repository functions API) can be found in the doc / template-API directory.

So why is the repository functions' API an HTML document, while the rest of the documentation is in PDF? Because this document is generated by the javadoc tool. Javadoc is broadly used in the Java world; each time a new version is released, the documentation is automatically generated. Thus it allows to always have an up-to-date documentation.

How to find a specific repository function in the HTML document? Any repository function appears as a field of a special class named GenericMapping. To locate a particular repository function, such as ColumnDefault, you can look into the Field Summary, where all the repository functions are sorted in alphabetic order. Each entry in the Field Summary provides a short description about the repository function and a hyperlink towards a more detailed description.

You can also go to the Field Detail: the repository functions are then sorted according to the target systems involved. There are six sections :
You can go to a specific section by clicking on a Section_X in the Field Summary. Within each section, the repository functions are sorted by concept (all table-related functions together, all column-related functions together, and so on).

The Constructor Summary, Method Summary, Constructor Detail and Method Detail sections are of no interest for a template files user. You can ignore these sections. There are two kinds of repository functions: attribute repository functions (they always appear after the ATTR keyword in a template file) and connector repository functions (they always appear after the CONN keyword in a template file).

Here is an example of an attribute repository function:

ColumnDefault
public static
org.modelsphere.sms.plugins.generic.GenericMapping.GenericMapping
Entry ColumnDefault
Returns the column's initial value.
Target System : All Except Java
Type : Attribute
Returns : String.



The Target System field tells on which target system a given repository function will work. ColumnDefault works for all target systems (Oracle, Informix, etc.) except Java. The Target System field tells which kind of repository function it is, in our example ColumnDefault is an attribute repository function, thus it can only be used in an ATTR class rule in a template file.

The 'Returns' field (only on attribute repository function) tells what kind of values is returned by the attribute repository function. String implies that an arbitrary string can be returned. Often you will find 'a string representing an integer'. This proposes the returned value is actually a string and not an integer, but this string always represents a whole number. Possible values are be "1", '33", "400". Values like "name", "1.5" and "2/3" are impossible. Finally if the 'Returns' field has "true" or "false", it means only these two values can be returned by the function.

Here is an example of a connector repository function:

PrimaryuniquekeyColumns
public static
org.modelsphere.sms.plugins.generic.GenericMapping.GenericMapping
Entry PrimaryuniquekeyColumns
For a primary or a unique key, lists all its columns.
Target System : All Except Java
Type : Connector


The fields are the same than those in attribute repository functions, except there is no 'Returns' field: a connector does not return a value, but rather lists one or more objects. Some repository functions are marked as deprecated; it means that their usage is still allowed for the current version, but the function is planned to be removed in the next versions. It is thus strongly recommended to avoid using these functions