Author Topic: Model Transformation: referencing new class  (Read 990 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1288
  • Karma: +95/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Model Transformation: referencing new class
« 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
Code: [Select]
Package
{
 %TRANSFORM_CURRENT()%
 class
 {
   name="NewClass"
 }
%list "Class"%
}


Class
Code: [Select]
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\
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6819
  • Karma: +63/-7
    • View Profile
Re: Model Transformation: referencing new class
« Reply #1 on: December 03, 2007, 01:06:56 am »
The following should do it.  Note that I've made the transform references in the class and association source explicit.

Namespace
Code: [Select]
Package
{
 %TRANSFORM_CURRENT()%
 class
 {
   name="NewClass"
   %TRANSFORM_REFERENCE("PackageClass", packageGUID)%
 }
%list "Class"%
}


Class
Code: [Select]
Class
{
%TRANSFORM_CURRENT()%

%TRANSFORM_REFERENCE("Class", classGUID)%
}
Association
{
Source
{
%TRANSFORM_REFERENCE("Class", classGUID)%
}
Target
{
   %TRANSFORM_REFERENCE("PackageClass", packageGUID)%
}
}
Eve

support@sparxsystems.com

Uffe

  • EA Practitioner
  • ***
  • Posts: 1288
  • Karma: +95/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Model Transformation: referencing new class
« Reply #2 on: December 03, 2007, 03:13:04 pm »
Like a charm. Thanks for that!

\Uffe/
My theories are always correct, just apply them to the right reality.