Book a Demo

Author Topic: Intermediary l. - how identify class inheritance?  (Read 3868 times)

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Intermediary l. - how identify class inheritance?
« on: May 04, 2010, 09:47:37 pm »
I simply want to find out if a class extends another class. If so I just want to get the name and stereotype of that base class. I want to do that from the "Class" transformation template.

I already tried it with some pieces of the "Connector" macro, in this way I can search for a Generalization element. But I also need to do some action if there is no such element found (root base class), I couldn't find anywhere how to have a return value for a macro (anyway I only can use it with the list command to iterate over all connection elements...). I already thought about adding tagged values to the class to "communicate" between the macros but thats really ugly isn't it... ?  :-?

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Intermediary l. - how identify class inheritan
« Reply #1 on: May 04, 2010, 10:17:24 pm »
hi tom,

i didn't get exactly what you'll need, but if it's just to tell you "there's any base/parent class" you probably could use the %classHasParent% macro. i found that here:
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/fieldsubstitutionmacros.htm

listing the actual basclasses is done with a separate template afaik.

hth
g.

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: Intermediary l. - how identify class inheritan
« Reply #2 on: May 04, 2010, 11:01:33 pm »
Hi Günther,

thanx for the hint. In theory that should work, but only in theory... I just tried it again, if a class has a base class then the macros returns "T". If not, it returns "" (shouldn't it return "F"?). It also returns "" if a class implements an interface, something like... I need to see if that can be used to get around this.

Then I still need to read some basic attributes from the target class. If you click on a class in diagram view you also see some relationship details in the list view. I want to read "Target Stereotype" of a connection, but again here it seems that I have bad luck, there are only 5 destElem connector properties available:

    ...
  • connectorDestElemAlias
  • connectorDestElemAuthor (the most important of all, 110% useful) ::)
  • connectorDestElemGUID
  • connectorDestElemName
  • connectorDestElemType

...
[/list]

The same is available analouge for SourceElems... There is really nothing to get the destElem's stereotype? (I thought everything in EA focuses on stereotypes?)  

I hope there is a possibillity to get the destElemStereotype by going over those GUID. But I absolutely don't know how to navigate to a desired element I have a GUID for.

How to realize something analouge to:
%getElem(elemGUID).classStereotype%

Or any other way to find out which kind of interface(by stereotype!) a class implements?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Intermediary l. - how identify class inheritan
« Reply #3 on: May 05, 2010, 08:53:35 am »
Actually, connectorDestElemStereotype is available.  Anything that is available classWhatever is available as connectorDestElemWhatever.