Book a Demo

Author Topic: Exposed interface and transformation templates.  (Read 4041 times)

Thomas_Arnbjerg

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Exposed interface and transformation templates.
« on: August 16, 2007, 05:32:43 am »
A newbie question on transformation templates:

I'm playing a bit with transformation templates and would like to generate an interface (class) based on an exposed interface attached to a component in a component diagram.

The class should be placed in a generated package named after the component. Unfortunately I haven't been able to find any property for the interface, which reveals which component the interface is attached to. Therefore I can't put the interface into the proper package in the transformation template.

Does anyone know, which attribute to use in this scenario?
- and does anyone know of some good sites with examples on custom transformations (in addition to the ones provided by Sparx Systems)?



«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Exposed interface and transformation templates
« Reply #1 on: August 16, 2007, 05:38:09 am »
Quote
...and does anyone know of some good sites with examples on custom transformations (in addition to the ones provided by Sparx Systems)?

Try the EA Wiki and EA User Group, in that order. Open the top thread in the Automation section. (It is pinned, so is always at the top.)

Read the first post. At the top you'll find the address of the User Group. At the bottom - look way down, at the signature line - you will find directions to the Wiki.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Exposed interface and transformation templates
« Reply #2 on: August 16, 2007, 01:16:30 pm »
I don't have example code, but you can do what you want by creating a package out of the component, then inside that list over all inner classes (which equates to all elements nested in the component).  Create the class out of your exposed interface.  The result should look something like the following.

Code: [Select]
Package
{
 name="MyComponent"
 Class
 {
   name="MyExposedInterface"
 }
}

Thomas_Arnbjerg

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Exposed interface and transformation templates
« Reply #3 on: August 16, 2007, 08:51:10 pm »
Thank's for the answers. I'll look into the Wiki site and user group.

Regarding the package creation the example exactly illustrates my problem: Which attribute (if any) allows me to obtain the component name to assign to the package (i.e. "MyComponent")?. I can only find the attribute with the interface name (i.e. %className%)?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Exposed interface and transformation templates
« Reply #4 on: August 19, 2007, 12:58:45 pm »
Let me give you a more concrete example about how this works.  Your class template will look something like this.

Code: [Select]
%if elemType=="Component"%
Package
{
 name=%qt%%className%qt%
%list="InnerClass" @separator="\n" @indent="  "%
}
%else%
Class
{
 name=%qt%%className%qt%
}
%endIf

Thomas_Arnbjerg

  • EA User
  • **
  • Posts: 80
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Exposed interface and transformation templates
« Reply #5 on: August 20, 2007, 01:26:19 am »
Thank you. It works perfectly!