Book a Demo

Author Topic: How to use "string Project.ImportPackageXMI( )"?  (Read 5656 times)

André Olivera

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
How to use "string Project.ImportPackageXMI( )"?
« on: February 25, 2011, 08:39:15 pm »
Somebody has used this function?

I would like to import a previously exported package to my model.

After I use this function, what I have to do to get the imported package control?
(The imported package only appears in the collection when I go out of my function. I tried to use ParentPackage.Update();          Repository.RefreshModelView(ParentPackage.PackageID); and            Repository.RefreshOpenDiagrams(true);

What this function returns?

Thanks

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to use "string Project.ImportPackageXMI( )
« Reply #1 on: February 25, 2011, 09:06:26 pm »
This function just imports the XMI and does not put it under version control (if that is what you want?).

q.

André Olivera

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: How to use "string Project.ImportPackageXMI( )
« Reply #2 on: February 25, 2011, 09:14:39 pm »
I was forgetting the ParentPackage.Packages.Refresh() now it works..

But I still don't know how I take the control of the package imported..

I am thinking in get the package with the higher PackageID but It seems a ugly solution..

André Olivera

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: How to use "string Project.ImportPackageXMI( )
« Reply #3 on: February 25, 2011, 09:19:18 pm »
I am new in the Enterprise Architect, I don't know what is and who Version Control works =/

but thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to use "string Project.ImportPackageXMI( )
« Reply #4 on: February 25, 2011, 11:14:42 pm »
The idea with the highest packageID won't work if the package is overwritten.
The thing is, that the XMI could contain multiple packages, so each package of the Packages collection is possibly affected by the import.

The return value of that function doesn't seem to be documented. Have you tried it so see what it returns?

Geert

André Olivera

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: How to use "string Project.ImportPackageXMI( )
« Reply #5 on: March 01, 2011, 08:47:55 pm »
Hi Geert..

About the package will be overwritten.. I may be talking nonsense but.. I couldn't avoid the overwritten with the last parameter of the function:

"StripGUID: Long - boolean value to indicate whether to replace the element UniqueIDs on import; if stripped, then a package could be imported twice into Enterprise Architect, as two different versions."

The fact that XMI contain multiple packages I think that I can avoid with some validation, I don't know..

I just tried print the return value of the function in a MessageBox but nothing was printed..

Maybe the string would be a XML file and would be too big for a MessageBox..

I still have hope that exists another way to do this!