Book a Demo

Author Topic: ImportPackageXMI question  (Read 4910 times)

Wade Brooks

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
ImportPackageXMI question
« on: March 06, 2015, 03:26:19 am »
I have been able to insert a package with ImportPackageXMI(GUID_of_parent_package, xmi_file_name, 1, 1)           But I also need to be able to overwrite a package.   What do I pass to ImportPackageXMI to cause it to replace a package, or is a different automation interface used?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ImportPackageXMI question
« Reply #1 on: March 06, 2015, 07:09:32 am »
Import always replaces the package. EA deletes the package contents prior to importing the elements from the file.

q.

Wade Brooks

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: ImportPackageXMI question
« Reply #2 on: March 06, 2015, 08:38:49 am »
Your answers have been very helpfull before but I think you may of missed on this one.  :'(

ImportPackageXMI(GUID_of_parent_package, xmi_file_name, 1, 1)

produces a copy in the parent package

ImportPackageXMI(GUID_of_package, xmi_file_name, 1, 0) 

overwrites it.   But thanks for trying :)  But your comment was close enough for me to experiment the right way  :) :) :)
« Last Edit: March 06, 2015, 08:45:34 am by WadeBrooks »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ImportPackageXMI question
« Reply #3 on: March 06, 2015, 10:57:10 am »
Yes and no. The last parameter instructs EA to strip the GUIDs. In that case you will create all new elements in the package. And since the package gets a new GUID it's not found in the list of existing packages. Thus no deletion. But all the elements are created new. Do you want that?

q.

Wade Brooks

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: ImportPackageXMI question
« Reply #4 on: March 06, 2015, 11:50:44 am »
I had code that would import packages that did not exist into the model,   But Because you enter the GUID of the parent package to do that I was confused as to what to pass in to replace an existing package.  So if you give GUID of parent it will insert the package but to replace a package you give the GUID of the package itsself,   and the documentation was very unclear on this.   But thanks again you gave me enough of a hint to fix both cases.   Thanks