Book a Demo

Author Topic: Retroactively apply Project Templates package  (Read 4181 times)

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Retroactively apply Project Templates package
« on: January 19, 2012, 09:22:32 pm »
Is it possible to retroactively apply a project template package to existing diagrams ? Defined colours etc get picked up on new diagrams, but not existing diagrams - we would like to apply changes to existing diagrams...

Stefan Bolleininger

  • EA User
  • **
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: Retroactively apply Project Templates package
« Reply #1 on: January 20, 2012, 12:00:09 am »
Yes you can make that over the Database in t_diagram and when you know the desired parameters from PDATA, StyleEX and Swimlanes you can apply them by script or other automation.

However be aware you maybe could kill down some arrangements :-/

Best regards,

Sethor
Enterprise Architect in "safetycritical development" like medical device industry. My free Add-in at my Website

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Retroactively apply Project Templates package
« Reply #2 on: February 02, 2012, 10:24:45 pm »
Hi All,

FYI - ended up using the SQL below. It works with some limitations/comments etc:

- change 'Template Package' to be the name of your template package.
- be aware appropriate template style will be applied to each object on your diagram if they currently have a default (ie -1) background colour.
- the complete template style will be applied (not just the background colour) - so your connector style will change to match that used by your templates as will things like lable location/size.
- the zorder will also be changed to match your template
- the SQL works on SQL Server.

Finally use at your own risk...ie try it out on a backed up model.

update t_diagramobjects set ObjectStyle = d1.ObjectStyle, Sequence = d1.Sequence
from t_diagramobjects, t_diagramobjects d1, t_diagram, t_package, t_object, t_object o1
where t_package.Name = 'Template Package'
and t_diagram.Diagram_ID = d1.Diagram_ID
and t_object.Object_ID = d1.Object_ID
and t_package.Package_ID = t_diagram.Package_ID
and t_diagramobjects.Object_ID = o1.Object_ID
and o1.Object_Type = t_object.Object_Type
and o1.Stereotype = t_object.Stereotype
and o1.Backcolor = -1


Regards,

Jon.

Rouven

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
    • View Profile
Re: Retroactively apply Project Templates package
« Reply #3 on: February 21, 2012, 12:28:10 am »
Hi everyone, sorry for somewhat hijacking this, but the thread mentions using Automation/Scripting to run such an UPDATE statement - what is the API command used for this? I could not find a hint in the documentation regarding a command that supports UPDATEs, only SELECT.
Any hint is appreciated!

Thanks!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Retroactively apply Project Templates package
« Reply #4 on: February 21, 2012, 07:00:14 pm »
repos.execute ('sql search')

Undocumented and not official

q.