Author Topic: Redefine connector stereotypes  (Read 5238 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13202
  • Karma: +549/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Redefine connector stereotypes
« on: March 03, 2022, 12:13:12 am »
I've been using the <<redefines>> mechanism for a while now to add tagged values to existing ArchiMate 3 stereotypes without interupting the users too much.
Everything looks the same on the surface, but my redefined stereotype is being used instead of the standard ArchiMate stereotype.

This works just fine for elements. Today I got a request to add a tagged value to a number of ArchiMate relations, so I did exactly the same.

I added my redefined stereotypes to the profile and expected it to work; but it didn't.
https://imgur.com/a/Amiv75f


When adding an ArchiMate_Serving relation for example, I get a vanilla ArchiMate_Serving, and not my redefined one.

When comparing the resulting UML profile XML I can't see any differences between the element redefine, and the connector redefine.
the one for ArchiMate_Serving that doesn't work:
Code: [Select]
<Stereotype name="ArchiMate_Serving" notes="" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0" generalizes="ArchiMate3::ArchiMate_Serving" baseStereotypes="ArchiMate3::ArchiMate_Serving" redefines="ArchiMate3::ArchiMate_Serving">
<TaggedValues>
<Tag name="Lifecycle" type="enumeration" description="" unit="" values="TBD,Planned,Phase In,Live,Phase Out,End of Life" default="TBD"/>
</TaggedValues>
</Stereotype>
The one for ArchiMate Node that does work:

Code: [Select]
<Stereotype name="ArchiMate_Node" notes="" bgcolor="12648384" fontcolor="-1" bordercolor="-1" borderwidth="1" hideicon="0" generalizes="ArchiMate3::ArchiMate_Node" baseStereotypes="ArchiMate3::ArchiMate_Node" redefines="ArchiMate3::ArchiMate_Node">
<TaggedValues>
<Tag name="Lifecycle" type="enumeration" description="" unit="" values="TBD,Planned,Phase In,Live,Phase Out,End of Life" default="TBD"/>
</TaggedValues>
</Stereotype>

Has anyone successfully redefined a connector stereotype before? Any secret magical sauce I'm missing?

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13202
  • Karma: +549/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Redefine connector stereotypes
« Reply #1 on: March 03, 2022, 01:03:45 am »
For now I have solved it with an EA-Matic script, but I would prefer to get rid of this workaround:

Code: [Select]
'[path=\Projects\EA-Matic Scripts]
'[group=EA-Matic]

!INC Local Scripts.EAConstants-VBScript

'
' Script Name: Redefine Archimate Connectors
' Author: Geert Bellekens
' Purpose: update archimate stereotypes to the stereotype as defined in the Architecture profile
' Date: 2022-03-02
'
'EA-Matic


const archiMateProfileName = "ArchiMate3::"
const archiTectureProfileName = "Architecture::"

dim stereotypesToRedefine
set stereotypesToRedefine = CreateObject("Scripting.Dictionary")

stereotypesToRedefine.Add archiMateProfileName & "ArchiMate_Serving", archiTectureProfileName & "ArchiMate_Serving"
stereotypesToRedefine.Add archiMateProfileName & "ArchiMate_Association", archiTectureProfileName & "ArchiMate_Association"
stereotypesToRedefine.Add archiMateProfileName & "ArchiMate_Triggering", archiTectureProfileName & "ArchiMate_Triggering"
stereotypesToRedefine.Add archiMateProfileName & "ArchiMate_Flow", archiTectureProfileName & "ArchiMate_Flow"
stereotypesToRedefine.Add archiMateProfileName & "ArchiMate_Access", archiTectureProfileName & "ArchiMate_Access"
stereotypesToRedefine.Add archiMateProfileName & "ArchiMate_Assignment", archiTectureProfileName & "ArchiMate_Assignment"
stereotypesToRedefine.Add archiMateProfileName & "ArchiMate_Realization", archiTectureProfileName & "ArchiMate_Realization"


'the event called by EA
function EA_OnPostNewConnector(Info)
'get the connector id from the Info
dim connectorID
connectorID = Info.Get("ConnectorID")
dim connector as EA.Connector
set connector = Repository.GetConnectorByID(connectorID)
'replace stereotype
if stereotypesToRedefine.Exists(connector.FQStereotype) then
connector.StereotypeEx = stereotypesToRedefine(connector.FQStereotype)
connector.Update
end if
end function

Geert

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1300
  • Karma: +120/-10
  • Its the results that count
    • View Profile
Re: Redefine connector stereotypes
« Reply #2 on: March 03, 2022, 08:11:32 pm »
I've managed to redefine archimate connector stereotypes by pretty much doing it the same way you have described except I've used a different name. For example when redefining ArchiMate_Serving the new stereotype is simply called Serving. Seems to work fine for me.
Happy to help
:)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13202
  • Karma: +549/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Redefine connector stereotypes
« Reply #3 on: March 03, 2022, 11:34:36 pm »
If you use a different name, you have a simple extension, not a redefinition.

The redefines, automatically replaces all elements of the base stereotype by my version of the stereotype.
This works for elements, but not for connectors.

Geert

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1300
  • Karma: +120/-10
  • Its the results that count
    • View Profile
Re: Redefine connector stereotypes
« Reply #4 on: March 04, 2022, 04:26:38 am »
Ah right I see what you mean. That's a good approach to what sounds like the same problem i was dealing with of adding things to archimate. I like the elegance of your aproach as it sounds like less work. How to you get sparx EA to add the extras to existing elements? Do you use synch? Presumably once you've activated the MDG and use Archimate toolbox elements the extra things are added upon creation.
By renaming the stereotype I had to write a script to change the stereotypes to any thing that had originally done in archimate. Changing the name lead to having to create new diagram types to host the toolboxes with the new stereotype names so I could create the extended archimate elements. Be are a bit of a pain to do. Then when the archmate wizards were added for the different viewpoints I missed out.
It's a shame about the connectors not working the same as elements. Guess you could raise as a bug but that will take a while.
Happy to help
:)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13202
  • Karma: +549/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Redefine connector stereotypes
« Reply #5 on: March 04, 2022, 05:32:24 am »
After redefining (and setting your MDG as active) EA will create YourProfile::ArchiMate_ApplicationComponent instead of ArchiMate3::ArchiMate_ApplicationComponent
So no need to create new toolboxes, or deal with quicklinkers that reference the original ArchiMate stereotypes.

This only works for new things, so I still need a small script to convert existing elements to the new profile.

I guess I'll have to report it as a bug. I was really hoping someone was going to tell me "ah, but you forgot to muff the mojo to jux the spif". :-\

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Redefine connector stereotypes
« Reply #6 on: March 04, 2022, 06:48:18 am »
Oh, you didn't do that? I thought without EA would not work at all?

q.

David Rains (bioform)

  • EA User
  • **
  • Posts: 84
  • Karma: +0/-0
    • View Profile
Re: Redefine connector stereotypes
« Reply #7 on: March 08, 2023, 05:18:31 am »
"muff the mojo to jux the spif" - is this going to change now that JavaScript is the default?

Yeah, I'm Back

Greg_PL

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Redefine connector stereotypes
« Reply #8 on: August 24, 2024, 12:23:50 am »
Hey Geert et. al.

Has anybody (including Sparx support) solved that issue? Is there any way to redefine a connector without scripting?...

Cheers,
Greg


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13202
  • Karma: +549/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Redefine connector stereotypes
« Reply #9 on: August 24, 2024, 06:49:27 am »
They confirmed it was a bug and logged to be fixed.

You just never know when. It might be tomorrow, it might be in 10 years...

Geert