Book a Demo

Author Topic: XMI export specific elements with dependencies  (Read 3508 times)

mtamme

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
XMI export specific elements with dependencies
« on: March 03, 2015, 08:10:00 pm »
Hi,

I would like to merge specific packages / elements from a project into a new project and export the new project as a XMI file within an EA AddIn.

The reason is that the current XMI export functionality in EA is only exporting package-wise without considering dependencies to elements within other packages outside the package-export hierarchy.

For this task I would like to use the DoBaselineMerge, since exporting all dependent packages to separate XMI files and reimporting them into a new project works, but is very slow.
I've already tried the merge within the EA UI and it looked very promising from the performance perspective.

What I did so far:

1) I am collecting all element dependencies (recursively) from a diagram.
2) I collect the full package / element hierarchy (up to the root / model package) for the previously collected elements.
3) I am currently creating a new target repository within the AddIn (I am not sure if this is the best way to open a new / empty project, since the new target repository is of-cause running in a separate EA instance).
4) I copying the PackageGuid and Name from the original model package to the new / empty model package within the newly created repository.
5) I create a baseline within the original project.
6) I retrieve the previously created baseline GUID from the original project.
7) I construct the merge instructions based on the collected elements and packages from step 1).
8) Now I would like to do a DoBaslineMerge with:
newProject.DoBaselineMerge(xmlPackageGuid, baseline, merge, repository.ConnectionString)

In step 8) I always get the merge result "No Differences detected" no matter what i try for the merge instructions. I also tried "RestoreAll" for the guid. For me it currently seems that the API cannot find the baseline within the project I provided as  connection-string.

Can someone help me please and maybe provide me a sample code where two projects are involved during a merging procedure.

I am also open to other suggestions which help me to full my goal for exporting all elements within a diagram including the dependencies. The package hierarchy should be the same as the original model but only the necessary (dependent) elements should be included.

Thank you upfront!