Book a Demo

Author Topic: connectorType Macro  (Read 3503 times)

avr

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
connectorType Macro
« on: August 12, 2005, 08:04:06 am »
Hello

An other question, i hope someone could help. :)

I'm trying to handle associated class in DDL transformation template. What is the conectorType string for association class ?
If i write a transformation template with the folowing code, my association class's connectors are not recognized :

Code: [Select]

%if connectorType == "Association Class"%
...
%endIf%


An other question, how can i identify the associated class (the associated class GUID) from a connector of type "Association Class"  ?

thanks

--
Fred

thomaskilian

  • Guest
Re: connectorType Macro
« Reply #1 on: August 12, 2005, 01:13:19 pm »
Hmm. Just a guess: connectors don't differ in the way they are used. Actually it's an interesting question how  Association Classes are represented in EA. I guess (!) that the Class has a property which identifies itself as Association Class and also it has two associations to other classes. You cold examine the database to find it out.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: connectorType Macro
« Reply #2 on: August 12, 2005, 04:54:59 pm »
Quote
Hmm. Just a guess: connectors don't differ in the way they are used. Actually it's an interesting question how  Association Classes are represented in EA. I guess (!) that the Class has a property which identifies itself as Association Class and also it has two associations to other classes. You cold examine the database to find it out.
From what I can make out, An association Class is a t_object Object_Type=Class with NType=17.
The associated (binary) Association is an t_connector, Connector_type = Association, subtype=Class with PDATA1 giving the t_object key of the associated Class.

However, this is restrictive since it can't handle Association Classes for N-Ary Associations.

To make an N-ary Association you need an Association "lozenge" (t_object Object_Type=Association) but then you have no means (even under UML - let alone EA) to attach an Association Class to it...

See my ramblings on N-ary associations for some alternate approaches....

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

avr

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: connectorType Macro
« Reply #3 on: August 16, 2005, 12:51:39 am »
May be EA people can help us. I'll send a request to support.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: connectorType Macro
« Reply #4 on: August 16, 2005, 04:10:57 pm »
Paolo is correct about how an association class and the association are represented in EA.  (However, an object also has the ID of the connector in its PDATA4 field.)

Currently the information is not directly available from the code/transformation templates.  Until we add some new substitution macros to get the information you can create an addin to the job.

You would have a function in your addin like the following (VB Code).  (I copied this from another example I have around, and haven't tested it.  So apologies if it doesn't work properly.)

Code: [Select]
Function GetConnectorSubType(Repository As EA.Repository, Args As Variant) As String
   Dim guid As String
   guid = Args(LBound(Args))
   Dim Con As EA.Connector
   Set Con = Repository.GetConnectorByGuid(guid)
   
   GetConnectorSubType = Con.SubType
   
End Function

You would then add the following to your template.

Code: [Select]
$subType = %EXEC_ADD_IN("MyAddin","GetConnectorSubType",connectorGUID)%
%if connectorType=="Association" and $subType == "Class"%
...
%endIf%

Hope that helps.

Simon