Author Topic: Package template - update existing elements  (Read 153 times)

Guillaume

  • EA User
  • **
  • Posts: 561
  • Karma: +18/-0
    • View Profile
    • www.umlchannel.com
Package template - update existing elements
« on: January 05, 2018, 06:43:59 pm »
Package templates can be useful to alter the default colours for elements as illustrated here: http://www.umlchannel.com/en/enterprise-architect/item/211-mastering-archimate-alternate-colour-scheme-with-archimate-3.
It works for elements created after the Package Template has been defined.
Is there a way with EA or any available scripts out there to update existing elements default rendering?

Thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com | Automated tests for scripts & addins: www.eatests.com

qwerty

  • EA Guru
  • *****
  • Posts: 9019
  • Karma: +137/-126
  • I'm no guru at all
    • View Profile
Re: Package template - update existing elements
« Reply #1 on: January 05, 2018, 08:44:23 pm »
There is no link between elements and template. The latter is a blueprint used at a certain unknown time. You never know whether an element was created using that blueprint or changed arbitrarily. You could write something that alters the template and all elements that have the current appearance of the template.

q.

Guillaume

  • EA User
  • **
  • Posts: 561
  • Karma: +18/-0
    • View Profile
    • www.umlchannel.com
Re: Package template - update existing elements
« Reply #2 on: January 05, 2018, 11:44:17 pm »
Having looked at EA behaviour, I found out that when you enable the Package Template, EA applies the style on the element's associated diagram objects (backgrnd, font, etc.)
However it only works with elements that were created after enabling the Package Template so I can't figure out how EA differentiates elements that can be rendered according to the template (new elements) from the old ones.

I looked at the t_object content and there's nothing different between a new and an old element. I suspect EA stores something hidden somewhere, though I didn't find anything in the t_xref.
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com | Automated tests for scripts & addins: www.eatests.com

qwerty

  • EA Guru
  • *****
  • Posts: 9019
  • Karma: +137/-126
  • I'm no guru at all
    • View Profile
Re: Package template - update existing elements
« Reply #3 on: January 06, 2018, 12:54:46 am »
It's very simple. If you have a template while an element is created, EA changes it's appearance after creation. Just like one would do it manually. So you can't determine who changed it, the template or a person.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 5902
  • Karma: +71/-80
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Package template - update existing elements
« Reply #4 on: January 08, 2018, 10:46:57 am »
Having looked at EA behaviour, I found out that when you enable the Package Template, EA applies the style on the element's associated diagram objects (backgrnd, font, etc.)
However, it only works with elements that were created after enabling the Package Template so I can't figure out how EA differentiates elements that can be rendered according to the template (new elements) from the old ones.

I looked at the t_object content and there's nothing different between a new and an old element. I suspect EA stores something hidden somewhere, though I didn't find anything in the t_xref.
Out of interest, why do you need to know the difference?  We ended up using the Bjelke-Petersen "Duck Principle".  If it quacks like a duck and walks like a duck, it'll get shot like a duck, my word it will!

We treat all elements that look like X as an X and set the Metatype accordingly.  Thereafter they are treated identically.

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

Guillaume

  • EA User
  • **
  • Posts: 561
  • Karma: +18/-0
    • View Profile
    • www.umlchannel.com
Re: Package template - update existing elements
« Reply #5 on: January 09, 2018, 06:49:06 pm »
I wanted to use a package template prior to run a reverse engineering.
I was expecting to have the new colour on the generated classes following the reverse, and I wanted to find a way to apply the package template colours on existing elements from previous reverse engineering runs.

Anyway the template is not picked up by new reverse engineering, so I had to look for an alternative solution.
I found the SetAppearance on EA Elements which fulfils what I was looking for.


« Last Edit: January 09, 2018, 07:12:34 pm by Guillaume »
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com | Automated tests for scripts & addins: www.eatests.com