Book a Demo

Author Topic: automatic XMI export  (Read 11827 times)

ngong

  • EA User
  • **
  • Posts: 275
  • Karma: +2/-2
    • View Profile
automatic XMI export
« on: August 01, 2018, 05:05:53 pm »
Do you know a way to automatically export an EA model to its XMI representation?

I was able to identify only procedures which need manual interaction. What I am looking for is a command line in a Win batch file that I can start on a regular basis.

Rolf

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: automatic XMI export
« Reply #1 on: August 01, 2018, 05:10:27 pm »

ngong

  • EA User
  • **
  • Posts: 275
  • Karma: +2/-2
    • View Profile
Re: automatic XMI export
« Reply #2 on: October 13, 2021, 04:33:31 am »
Thank you, Geert - that works:
Code: [Select]
!INC Local Scripts.EAConstants-JScript

function OnProjectBrowserScript()
{
// Get the type of element selected in the Project Browser
var thePackage as EA.Package;
thePackage = Repository.GetTreeSelectedPackage();
theProject = Repository.GetProjectInterface();
theProject.ExportPackageXMI(thePackage.PackageGUID,22,0,-1,0,0,"C:\\Temp\\my.xmi");
}

OnProjectBrowserScript();

Now the next question is: how can I start EA from a batch file - e.g. called from Jenkins - for a certain model and running that script unattended?
Rolf

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: automatic XMI export
« Reply #3 on: October 13, 2021, 08:01:00 am »
Running from Jenkins, though technically possible is a licensing issue.

See https://www.sparxsystems.com/products/ea/eula.html section 6 for the "server" limitations.

My summary, if everyone who will be triggering that action has their own fixed (not floating) EA license you're probably okay.

Technically, the solution just requires you to convert so that it creates the repository instance and opens a project. There are examples for several outdated languages here.

ngong

  • EA User
  • **
  • Posts: 275
  • Karma: +2/-2
    • View Profile
Re: automatic XMI export
« Reply #4 on: October 14, 2021, 01:35:08 am »
Thank you, Eve, for pointing me to the license issue. It would mean - and I see no problem about it - (let me repeat in my words:) that for Jenkins as a user we buy a personal license.

For my technical question: It would be better to use Repository.GetProjectInterface() from an EA-external program which is Connect to the Interface, rather than trying to start EA in a way executing an internal script.
Rolf

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: automatic XMI export
« Reply #5 on: October 15, 2021, 08:17:07 am »
(let me repeat in my words:) that for Jenkins as a user we buy a personal license.
Very much no. "Every end user MUST have a genuine Enterprise Architect license of the correct edition;"

For my technical question: It would be better to use Repository.GetProjectInterface() from an EA-external program which is Connect to the Interface, rather than trying to start EA in a way executing an internal script.
I think you mean GetObject.("EA.App").Repository.

Either way works. Connecting to an already open EA will be a bit faster, but it also runs the risk of EA using out of date information. You probably also need to handle there not already being a running instance of EA, which would mean writing the create instance and load project code anyway.

ngong

  • EA User
  • **
  • Posts: 275
  • Karma: +2/-2
    • View Profile
Re: automatic XMI export
« Reply #6 on: November 06, 2021, 04:13:31 pm »
"very much no": Eve, I am a bit lost with the license issue: if Jenkins runs every night and exports an xmi, who is the "user" that needs a license (I may replace "Jenkins" by "the operator responsible for Jenkins maintenance").
Rolf

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: automatic XMI export
« Reply #7 on: November 08, 2021, 08:38:12 am »
Jenkins can (and often does) have triggers besides a simple scheduled task.

If the only trigger is a fixed schedule you may be okay with a single license.