Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Uffe on December 03, 2007, 12:17:12 am
-
Hi everyone,
I'm trying to create a model transform which, for each package, creates a new class which all transformed classes in that package have an association to.
I can create a class in the Namespace transform, and the respective classes in the Class transform. In the Class transform, I can create the association... almost. What's missing is the reference to the class created in the Namespace transform.
I can't seem to get my head around how to get hold of that reference.
Basically, the structure looks like this:
Namespace Package
{
%TRANSFORM_CURRENT()%
class
{
name="NewClass"
}
%list "Class"%
}
Class Class
{
%TRANSFORM_CURRENT()%
}
Association
{
Source
{
%TRANSFORM_REFERENCE()%
}
Target
{
-- Here's where I need the GUID for "NewClass" created in Namespace.
}
}
Any good ideas?
Cheers,
/Uffe\
-
The following should do it. Note that I've made the transform references in the class and association source explicit.
Namespace Package
{
%TRANSFORM_CURRENT()%
class
{
name="NewClass"
%TRANSFORM_REFERENCE("PackageClass", packageGUID)%
}
%list "Class"%
}
Class Class
{
%TRANSFORM_CURRENT()%
%TRANSFORM_REFERENCE("Class", classGUID)%
}
Association
{
Source
{
%TRANSFORM_REFERENCE("Class", classGUID)%
}
Target
{
%TRANSFORM_REFERENCE("PackageClass", packageGUID)%
}
}
-
Like a charm. Thanks for that!
\Uffe/