Book a Demo

Author Topic: Moving a package to a different parent  (Read 4310 times)

Knut Paulsen

  • EA User
  • **
  • Posts: 82
  • Karma: +1/-0
    • View Profile
Moving a package to a different parent
« on: September 27, 2014, 12:36:39 am »
Guys,
I'm kind of stuck on a friday afternoon. Maybe that is why I am stuck :-)

Anyway, I want to move a package containing lots of subpackages and elements and stuff from package A to package B. Is there a way to that via the API? Or is it only the hard way?

br
Knut

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Moving a package to a different parent
« Reply #1 on: September 27, 2014, 01:22:15 am »
Quite easy. Just change the ParentID of the package to where you want it to be moved.

q.

Knut Paulsen

  • EA User
  • **
  • Posts: 82
  • Karma: +1/-0
    • View Profile
Re: Moving a package to a different parent
« Reply #2 on: September 28, 2014, 05:46:00 pm »
Of course :-)

Thanks, worked like a dream.

Note to future implementers of the same: Do NOT forget to call update on the element/folder that changes parent. It cost me a few hours of extra debugging ...

br
Knut

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Moving a package to a different parent
« Reply #3 on: September 29, 2014, 03:58:11 pm »
Update() actually means "save"

In general, whatever changes you make to API object remain in memory until you call update(), which saves the changes to the database.

Of course there are exceptions. Deleting elements from an EA.Collection usually does the reverse. It only deletes it from the database, but not from the object in memory ::)

To quote Paolo: "Consistency Konsystency Consistenci"

Geert