Difference between revisions of "Tigerstripe FAQ"
(→How do I Access Stereotype Values From a Template?)
|Line 47:||Line 47:|
Revision as of 07:54, 2 June 2008
< To: Tigerstripe
Tigerstripe Workbench provides an integrated Model-Driven Engineering framework allowing users to create/edit/maintain models across large teams, configure transformations to code, documentation or specifications and integrate it in a continuous build environment.
What is the relationship with Tigerstripe Software?
This is the open-source incarnation of Tigerstripe Workbench as it was distributed by ex-Tigerstripe Software. In January'07 the source code for Tigerstripe was cleaned up and contributed to the Tigerstripe Eclipse Project as a sub-project of the Eclipse Technology Project.
What's up with version numbers?
The last non-open source version of Tigerstripe Workbench was released as v2.2.4 on http://www.tigerstripedev.net. This was a stop gap release for existing users of Tigerstripe until the first open-source releases were made available. Additionally, following Eclipse Guidelines, Tigerstripe release numbering needs to comply with Eclipse rules. In particular, during the incubation period only 0.xx versions can be released.
So, although the contributed code remains the same, the first open-source build (Incubation 0.3) corresponds to a bugfix release for the last non-open release (v2.2.4).
OSS/J Support with Tigerstripe
How do I Access Stereotype Values From a Template?
Most model components support accessing Stereotypes, but the method of access is the same for all types. (See also method return Stereotypes)
The following example will generate an XML snippet for all of the stereotypes on "$component" which must be an IStereotypeCapable. It first checks for teh existence of *any* stereotype instances, then iterates over each instance. The CharacterizingStereotype is used to look up the *defined* attributes (ie in the profile) for this particular stereotype, and then we examine the attribute values - checking for array type attributes.
Note that not all of these steps will be applicable/required in all cases - for example you may not need the isEnpty() step at the start if there is no "wrapper" element required. Note also that the value of any StereotypeAttribute will be a String - in the case of a boolean Attribute type the values will be limited to "true" or "false".
#if(!$component.StereotypeInstances.isEmpty()) <ts:stereotypes> #foreach ($instance in $component.StereotypeInstances) <ts:stereotype name="$instance.Name"> #foreach ($attribute in $instance.CharacterizingStereotype.Attributes) <ts:stereotypeAttribute name="$attribute.Name" array="$attribute.Array"> #if($attribute.Array == "false") <ts:value>$instance.getAttributeValue($attribute)</ts:value> #else #foreach ($val in $instance.getAttributeValues($attribute)) <ts:value>$val</ts:value> #end #end </ts:stereotypeAttribute> #end </ts:stereotype> #end </ts:stereotypes> #end