Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: LNS_Software on September 21, 2004, 01:17:56 pm

Title: Code Generation of Linked Attributes
Post by: LNS_Software on September 21, 2004, 01:17:56 pm
I am trying to determine how to get the stereotype of a linked attribute.  I am developing a model that also includes hooks for future capabilities.  I have stereotyped the class and association as "future".

I've updated the template for the class to:
  %if classStereotype == "future"%
  %endTemplate%

But cannot seem to find the stereotype for a linked attribute.  

Also, how does a Linked Attribute template start?  According to the class body, it uses a %list to include the attributes, but in attributes there is no hook to Linked Attributes.

Any ideas?
Title: Re: Code Generation of Linked Attributes
Post by: Eve on September 21, 2004, 04:13:44 pm
Hi,

Currently there is no way to get a link stereotype.  The list of possible substitution macros is available in the help.

http://www.sparxsystems.com.au/EAUserGuide/fieldsubstitutionmacros.htm

Also in the help is this.

Quote
There are some special cases to consider when using the list macro:
 ยท If the Attribute template is used as an argument to the list macro, this will also generate attributes derived from associations by executing the appropriate LinkedAttribute template


That can be found at http://www.sparxsystems.com.au/EAUserGuide/controlmacros.htm

Hope this helps.

Simon
Title: Re: Code Generation of Linked Attributes
Post by: LNS_Software on September 22, 2004, 02:03:53 pm
I cannot get at the Linked Attributes.  If I try to create a custom template, "Linked Attribute" does not appear.

If I say:
%list="Attribute__ListAttributes" @separator="\n\n" @indent="\t"%

I only get the attributes, I don't get the linked attributes.

(I'm hoping it doesn't come down to having to build one of those unsupported ADD-IN's).
Title: Re: Code Generation of Linked Attributes
Post by: Eve on September 22, 2004, 07:19:38 pm
Well, you do have a bit of a problem there... At the moment you can't create a custom template for linked attributes, and executing a custom template for attributes does not and is not intended to also execute linked attributes.

I do have some good news for you though...

There is actually a way to get In response to this I have included the ability to get the stereotype of a linked attribute.   The substitution macro %linkStereotype% hasn't been documented but does work.   :-[

The other thing is that I've added the ability to create a custom template for linked attributes that you should get in build 738.

I'll also try to complete (I think) the options for that by adding ability to create custom templates for "ClassBase", "ClassInterface" and "ClassParameter"

Simon
Title: Re: Code Generation of Linked Attributes
Post by: LNS_Software on September 22, 2004, 08:12:19 pm
While you're at it, can you add a couple of things that can be referenced in a linked attribute.  
Thanks.