Book a Demo

Author Topic: MDA Transformation - how to access objects  (Read 2872 times)

IFUser

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
MDA Transformation - how to access objects
« on: January 19, 2011, 03:14:00 am »
Hi @all,

currently I am stuck with a very simple problem. I want to transform my model (I am using C# standard templates).

The default template "Linked Attribute":

Code: [Select]
$type=%linkAttName%

$collectionClass=%COLLECTION_CLASS("C#")%
%if $collectionClass != "" and linkCard != "" and linkCard != "0" and linkCard != "0..1" and linkCard != "1"%
$type=$collectionClass
%endIf%

$name = %linkAttRole%
%if $name == ""%
$name = %REPLACE(genOptDefaultAssocAttName,"$LinkClass",linkAttName)%
%endIf%

%Property($name,$type)%

Ok, I want to change this line now:

Code: [Select]
$name = %REPLACE(genOptDefaultAssocAttName,"$LinkClass",linkAttName)%
My objective is to generate/assume a role name, which is build this way:
LinkedClass name + "Obj"

e.g. in :

+-----+           +-----+
| Cl1  | -------- | Cl2  |
+-----+           +-----+

"Cl1" should get a property with name "Cl2Obj".

In this template language, I miss the ability to select the name of "Cl2". I can only write a sub template and call "LinkedClassBase__GetName", for example. But then I get to "Cl1" and not the opposite class.

Did I miss something very basic fundamental from the manual?
(BTW: I come from the OCL world where such an issue is no problem)

Thank you!
« Last Edit: January 19, 2011, 07:17:22 pm by IFUser »