Book a Demo

Author Topic: Why I love this job..... AssociationClasses  (Read 5712 times)

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Why I love this job..... AssociationClasses
« on: April 29, 2022, 03:41:32 am »
Hello good People,
After importing a Rational Software Architect UML2 model into EA it came out that all the AssociationClasses are NOT displayed in diagrams. The classes themselves are there (lot of them) but not in the diagram. Now, unfortunately it looks like EA has no trace of the "link" between a AssociationClass and his Association.

the bottom line is that I need to:
1. find the association with the same name as the AssociationClass
2. Find the diagram in which this association is currently displayed
3. show in this diagram the corresponding association class
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Why I love this job..... AssociationClasses
« Reply #1 on: April 29, 2022, 04:20:23 am »
Should be fairly straightforward with a little script.

Geert

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Re: Why I love this job..... AssociationClasses
« Reply #2 on: April 29, 2022, 04:50:30 am »
OK this is what I did:
SQL query
Code: [Select]
SELECT t_connector.Connector_ID, t_connector.Name as link, diagram.Diagram_ID, diagram.Name, diagram.Diagram_Type as CLASSTYPE, diagram.ea_guid AS CLASSGUID
from t_connector
inner join t_diagramlinks link on  link.ConnectorID = t_connector.Connector_ID
Inner join t_diagram diagram on diagram.Diagram_ID = link.DiagramID
where t_connector.Connector_Type='Association'
AND t_connector.SubType='Class'
AND link.Hidden=0

- Double click on a row to open the diagram
- Identify the relationship (name is the query)
- right click on it and select 'Find Association Class'
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Re: Why I love this job..... AssociationClasses
« Reply #3 on: April 29, 2022, 04:53:19 am »
Should be fairly straightforward with a little script.

Geert
not sure if automation supports the "Find Association Class" of an association.....
but the we would have the issue of the layout.....
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Re: Why I love this job..... AssociationClasses
« Reply #4 on: April 29, 2022, 05:44:13 am »
What I still miss is in which table is the relationship between the Class and the association stored  :o
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Why I love this job..... AssociationClasses
« Reply #5 on: April 29, 2022, 06:30:30 am »
Looked up my Inside and found on p. 12:

t_object.PDATA4: For elements: If > 0 this is the primary key of the connector for which this element is defines as association class

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Why I love this job..... AssociationClasses
« Reply #6 on: April 29, 2022, 02:42:15 pm »
The relation is also stored in the connector table, in the field t_connector.PDATA1

You can query the PDATA fields through the property MiscData in the API.

But you don't even need to query the database directly.
You can use EA.Connector.AssociationClass to get/set the AssociationClass of a connector.

Geert

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Re: Why I love this job..... AssociationClasses
« Reply #7 on: April 29, 2022, 11:04:14 pm »
The relation is also stored in the connector table, in the field t_connector.PDATA1

You can query the PDATA fields through the property MiscData in the API.

But you don't even need to query the database directly.
You can use EA.Connector.AssociationClass to get/set the AssociationClass of a connector.

Geert
than you Geert!
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Re: Why I love this job..... AssociationClasses
« Reply #8 on: April 29, 2022, 11:04:54 pm »
Looked up my Inside and found on p. 12:

t_object.PDATA4: For elements: If > 0 this is the primary key of the connector for which this element is defines as association class

q.

I have your book, a great resource!
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Re: Why I love this job..... AssociationClasses
« Reply #9 on: April 30, 2022, 03:01:51 am »
Final version of the query with Geert's suggestion :
Shows all the Association Classes that are NOT displayed in a Diagram

Code: [Select]
SELECT Distinct t_connector.Connector_ID, t_connector.Name as link, t_connector.PDATA1, diagram.Diagram_ID, diagram.Name, diagram.Diagram_Type as CLASSTYPE, diagram.ea_guid AS CLASSGUID
from t_connector
inner join t_diagramlinks link on  link.ConnectorID = t_connector.Connector_ID
inner join t_diagram diagram on diagram.Diagram_ID = link.DiagramID
inner join t_diagramobjects objDia on objDia.Diagram_ID = diagram.Diagram_ID 
where t_connector.Connector_Type='Association'
AND t_connector.SubType='Class'
AND link.Hidden=0
AND  t_connector.PDATA1 NOT IN
(
select distinct t_diagramobjects.Object_ID
FROM t_diagramobjects
where
t_diagramobjects.Diagram_ID = diagram.Diagram_ID 
AND t_diagramobjects.Object_ID=t_connector.PDATA1
)
Order by link ASC
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python