Book a Demo

Author Topic: Split an EA project with multiple roots to several EA projects  (Read 10469 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Hi,

I'm looking at the most suitable option to transfer a single EA project with multiple project root nodes to multiple EA projects, one for each project root node.
As I want to retain all the information in each project, I want to avoid using XMI export/import e.g. to keep existing images, matrix, etc.
I also need to retain the GUIDs from the source project in the target projects.

I wanted to copy/paste the EAP file with all the content and project roots for each target project. Then cleaning each EAP by deleting all project root nodes except the root node that needs to be kept.
The final stage would involve transferring each EAP file to a target EA DB centralised project.

Since the project is quite large, I takes ages to delete unwanted root nodes. Considering also that I have to delete all the views prior to delete a root node. Even this way crashes at some point EA or generates errors.
I tried running the Repository.Models.DeleteAt method but it crashes EA...

Anyone aware of an easy option to achieve this via a script or other?

Thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Split an EA project with multiple roots to several EA projects
« Reply #1 on: June 29, 2016, 01:44:31 am »
At any decent size of a model you should avoid EAP aka. Mickeysoft Access and use a RDBMS. Else go the XMI path. Create a base EAP with all reference data and copy that. Then use XMI ex-/import.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Split an EA project with multiple roots to several EA projects
« Reply #2 on: June 29, 2016, 04:18:23 am »
I agree, there are no easy solutions when it comes to large models in .eap files.

An alternative could be to transfer the project to a real database (or multiple databases) and then delete the unwanted roots there.

The problem of having to delete all the views individually is pretty easily solved by moving all the view into a single package.
You can't do that with the GUI, but the API doesn't have any problems with that. That could speed up the deletion process.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Split an EA project with multiple roots to several EA projects
« Reply #3 on: June 29, 2016, 09:45:01 am »
When we need to do surgery of such drastic kind, we use SQL to delete (Say, a root node) and then ask EA to fix itself up...

The Integrity Checker checker is your best friend here.

It's fast and you're (pretty much - apart from any potential bugs in the integrity checker, "fingers crossed") guaranteed a viable repository at the end.

Just make sure there are NO errors in the repository before you start pruning and then "Go for it!'

Been doing this for years!  Never had an issue afterwards.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Split an EA project with multiple roots to several EA projects
« Reply #4 on: June 29, 2016, 09:54:09 pm »
Thanks for your replies.
I turned out that exporting/importing MySQL dumps to generate new Databases on the fly was the quickest (20 seconds per DB).
Using the Project Transfert takes way too long (15 mins) - not using EAP files as suggested by qwerty prevented error messages when testing this option.

Once I had my new EA projects on MySQL, I managed to remove all unwanted model roots by running a custom VBScript as suggested by Geert. It checks if the selected package is a model (if thePackage.IsModel = true then...), prompts the user to confirm deleting all packages, and deletes each package using an EA.Collection element.

I didn't find a way to delete the project root from the script so the use has to do this.

Cheers,
Guillaume
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Split an EA project with multiple roots to several EA projects
« Reply #5 on: June 29, 2016, 10:38:18 pm »
Eventually you can delete the root with a SQL (with the usual caveats).

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Split an EA project with multiple roots to several EA projects
« Reply #6 on: June 30, 2016, 05:19:06 pm »
I didn't find a way to delete the project root from the script so the use has to do this.

The root nodes are in the Repository.Models collection. You can delete them from there (not sure about the last one).

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

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Split an EA project with multiple roots to several EA projects
« Reply #7 on: June 30, 2016, 08:07:35 pm »
Thanks Uffe. I confirm that this has solved this final query.

Below is a code sample.

Code: [Select]
''note: thePackage is the selected Model root to delete
Set collection = Repository.Models
i = 0
For each Pkg in collection
if (Pkg .PackageID = thePackage.PackageID) then
collection .Delete(i)
end if
i = i + 1
Next
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Split an EA project with multiple roots to several EA projects
« Reply #8 on: June 30, 2016, 09:19:54 pm »
Not sure about that, but when deleting from collections I rather do that backwards. You never know whether the index is preserved and delete (2) will delete number 2 or 3 since the delete (1) before has shifted the whole collection.

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Split an EA project with multiple roots to several EA projects
« Reply #9 on: June 30, 2016, 09:23:51 pm »
I'm interested in any example on the alternative scripting approach you would recommend.

thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Split an EA project with multiple roots to several EA projects
« Reply #10 on: June 30, 2016, 09:36:14 pm »
My VB skills are very rusted, so I use a meta-language:
Code: [Select]
Set collection = Repository.Models
for i := collection.length; i > 0; i-- {
  if (collection.GetAt(i).PackageID == thePackage.PackageID) { collection.Delete(i) }
}

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Split an EA project with multiple roots to several EA projects
« Reply #11 on: July 01, 2016, 08:41:29 pm »
q raises a good point.

As an alternative, you can loop while the collection's Count > 0 and just Delete(1).
In that case, you must call Refresh() after each delete, or you'll be stuck there for a while. :)

On the whole, I think this is a common enough situation that a DeleteAll() is warranted.

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