Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Rollie on December 03, 2008, 02:18:44 pm

Title: Need to add to Notes during transformation
Post by: Rollie on December 03, 2008, 02:18:44 pm
I am trying to add @Model to the beginning of the Notes of Classes that are being transformed into Interfaces.  In my transformation, @Model ends up in the transformed Interface, but the original notes from the source Class object are lost.  I have tried several different things, but nothing seems to work.

Here is my transformation code for the Class macro:

%if elemType != "Class" and elemType != "Interface"%
%endTemplate%
Interface
{
  %TRANSFORM_REFERENCE("Class")%
  %TRANSFORM_CURRENT("language", "notes")%
  language="Java"
  notes=%qt%@Model\n%notes%%qt%
%list="ClassBase" @separator="\n" @indent="  "%
%list="ClassInterface" @separator="\n" @indent="  "%
%list="InnerClass" @separator="\n" @indent="  "%
%if elemType=="Class"%
%list="Attribute" @separator="\n" @indent="  "%
%endIf%
%list="Attribute__AsProperties" @separator="\n" @indent="  " attScope=="Public"%
%list="Operation" @separator="\n" @indent="  "%
}
%list="Connector" @separator="\n"%
Title: Re: Need to add to Notes during transformation
Post by: Eve on December 04, 2008, 09:07:23 am
The problem is that there is no such macro as %notes%.  You'll need to use %classNotes%.
Title: Re: Need to add to Notes during transformation
Post by: Rollie on December 04, 2008, 10:10:08 am
Thanks Simon.  Worked like a charm!
Title: Re: Need to add to Notes during transformation
Post by: Gary W. on December 06, 2008, 11:25:40 am
Quote
The problem is that there is no such macro as %notes%.  You'll need to use %classNotes%.
Sooo, is there any place that lists all the macros?

Or how to refer to a property from another element?  My specific example is the "Alias" value from the "Domain Model" package.  I wish to prefix all DDL Tranformed tables with this value, as part of the Tranformation.

TIA
Gary
Title: Re: Need to add to Notes during transformation
Post by: Rollie on December 07, 2008, 06:25:26 pm
I found a good list by searching for "Field Substitution Macros" in EA's Help Contents, and then selected the topic that displayed named "Field Substitution Macros."   I think you will find your alias in that list.

Rollie
Title: Re: Need to add to Notes during transformation
Post by: Eve on December 08, 2008, 08:01:32 am
You can't directly access properties from a different element in the templates.  (Except for direct information about elements at the end of a connector.)

The only way to do this, is to write an add-in and call EXEC_ADD_IN to get your add-in to find any information you want.