Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Damir on April 15, 2008, 06:58:38 pm

Title: multiple find & replace in EA
Post by: Damir on April 15, 2008, 06:58:38 pm
Problem: large project, stereotypes used extensively; now we've figured some of those stereotypes should be named differently.
Question: what would be the easiest way to do it in EA?

- I couldn't find anything like multiple find & replace
- changing name of the stereotype in UML types dialog box (Settings/UML... menu) doesn't do the trick (we use version control, and yes, packages were checked out)
- manually going through the whole model ain't my cup of coffie, I hope
- I could try find & replace directly in XML files of the versioned packages, but EA says it is not recommended to change these files outside EA (it could leave the model in an unconsistent state)
- haven't found any scripting/macro capability that would enable to run a script which would do that

any suggestions?
thanks
Title: Re: multiple find & replace in EA
Post by: Oliver F. on April 15, 2008, 09:44:11 pm
Quote
- haven't found any scripting/macro capability that would enable to run a script which would do that

TimeArchitect (http://www.timearchitect.net) has the capabilities of modifying multiple items at once (beside being an interesting concept for prject management).

Otherwise you will have to write an addin on your own.

EA seems to reference stereotypes and other attributes by value, not by reference so just changing the name of a stereotype is not reflected in the model.

Oliver
Title: Re: multiple find & replace in EA
Post by: Damir on April 15, 2008, 10:47:36 pm
Nope,
 I've installed it, you have to have a diagram active and manually select element(s) on which you want to perform the replacement. So NO, it's not a solution. Plus, it doesn't have the support for multiple stereotypes.
Title: Re: multiple find & replace in EA
Post by: Oliver F. on April 16, 2008, 12:51:33 am
Quote
Nope,
 I've installed it, you have to have a diagram active and manually select element(s) on which you want to perform the replacement. So NO, it's not a solution. Plus, it doesn't have the support for multiple stereotypes.

Besides that it does not support multiple stereotypes (which could be a matter of writing an email to Matt Ellis):

- Select your package/root model -> Addins->TimeArchitect->Draw Gatt Chart
- Check "Include child packages"
- Click on "Get Gantt Chart - Element View" and let TA run
- Switch from Gantt to Grid view
- Sort by StereoTypes
- Select all elements of the desired stereotype t once
- Context-Menu->Properties
- Select the new stereotype, click OK

So basically it is working except the multiple stereotypes issue. But as I said, Matt is rather responsive to feature requests.

Oliver
Title: Re: multiple find & replace in EA
Post by: Damir on April 16, 2008, 03:34:38 pm
thank you Oliver.
unfortunatelly, I realised another problem with TA: it doesn't seem to have possibility to work with attributes and operations of a given class or classes. My main problem is with stereotypes of attributes and operations, not with the stereotypes of the classes.
Title: Re: multiple find & replace in EA
Post by: Frank Horn on April 16, 2008, 04:54:21 pm
Damir,

what I would probably do is this:

1. Delete the controlled package containing the wrongly named stereotypes from the model.
2. Rename the stereotypes in the Settings-UML dialog.
3. Replace the stereotype names in the xmi file (via Editor, XSL or whatever). Could be tricky of course if the stereotypes have names occuring in some other context (hopefully your stereotypes don't have names like "content" or "ownedElement").
4. Commit the changes to version control.
5. Reimport the xmi file via GetPackage. If it goes wrong, delete it again, revert to previous version an repeat step 3 and 4.

Of course they discourage fiddling with the xmi files cause they don't want all those support requests saying "I've messed up my xmi, what shall I do?", but it's no problem if you know what you're doing.

Another way would be a RenameStereotypes function in an AddIn. Or a feature request...

Some would rather fiddle with the database. I've never done that, but in your case it may well be the easiest way, probably just a handful of update commands.

Frank
Title: Re: multiple find & replace in EA
Post by: Damir on April 16, 2008, 06:05:28 pm
I created a test environment for that, made changes in the xml files, commited the xml files to subversion, made get latest inside EA and I've noticed in Project statistics that Total Elements and Total Connections increased by 1. I have no idea how this could happen.
I think we'll go the old fashioned way  :'(