Declaration of Modeler item types and extended properties - 4G meta classes (TDK)
A TDK Code Generation Transformation Patterns model uses Meta Classes to declare Modeler item types and their extended properties. A Meta Class is a Class that is stereotyped by the 4Meta stereotype.
* 
When you customize a TDK Code Generation Transformation Patterns model, you have to change the Meta Classes only if you want to work with Modeler item types or extended properties that are not currently being worked with by the associated ACS Code Generator DLL. For example, if you create a new Tag Definition and you want that Tag Definition to be used when generating code, you will have to declare that Tag Definition.
Do not change the provided Meta Classes - if you do so, your changes will be lost should you update the TDK Code Generation Transformation Patterns model with improvements provided in a future release of Modeler.
A TDK Code Generation Transformation Patterns model uses rules to define code generation. If a rule uses a Modeler item type or an extended property that item type or extended property must be declared in the TDK Code Generation Transformation Patterns model.
Declaring which Modeler item types to work with
A TDK Code Generation Transformation Patterns model declares the Modeler item types with which the generated ACS Code Generator DLL is going to work.
To declare a Modeler item type, the TDK Code Generation Transformation Patterns model must contain a Class whose name is the same as the automation interface name of the Modeler item type. In addition, the Class must be stereotyped by the 4Meta stereotype. The supplied 4Meta classes reside in the Generator::Structure package and these Classes are shown on the GWStructure class diagram that resides in the same package. For example, to declare the Parameter item:
A TDK Code Generation Transformation Patterns model declares ownership relationships between the Modeler items it declares through composite Aggregations between the Meta Classes. For example, in the GWStructure class diagram, you can see that a Class can own many Attributes:
Declaring extended Modeler properties to work with
A TDK Code Generation Transformation Patterns model must declare the extended properties of the Modeler item types with which TDK Code Generation Transformation Patterns model rules are going to work. Standard properties of Modeler items do not need to be declared.
The appropriate Meta Class declares the extended properties through Attributes of that Class. The name of each Attribute must be the same as the name of the extended property. The Data Type of the Attribute must be set to the %string basic type. For example, to declare the C# Attributes tag definition that can be applied to a Parameter:
Declaring and defining derived attributes
A Meta Class can declare and define derived attributes that are derived from other properties of the Modeler item. This is achieved by creating an Operation on the Meta Class:
The Name of the Operation specifies the name of the derived attribute that is being declared.
The Operation must not have any Parameters.
The Return Type of the Operation must be set to the %string basic type.
The SDL script for deriving the value is specified in the Body property of the Operation.
* 
On the Meta Class for an Operation, you could declare and define a derived attribute that identifies whether an Operation is a constructor using the following SDL script:
%return (? Self.Name == Self->Class.Name ? "TRUE" ¦ "False" ?)
Declaring and defining derived associations
A Meta Class can declare and define derived associations that are derived from other associations of the Modeler item. This is achieved by creating an Operation on the Meta Class.
The Name of the Operation specifies the name of the derived association that is being declared.
The Operation must not have any Parameters.
The Return Type of the Operation must be set to the %list or %object basic type.
The SDL script for deriving the value is specified in the Body property of the Operation.
* 
On the Meta Class for a Class, you could declare and define a derived Operation that identifies its public Attributes using the following SDL script
%list Ret
%for Self->Attribute
%if %c:Access == "Public" %then
%add Ret, %c
%endif
%endfor
%return Ret
Generic operation extensions
In addition to creating Operations for derived attributes and associations, you can create generic Operations for a Meta Class - these Operations can take parameters and return values that are calculated through SDL script that works with properties of the Modeler item.
* 
You could create an Operation that returns a list of dependee Packages and Classes that are linked to an item through a Dependency of a specified type. The signature of the Operation is as follows:
Dependees(DependencyType:%string):%list
The SDL script is as follows:
%list Ret
%for Self->"Dependency Start"
%if %c:"Dependency Type" == DependencyType %then
%add Ret, %c
%endif
%endfor
%return Ret