Extract imported library as project

Please use this forum for open discussions about Bouml.
Merci d'utiliser ce forum pour des discussions ouvertes à propos de Bouml.

Extract imported library as project

Postby fbernoldi » Fri 25 Aug 2017 13:34

Hello,

I have used the import project as library on let's say project "A" to import project "B"; then time passed and I lost the original project "B". Is there a way to re-create project B from A's imported library to make modifications and then update the imported library on A from recreated project B?

Thanks in advance.
Federico.
fbernoldi
 
Posts: 33
Joined: Mon 10 Jul 2017 13:15

Re: Extract imported library as project

Postby Bruno Pagès » Fri 25 Aug 2017 15:51

Hello,

Each element as an own identifier, this allows to reference them in other elements

When you import a project B into a project A obviously there are collusions of B identifiers already present in A, so the imported elements identifiers are modified.

When it is a "import from library" rather than a "simple import", the original identifiers are not lost to allow later updates, if you look into the importing project files you have the couples "oid <id>" attached to the imported elements and corresponding to the initial identifiers in A. So it must be possible to do the reverse process, even this is not simple !

The first steps must be to have the project B with wrong identifiers :
  • load A
  • do a save-as into B
  • if needed move the package B whose was created by the import to place it at first level
  • remove all except the package B whose was created by the import
  • save (project B) then go out
  • delete all useless files coming from A into project B directory (warning doing that)

Now you have to replace the identifiers without forbidden to modify the references to them and to rename the files as well (http://www.bouml.fr/doc/index_projectfiles.html), of course the oid couples have to disappear

After that :
  • load B
  • move all direct sub elements of package B (created by the import) into project level
  • remove package B (created by the import)
  • save

Warning, some identifiers can be shared by different kinds of elements, else it is too simple :mrgreen:

Some parts in B like the generation settings are anyway lost, you will have them as they are in A

P.S. if you just remove the "oid <id>" couples rather than to do the substitutions / file renaming you will have a "brother" of original project B but not a "clone" of it, you will not be able to update A after modifying the recreated project B
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 474
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: Extract imported library as project

Postby fbernoldi » Sun 27 Aug 2017 11:05

Hello Bruno,

Thank you! you saved and cursed my life at the same time.

I've started the change and works fine so far by doing all the steps for changing the oid (not removing), and only 8 files differed in their "oid".

Now I'm looking one by one (82 package files) for a total of 6294 oids; so far I've removed 1682 oids of sub-packages information checking that the oid matches the "id" stated on the object before removal, only one was different and checked in that file that it wasn't referenced by other objects, i.e class_ref "id". My mistake was to begin the job without counting the actual amount of oids :D , maybe next time I'll try to write a script for checking differences in oids at least to detect them and manually changing them, and the rest remove them with "grep -v" :lol:

So far so good, about 1h30m so far, maybe another 1-2hs to go, the format is quite strait forward.

This worth the job since it will be (hopefully) complemented by the "roundtrip php" feature :)

Regards,
Federico.
fbernoldi
 
Posts: 33
Joined: Mon 10 Jul 2017 13:15

Re: Extract imported library as project

Postby fbernoldi » Sun 27 Aug 2017 14:15

Note:

Review the package_ref "number" and change if the file referenced if needed.

:)
fbernoldi
 
Posts: 33
Joined: Mon 10 Jul 2017 13:15

Re: Extract imported library as project

Postby Bruno Pagès » Sun 27 Aug 2017 15:33

Identifiers are used to name package file (the name is the package's id) but also diagrams (<number>.diagram, the number is the diagram's id) and bodies of operations (<number>.bodies, the number is the corresponding class's id, [url]not[/url] the operation 's id to limit the number of files for them) c.f. http://www.bouml.fr/doc/index_projectfiles.html

Yes "oid <n>" are alone on their line, so grep -v is a good way :lol:

To check your project under Bouml first do a backup each time before ( :mrgreen: ) and look if a message is written indicating something wrong during the load. Anyway bouml can remove inconsistencies silently. The diagrams and bodies file are not read when you load a project to save time and memory, they are only load when it is necessary, to force bouml to load all easily you can generate code (to open also bodies, generate changing the base directory if you have old generation result to compare the two versions) and generate html documentation (to open all diagrams). After you can of course take a look of the result, but a good way to see if something disappear is to do a save-as and to compare the two projects files (using kompare on the two directories for instance)
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 474
Joined: Mon 20 Feb 2012 08:23
Location: France


Return to Open discussions / Discussions ouvertes

Who is online

Users browsing this forum: No registered users and 0 guests