Generate elements alias values according to their layout in a diagram
Example with a UML Use Case diagram
The first example is based on the following UML use case diagram with the aim to generate the alias values for the use cases.
Having defined this diagram, eaUtils can be used to generate the elements’ alias values based on their position from top to bottom, e.g. to obtain UseCase_001_BookStore, UseCase_002_BookStore…
eaUtils settings
Actors shown in the diagram mustn’t be processed as they’re located in the Actors package:
External elements (actors in this case) can be ignored via eaUtils settings; eaUtils cancels any alias generation request when it finds external elements i.e. located in a package other than the diagram’s package unless the following setting is modified.
Open EA Specialize menu ribbon > eaUtils > eaUtils Settings > Generate Alias tab, and select the option Ignore external elements in Processing external elements.
Note: additional settings will be illustrated in the next section.
Before saving the settings, let’s set the options on the alias prefix, suffix, and numbering to generate aliases such as “UseCase_001_BookStore”:
- Prefix: element type e.g. UseCase followed by the text "_"
- Suffix: text "_BookStore"
- Trailing zeros set to 2 to generate values such as 001, 002, 003, etc.
- Start with number 1 and save the incremented numbers
- Ignore external elements e.g. actors
- Generate the alias only on the Use Case elements ("Limit to object type" = UseCase).
Click SAVE to apply the changes.
Note: generate alias settings are also available from eaUtils dialog when running Generate Alias from a diagram.
Generate elements alias values
Right click on the diagram > Extensions > eaUtils > [Diagram] Generate elements Aliases by their order.
In the following dialog window, set the Direction to Top to Bottom and click on OK to proceed.
Once the aliases have been generated, the following confirmation message is displayed.
Results (note: Diagram Property 'Use Alias if Available' is enabled):
Clear the alias values
eaUtils can be used to clear and delete all elements alias values. This feature is available with a right click in the diagram > Extensions > eaUtils > [Diagram] Clear the aliases from all elements.
As a result, the diagram has moved back to its initial state:
Example with a BPMN2 diagram
The following diagram illustrates another use of eaUtils Generate Alias feature. The aim is to generate a reference in the alias field of the activities only with the syntax "TASK-1-invoicing".
Configurate and generate the elements alias values
Right click on the diagram Specialize > eaUtils > Generate a package elements alias values by their order in this diagram.
In the dialog window, select Top to Bottom as the Direction, and Activity as the Stereotype.
Click on Edit Settings to provide the following definition:
- The prefix text is set to "TASK-"
- The incremented numbers must start at 1
- Leading zeros: auto
- Only Activity elements must be processed
- The suffix is set to "-invoicing"
Result with Diagram Property 'Use Alias if Available' enabled:
ArchiMate diagram and stereotype selection
Generating alias values can be limited to a selected stereotype. This can be useful for ArchiMate diagrams as illustrated below with a Business Active Structure example from ArchiMate 3.1 specifications. Alias can be generated for a single stereotype with eaUtils e.g. ArchiMate Business Actors.
Note: the Limit to stereotype option is only available when the diagram contains at least one stereotyped element.
The following settings have been defined to generate alias values Actor-001, Actor-002, etc.
Result: