Displaying items by tag: enterprise architect 15

Evolving your Business Processes through Time Aware modelling

Earlier this week I was spending a little time flitting around the various LinkedIn groups that I frequent. In one of the BPMN groups, the group admin had set a fun little challenge as follows:

Create a BPMN model for this leave application process:

  • Employee applies for annual leave
  • Employee must submit the request to their Manager if the leave is < = 5 days
  • Employee must submit the leave to their CEO if the leave is < 5 days
  • The Manager or CEO approve/reject the leave
  • The Manager or CEO inform Employee that their leave application is approved / rejected

I had some time to spare & thought I would quickly whip up a process model to represent this in its most simple form. This was the result:

Time Aware Modelling - BPMN

As you can see, this is probably as simple as this scenario could possibly be made. But, what if I want to evolve this model, how can I show the evolution of this process?

Time Aware BPMN modelling

You may or may not be aware of the ability to create time aware models within Sparx Systems Enterprise Architect, and this functionality allows us to take our as-is process (the simple process), clone it and make the modifications to process that will show our future state…the to-be model.

So how does this work?

This process works by cloning an existing package and its content as a new structure and using EA to give the newly cloned diagram a new version number.

For BPMN modellers, there is a trick that you must be aware of. Cloning a BPMN diagram for the purpose of time aware modelling requires that the diagram in question is at the highest possible level within the package being cloned. This means that you cannot have the diagram created beneath a model element as shown here:

Model Element

If you were to attempt to clone this, all that you would end up with is the package structure. To get the successful cloning your package needs to look like this:

Browser

If you have an existing model within a model element, all is not lost. First, you will need to copy the package using this option:

Duplicate Structure

Next, paste the package from the clipboard into your repository & rename it e.g. Package X for Time Aware. Then, open the package and expand the model element. Following that, move the diagram and all the elements to the top level of the package. You can then delete the model element as it will not be used and would still be present on the original version.

Having done this, you will now be able to clone the package successfully to undertake your time aware modelling activities.

There are a few things that you need to be aware of. For example, you must remember to rename the cloned diagram to reflect its new version so that it is obvious at a glance. This will prevent you from confusing the new version with the old.

Additionally, to make use of this functionality you will need to activate the following filters on the new diagram:

  • Filter to Version
  • New to Version

The ‘filter to version’ option will look at your cloned diagram and then grey-out anything that is the same as within version one. The’ new to version’ option will display any element added to the new version as ‘normal’, allowing you distinguish between features that are in place within your process and the features that you wish to add to your process in the newer version.

You can even make minor modifications to version one elements & have them render for version two. You can do this by right-clicking one of your greyed-out elements and cloning to new version:

Clone Element

You will of course need to ensure that the version number you assign to this cloned element matches the version number that you have assigned to the diagram. This will then allow you to see the new version of the element on your to-be diagram.

With this in mind, let us jump back to the original example in this article and see how it has evolved using this time aware approach:

Employee Request Leave v2

As you can see, in the to-be version of this simple process model, we can immediately see the differences between version one and version two, in which we have modelled how we would like this process to function in a future state, whilst retaining the ability to see how the original version functioned. This has been achieved through a combination of adding entirely new elements and cloning some of the original elements to this version and altering their properties.

This will allow you to make informed decisions on how you can change your processes over time before making sweeping change without seeing the effect on your current state of play.

Published in Tutorials

Working with the Repository.CurrentSelection

written by Phil Chudley, Principle Consultant at Dunstan Thomas Consulting

Overview

When developing a script of an extension a fairly common requirement is to process a set of selected elements. This can be achieved using either GetTreeSelectedElements (for a selection in the Project Browser), or SelectedObjects (for a selection on a Diagram). These work well enough, but there appears to be no method for processing a selection of Diagrams or Packages within the Project Browser, or a selection that contains a mixture of Diagrams, Elements and Packages. You may not need to process such a selection very often, but if you do, then this document will provide an overview of a method that will allow processing a mixed set.

This uses a property from the Repository class named CurrentSelection.

Examples of code are provided in this document and an example script is provided as a download. The language using is JScript but the same principles will apply to other languages such as VB Script and C#/

The CurrentSelection Property

The CurrentSelection property provides access to all items, regardless of their type, within a current selection. This selection can be made within the Project Browser or on a diagram. In this tutorial we will focus on a selection of items made within the Project Browser using a simple JScript example.

The CurrentSelection property returns a special form of Collection typed as an EASelection, hence it can be accessed using a simple line of code such as:

var selection as EA.EASelection;

selection = Repository.CurrentSelection;

Iterating the CurrentSelection Property

As a first simple exercise, let's just iterate the CurrentSelection so that we can discover what type each item in the selection is, once we have this information, we can think about processing each item within the collection.

Create a Normal Group for the script and create a new JScript.

When iterating the CurrentSelection, it is important that you use a simple for loop, (JScript Enumerators or C# foreach will not work). The list of items in the selection is stored within the List property in which each item in the List is of an EAContext type which has a property named ContextType which will yield the type of item being processed. In JScript this is an int, in C# it should be converted to a string using ToString().

Using simple iteration in JScript such as:

for (var index = 0; index < selection.List.Count; index++)

{

     var item as EA.EAContext;

     item = selection.List.GetAt(index);

     Session.Output("The item has type of " + item.ContextType);

}

Let's assume a selection has been made in the Project Browser which contains, diagrams, elements and packages. Execute the script and you will discover that:

Diagrams have a ContextType of 0 (or otNone if you want to use the JScript constants)

Elements have a ContextType of 4 (or otElement if you want to use the JScript constants)

Packages have a ContextType of 5 (or otPackage if you want to use the JScript constants)

The only surprise or gotcha is the ContextType for a Diagram, this is 0 (rather than 8) or otNone (rather than otDiagram) as you would expect.

Getting the Details About Each Item

Armed with the knowledge about each item's ContextType we can now turn our attention to access the properties for each different type of item in the selection. Luckily, the GUID for the item is provided as a property in the EAContext object, so to extract each item from the repository is reasonably straightforward. I use a switch case structure for this. 

In the following code references are made to functions that display details for each item type, the code for these functions is not shown here, but is included in the script which can be downloaded.

switch (item.ContextType)

{

   case otNone:

         var theDiagram as EA.Diagram;

         theDiagram = Repository.GetDiagramByGUID(item.ElementGUID);

         DisplayDiagramDetails(theDiagram);

         break;

   case otElement:

         var theElement as EA.Element;

         theElement = Repository.GetElementByGUID(item.ElementGUID);

         DisplayElementDetails(theElement);

         break;

   case otPackage:

         var thePackage as EA.Package;

         thePackage = Repository.GetPackageByGUID(item.ElementGUID);

         DisplayPackageDetails(thePackage);

         break;

}

Modifying Each Item in the CurrentSelection

So far, the coding has been straightforward, so let's consider modifying each element in the selection, regardless of its type, (for example for prefix the name of each item with a string). Or perhaps you want to apply different changes depending upon what type of item is being processed. You might think that an iteration and switch case like the one above would work, where inside the switch case you call a function to apply the modifications.

However you would be wrong! Another gotcha and it's a big one! As soon as an item in the selection is modified and updated, the selection is modified (at least one item is dropped from the selection) and you will lose the original selection! You can try this and see for yourselves. So it appears we are stuck, but help is at hand.

There may be other solutions, but the approach I use is:

1) Create three arrays (or ArrayLists in C#) one for each type of item

2) Iterate the selection as above, and add each item to its respective array.

3) Iterate each array to process the items in that array and apply the changes.

var diagramArray = new Array();

var elementArray = new Array();

var packageArray = new Array();

switch (item.ContextType)

{

   case otNone:

         var theDiagram as EA.Diagram;

         theDiagram = Repository.GetDiagramByGUID(item.ElementGUID);

         diagramArray.push(theDiagram);

         break;

   case otElement:

         var theElement as EA.Element;

         theElement = Repository.GetElementByGUID(item.ElementGUID);

         elementArray.push(theElment);

         break;

   case otPackage:

         var thePackage as EA.Package;

         thePackage = Repository.GetPackageByGUID(item.ElementGUID);

         packageArray.push(thePackage);

         break;

}

To process each array, you can use an Enumerator (C# for each) or a simple for loop, it's your choice. I tend to use Enumerators.

Let’s assume that we simply want to prefix the name of each item in the selection with some text that has been entered by the user (JScript Session.Input)

var diagramEnumerator = new Enumerator(diagramArray);

var elementEnumerator = new Enumerator(elementArray);

var packageEnumerator = new Enumerator(packageArray);

while (!diagramEnumerator.atEnd())

{

     var diagram = diagramEnumerator.item();

     diagram.Name = prefix + "-" + diagram.Name;

     diagram.Update():

     diagramEnumerator.moveNext();

}

while (!elementEnumerator.atEnd())

{

     var element = elementEnumerator.item();

     element.Name = prefix + "-" + element.Name;

     element.Update():

     elementEnumerator.moveNext();

}

while (!packageEnumerator.atEnd())

{

     var package = packageEnumerator.item();

     package.Name = prefix + "-" + package.Name;

     package.Update():

     packageEnumerator.moveNext();

}

Summary

I hope you have found this tutorial useful, this technique is not something that you will need often, but for that occasion when you do need to process a Project Browser selection then this tutorial should help you out.

Phil Chudley

Principle Consultant

Dunstan Thomas Consulting

follow me on Twiter @SparxEAGuru

Published in Tutorials

Sparx Systems has recently released its latest version of Enterprise Architect 15. Sparx Systems have added various new features in this version.

Here is a guide with list of menus, frequently used by EA practitioners would be very helpful. This ultimate guide focuses highly up on how to access those frequently used options from menu bars along with some shortcuts. Since there are many changes in menus for frequently used options like Package Baseline, Export/Import of XMI, Linked Documents and others.

You can also find the full comparison between Enterprise Architect version 13.5, 14 and 15 in the below link.
Full Comparison between (EA13.5, EA14, EA15) on Frequently used menus in Enterprise Architect


Below table details the commonly used option of Enterprise Architect.

Enterprise Architect Features

Enterprise Architect 15

Start

Project Browser

Start |  Design | Browser

Explore | Portals | Windows | Explore | Project Browser

Ctrl+1

Context Browser

Start | Desktop | Design | Browser | Context

Explore | Portals | Windows | Explore | Context Browser

Diagram Browser

Start | Desktop | Design | Browser | Diagram

Explore | Portals | Windows | Project Browser | Diagram

Element Browser

Explore | Portals | Windows |  Explore |  Element Browser

Start | Desktop | Design | Browser | Element

Preferences / Settings

Start | Preferences | Preferences

Ctrl+F9

Menu Customize

Start | Preferences | Other Options

Summary

Start | Design | Common | Summary

Resources (Alt +6)

Start | Share | Publish | Resources

Notes (Ctrl + Shift + 1)

Start | Design | Common | Notes

Tagged Values (Ctrl + Shift + 6)

Design | Element | Editors | Properties | Tags

Start | Design | Common | Properties ( Tags Tab )

Element Browser (Alt + 9)

Explore | Portals | Windows |  Explore | Element Browser

Start | Design | Browser | Element

Relationships (Ctrl + Shift + 2)

Start | Design | Details | Properties

Element Properties (Alt + 1)

Start | Design | Common | Properties ( Element Tab )

Find in Project (Ctrl + f)

Start | Search |Model

Workspace

Start | Workspace

Visual Style

Start | Visual Style

Perspective

Start | Portals | Perspective

Design

Traceability (Ctrl + Shift + 4)

Design | Trace | Traceability

Relationship Matrix

Design | Matrix | Relationship Matrix

Gap Analysis Matrix

Design | Gap Analysis | Gap Analysis Matrix

Toolbox

Design  | Diagram | Toolbox

Change Diagram Type

Design | Diagram | Manage | Change Type

Specification View

Design | Specify

List View

Design | List View

Gantt View

Design | Gantt

Change Element Type

Design | Element | Manage | Change Type

Layout

Diagram Layout

Layout | Diagram Layout

Pan and Zoom

Layout | Pan and Zoom

Diagram Filter

Layout | Diagram Filters

Publish

Glossary

Publish | Glossary

Configure

Project Options

Configure | Options

UML Types (Stereotypes / Tagged Values / Cardinality Values)

Configure | UML Types

Project Types

Configure | Model Types

Database Datatypes

Configure | Settings | Database Datatypes

Namespace Roots

Configure | Settings | Namespace Roots

Preprocessor Macros

Configure | Settings | Preprocessor Macros

Manage Security

Configure | Administer

Project Transfer

Configure | Transfer | Project Transfer

Export Reference Data

Configure | Transfer | Export Reference Data

Import Reference Data

Configure | Transfer | Import Reference Data

Enable Audit

Configure | Auditing

Project Integrity

Configure | Integrity | Project Integrity

Reset ID

Configure | Integrity| Reset IDs

Repair .EAP file

Configure | Integrity| Manage .EAPX/.EAP file | Repair .EAPX/.EAP file

Compact .EAP file

Configure | Integrity| Manage .EAPX/.EAP file | Compact .EAPX/.EAP file

Update .EAP file Indexes

Configure | Integrity| Manage .EAPX/.EAP file | Update .EAPX/.EAP file Indexes

Construct

Discussion

Start | Discussions

Team Review

Start | Reviews

Resource Allocation

Construct | Resources

Develop ( Code in older Versions )

Code Templates

Develop | Options | Edit Code Templates

Code Engineering Datatypes

Develop | Options | Configure Code Engineering Datatypes

Import Source Code

Develop | Files | Import Source Directory

Specialize ( Extend in older Versions )

Manage Add-ins

Specialize | Add-Ins | Manage

PCS Integrations

Specialize | Tools | Systems integrations |Open External Data

Import MDG Technology

Specialize | Technologies | Publish-Tech | Import MDG Technology

Generate MDG Technology

Specialize | Technologies | Publish-Tech | Generate MDG Technology

Manage Technology

Specialize | Technologies | Manage-Tech

Scripting

Specialize | Scripting

Others

Linked Document

Start | Design | Document

Export XMI

Publish | Export-XMI

Import XMI

Publish | Import-XMI

Apply Auto Naming to Elements

Design | Manage | Auto Naming

Turn on Level Numbering

Design | Manage | Level Numbering

Package Baseline - New

Design | Manage | Manage Baselines

Package Control

Publish | Package Control | Package Configure

Generate Source Code

Develop | Source Code | Generate

Project Browser Search

Project Browser | Drop Down | Find in Browser

Document Generation

Publish | Report Builder | Generate Documentation

Project Browser Drop Down | Documentation | Generate Documentation (RTF/PDF/DOCX)

Diagram Properties Dock

Start | Design | Properties

Context Browser (Alt + 0)

Start | Desktop | Design | Browser | Context

Explore | Portals | Windows | Explore | Context Browser

Inline Specification

Design |  View As | Inline Specification View

 

For more details or customization please contact This email address is being protected from spambots. You need JavaScript enabled to view it.

Published in Tutorials

One of the latest features of Sparx Enterprise Architect 15 is the model based add-ins which can be created using JavaScript.  These model based add-ins are defined by a combination of Receptions, Attributes and Operations which can be easily added in a model by just creating with a valid stereotyped classes.

Assuming having basic knowledge with Sparx Traditional add-ins, broadcast events and JavaScript.

Why model based add-ins

    • Accessed by all the users within a model
    • Purely Model specific 
    • No installation, registry entries , distribution or license worries
    • Self-Documenting as everything is modelled and created directly in EA

Prerequisites

    • Signal Reference Library ( Broadcast Events ) -  Defines the entry points to the add-In similar to the com class in the traditional add-ins
    • Referencing relevant signals in the receptions

What is Signal Reference Library

These are Signal elements which contain definitions of all the Enterprise architect broadcast events. Signals that are added to the add-in will receive an event when triggered similar to traditional add-ins. EAExample model contains all the broadcast event signals under the package Example Model.EA 15 Examples.Dynamic Model Based Add-Ins.Broadcast Types

Mandatory Signals or Events for Add-in

    • EA_Connect
    • EA_GetMenuItems
    • EA_MenuClick

All the available events references can be found here https://www.sparxsystems.com/enterprise_architect_user_guide/15.0/automation/broadcastevents.html

To Create an JavaScript Add-In

  1. Create a Signal Reference Library referring EAExample model. (Simple way would be just do an XMI export of the Broadcast Types package from EA model and import into your working model).
  2. Create a package in the root node for modelling the add-in
    1

    1. Create a class object with stereotype JavascriptAddin ( this stereotyped element can be found in Model Add-Ins tool box as shown below
      2
    1. The name of the above defined will be used in the JavaScript code. In our case it will be “Javascript Addin”
    2. Add the signal reference in the created class using the reception.
      • To Access Reception Right-click on the Class element and select the 'Features | Receptions' option. The Features window displays, at the 'Receptions' page.
        2.1
      • Add the required events by clicking the button to the right of the New Receptiontext in the 'Name' column , the dialog will show the available Signals ( it will automatically fetch the parameters details from the object )
        3
    • Once selected all the added signals will be displayed in the class object.
      4
    1. After adding these events, its time to play with some JavaScript codes.
    2. Please open the behavior window (Develop > Source Code > Behavior) make sure the created class object “Javascript Addin” has been selected. It will show all the added events to which we need to add the code
      5
    1. Codes for these events are similar to the traditional add-ins ( please refer the attached model for more details )
    1. Finally make sure the add-in is enabled. To enable the add-in Specialize -> Manage-Addin and please click Load on startup
      6
    1. Once the add-in is loaded you can find it in the ribbon
      7

    Note:

    For more details or customization please contact This email address is being protected from spambots. You need JavaScript enabled to view it.

Published in White Papers