Book a Demo

Author Topic: How-to access class information through connector  (Read 5262 times)

hauptmann_501

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
How-to access class information through connector
« on: September 09, 2007, 08:17:06 am »
Hi,

I'm quite n00b at EA template scripting so this could be an easy one to answer.

Let's say I have a class named "ClassParent"  with three others classes (ClassChild1, ClassChild2 & ChildClass3) each one being associated with ClassParent through three separated dependency connectors named "isRelatedTo1" through "isRelatedTo3".  

Each connector has the unique ClassParent as the source and its respective ClassChild as a target.  The connector is stereotyped with a custom dependency stereotype called "family".

So far so good ?  Ok I wish to generate the list of classNames of all related childs having the stereotype "family" for ClassParent.

thanks for your help !


lgozalvez

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How-to access class information through connec
« Reply #1 on: September 13, 2007, 02:07:15 am »
I have the same problem...

%TRANSFORM_REFERENCE("Table",connectorSourceElemGUID)%
%TRANSFORM_CURRENT()%

This code in DDL Connector template show the attributes for the connector and I need the class (connectorSourceElemGUID) attributes.



Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How-to access class information through connec
« Reply #2 on: September 13, 2007, 01:16:58 pm »
Create this as a custom template.

Template Connector__DestName
Code: [Select]
%connectorDestElemName%
Then call a list that looks like this.

Code: [Select]
%list="Connector__DestName" @separator="\n" @indent="" connectorStereotype=="family"%
« Last Edit: September 13, 2007, 01:17:49 pm by simonm »

hauptmann_501

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How-to access class information through connec
« Reply #3 on: September 13, 2007, 02:42:48 pm »
Hi,

Thanks It's worked.

But I'm still puzzled WHERE are you taking all those commands likes the one you gave me (aka %connectorDestElemName%) ?  The help file returned nothing, nor the user guide about it.  

Thanks again for the answer :-) (please tell me your source for these "arcane" macros, this will help me a lot :-) )

Cheers !

Jack

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How-to access class information through connec
« Reply #4 on: September 13, 2007, 03:52:44 pm »
That particular macro came from http://www.sparxsystems.com/EAUserGuide/index.html?fieldsubstitutionmacros.htm with the line

connectorDestElem*   For any class substitution macro that is supported, get the same information about the element at the target end of the connector.  Also try searching for code template syntax.


hauptmann_501

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How-to access class information through connec
« Reply #5 on: September 13, 2007, 04:24:01 pm »
Ahhh ! :-)  That's the meaning of the "*" at the end of it. I scanned the list countless time but I didn't catch the * token meaning at first.

I should go get some sleep... :-)

cheers,

Jack

MarnixAlsemgeest

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: How-to access class information through connec
« Reply #6 on: September 18, 2007, 04:08:49 am »
I try to implement the solution provided by simonm
however I need this part in a code generation template i'm creating.
can the
%list="Connector__DestName" @separator="\n" @indent="" connectorStereotype=="family"%  
then be called from a class template or any other template which is available through code generation? It doesn't seem to work in my case. What I whould like is somehow from the linkedAttribute template, which is triggered, get the target column. I can get the target table but not the target column.... thanks in advance




Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How-to access class information through connec
« Reply #7 on: September 18, 2007, 01:05:20 pm »
You can't currently get information about attributes/columns/operations of the target(or opposite end from current) object of a connector without using an addin and EXEC_ADD_IN.