Book a Demo

Author Topic: Creating trace relations with API broken in v15.1  (Read 3807 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Creating trace relations with API broken in v15.1
« on: May 13, 2020, 04:09:51 pm »
I have a script that creates traces between use cases and classes.
The code to create this specific trace is

Code: [Select]
function linkElementsWithAutomaticTrace(sourceElement, targetID)
dim trace as EA.Connector
set trace = sourceElement.Connectors.AddNew("","trace")
trace.Alias = "automatic"
trace.SupplierID = targetID
trace.Update
end function

In version 12.1 this creates a connector with ConnectorType "Abstraction" and stereotype "trace"
In version 15.1 this same code creates a connector with ConnectorType "Dependency" and stereotype "trace".

Manual creation of a trace relation creates connector of type "Abstraction" and stereotype "trace"

Conclusion: creating the connector via the API is broken in v15.1

Reported

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Creating trace relations with API broken in v15.1
« Reply #1 on: May 13, 2020, 05:24:25 pm »
What I suspect is happening is that a new technology is included in 15.1 that defines a "trace" metatype extending dependency instead of abstraction. I suspect you'll see the difference in stereotype if you look at the properties in 15.1.

If you manually create a Trace relationship in EA you are always doing it with a qualified name. Your code is just saying give me any trace metatype. This is exactly why I say that you absolutely need to always use a qualified name.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating trace relations with API broken in v15.1
« Reply #2 on: May 13, 2020, 05:29:25 pm »
I thought about that, but that doesn't seem to be the case.

- in EA the stereotype reads EAUML::trace
- I changed the code to do set trace = sourceElement.Connectors.AddNew("","EAUML::trace") but that didn't help either. Still Dependencies instead of Abstractions.

Then I changed the code to simply create the Abstraction and set the stereotype myself like this:

Code: [Select]
function linkElementsWithAutomaticTrace(sourceElement, targetID)
dim trace as EA.Connector
set trace = sourceElement.Connectors.AddNew("","Abstraction")
trace.StereotypeEx = "EAUML::trace"
trace.Alias = "automatic"
trace.SupplierID = targetID
trace.Update
end function

This produces the same trace connector as the ones created manually.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Creating trace relations with API broken in v15.1
« Reply #3 on: May 13, 2020, 09:28:10 pm »
I have this same effect in V13.5 applying a <<trace>> from the default dialog. It creates <<abstraction>> instead. When doing it in V15 it's working correct. Strange, isn't it?

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Creating trace relations with API broken in v15.1
« Reply #4 on: July 13, 2020, 09:47:30 pm »
I figured it in 13.5. When you disable the Core Extensions MDG a trace will be created as «abstraction». A bug for sure. But as long as you know how to bypass it...

q.