Author Topic: Exchange element between two EA models  (Read 2811 times)

ahafez

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Exchange element between two EA models
« on: September 02, 2016, 07:36:01 pm »
Is there an API to export/copy an element (e.g. Interface, Class, ..etc.) from an EA model to a different EA model using the same GUID?

Knowing that I don't need to export/copy the parent package that contains this element.

qwerty

  • EA Guru
  • *****
  • Posts: 9832
  • Karma: +190/-155
  • I'm no guru at all
    • View Profile
Re: Exchange element between two EA models
« Reply #1 on: September 02, 2016, 08:44:35 pm »
No direct way. You "could" do it this way:
- create a dummy package
- move the element in question to that
- export the package to XMI (look into the ProjectInterface)
- move the element back
- open the other EAP
- import the XMI

q.

ahafez

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Exchange element between two EA models
« Reply #2 on: September 03, 2016, 01:02:53 am »
Which api that could move element from package to another?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +211/-26
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Exchange element between two EA models
« Reply #3 on: September 03, 2016, 01:22:30 am »
simply change the PackageID of the element and then update the element.

Geert

ahafez

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Exchange element between two EA models
« Reply #4 on: September 03, 2016, 03:46:36 am »
Hi Geert,

Many thanks, it works, but with every change I receive a popup message box as following:
---------------------------
Enterprise Architect
---------------------------
Warning: Underlying model data may have been modified by another user.

Press OK to refresh.
---------------------------
OK   
---------------------------

Is there is a way to suppress this message box?

Thanks,
---
Ahmed

ahafez

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Exchange element between two EA models
« Reply #5 on: September 03, 2016, 04:00:25 am »
Hi,

I have resolved this popup message using Repository.RefreshModelView() API after each update.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1274
  • Karma: +93/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Exchange element between two EA models
« Reply #6 on: September 05, 2016, 05:39:20 pm »
Hello Ahafez,

The reason you're getting that popup is that the EA client detects that its display is out of sync with the data in the model database. This often happens when you're making changes using the API.

RefreshModelView() refreshes the display and thus solves the problem.

/Uffe
My theories are always correct, just apply them to the right reality.