Book a Demo

Author Topic: Import XMI through API and creating model package  (Read 2897 times)

Sébastien Jahan

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Import XMI through API and creating model package
« on: December 13, 2011, 09:43:52 pm »
Hi,

Here is my case: I'm using the importXMIPackage() method to import in my project some XMI.
The target package I pass in parameter to the function is the default model package of the project (created with an empty project).
If i import through Sparx EA, (right click on the model package, import XMI, etc.), i get a popup that asks me if i want to create another model package.
The problem is that i do not have this feature when i import the XMI using the importXMIPackage(), and my XMI's model package is imported under the default model package.

Is there a way to create a model package through the importXMIPackage() function? I assume there should be some way to pass to the function a node "above the model package" but i don't know how to do it.

Thank you very much by advance,

SJ.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Import XMI through API and creating model pack
« Reply #1 on: December 14, 2011, 03:51:57 am »
You can try a hack: change the guid of the root package in the empty repository to that of the root package in the XMI (use repository.execute). When you import after the change the model is placed on root level.

q.