eaUtils - Sparx Enterprise Architect add-in

Utilities for your EA models: sort elements, generate alias, diagram breadcrumb navigation...

Page d'accueil (version francaise)TwitterVideos UMLChannel SparxSystems EA YouTubeLinkedIn

Section 4. Sort elements from a Package or an Element by Stereotype (eaUtils v1)

eautils sort by stereotype

This help article explains how to use eaUtils Sort By Stereotype feature on the elements that are contained in a package or element.

This feature runs on a package or an element selected from the Project Browser (it can also be run on a package tree, click here for more information).

Example

The following diagram shows the elements defined in a package with a variety of stereotype values to illustrate the use of eaUtils Sort By Stereotype feature.

eautils sorting example

Using the stereotype to sort elements

This feature lets you use the elements' Stereotype field to define their sorting order within a package or element.

Sort elements within a package by stereotype

Option 1: default settings

 

Right click in the Project Browser on the package where elements need to be sorted > Extensions > eaUtils > [Browser] Sort elements.

sparx enterprise architect sort elements in browser addin

In the following dialog window, select Stereotype as the sorting option and confirm that you would like to proceed.

Note: eaUtils sort by settings are displayed. The settings can be opened and modified if needed.

 sort elements by stereotype in sparx enterprise architect addin

 Once the sorting is complete, the following confirmation is displayed:

The expected result is illustrated below (note that the option "Identify and sort integers within string values" is enabled by default).

Name Stereotype
Actor3  
Actor2 1
Actor1 2
Actor4 3
ActorA B2
ActorB B15
ActorC B20
Use Case0  
Use Case2  
Use Case3 2
Use Case1 3
Class1  
Class2 1
Class3 2
Class4 21
Interface3  
Interface1 5
Interface2 10
Requirement09  
Requirement10  
Requirement11  
Requirement12  
Requirement12  
Requirement9  
Requirement1 Functional
Requirement2 Functional
Requirement3 Functional
Requirement4 Functional
Requirement5 Functional
Requirement6 Functional
Requirement7 Functional
Requirement8 Functional

The new sorting order is visible in Enterprise Architect project browser as illustrated below:

eautils sort by stereotype sparx ea project browser result

Option 2: "Identify and sort integers within string values" setting disabled

When the option "Identify and sort integers within string values" is disabled in eaUtils settings, there is no attempt to extract integer values and sort them accordingly. Based on the previous data set, this option will impact actors with Bx stereotypes:

  • The expected order for the actors is B15, B2, B20, whereas the previous result was B2, B15, B20.

The expected result is illustrated below.

Name Stereotype
Actor3  
Actor2 1
Actor1 2
Actor4 3
ActorB B15
ActorA B2
ActorC B20
Use Case0  
Use Case2  
Use Case3 2
Use Case1 3
Class1  
Class2 1
Class3 2
Class4 21
Interface3  
Interface1 5
Interface2 10
Requirement09  
Requirement10  
Requirement11  
Requirement12  
Requirement12  
Requirement9  
Requirement1 Functional
Requirement2 Functional
Requirement3 Functional
Requirement4 Functional
Requirement5 Functional
Requirement6 Functional
Requirement7 Functional
Requirement8 Functional

The new sorting order is visible in Enterprise Architect project browser as illustrated below:

eautils sort by stereotype sparx ea project browser result

Option 3: Use the Case Sensitive Value setting

eaUtils can be case sensitive on the values depending on eaUtils v1 Settings choice.

This can be useful when you need to treat values like "Requirement1, requirement2, REQUIREMENT3, requirement4, Requirement5" as within the same list or not. If you make eaUtils case sensitive, the previous list will be sorted as follows: "requirement2, requirement4, Requirement1, Requirement5, REQUIREMENT3".

Option 4: Sort numbering sequences setting (eaUtils 1.12)

The following diagram illustrates a package content which stereotype needs to be sorted using eaUtils Sort numbering sequences option.

When enabled, this option leads to the following result in the project browser:

Option 5: sort sub elements 

Introduced in eaUtils 1.14, the "process sub elements" sorting setting is available so that not only elements within the selected package are sorted, but also elements placed within elements of that package.

With the current example model, running the sort by stereotype with the sub elements setting enabled makes it possible to sort elements within the selected package, as well the the elements within the composite use case (Use Case0), illustrated in the next section.

Sort elements within an element by stereotype

Right click in the Project Browser on the element with embedded elements to be sorted > Extensions > eaUtils > [Browser] Sort elements.

In the following dialog window, select Stereotype as the sorting option and confirm that you would like to proceed.

The expected result is illustrated below (note that the option "Identify and sort integers within string values" is enabled by default).

Name Stereotype
Activity3  
Activity2 Core
Activity1 Integration
Start  
end  
option enabled?  

Once confirmed, the elements are sorted in the composite element as illustrated below, matching the above expected results:

eautils sort by stereotype sparx ea project browser result