Enterprise Architect version 13.5

download
purchase

enzh-CNcsnlfrdehiiditkoplptruskessv

My Profile

Social Media Channels

facebook google plus twitter youtube linkedin

Monday, 31 March 2014 12:40

Duplicate validation in Enterprise Architect

Written by 

Duplicatevalidation in Enterprise Architect 

 

Introduction 

This article is an example of using Enterprise Architect in a team. In our team of four architects we use Enterprise Architect for modelling the enterprise architecture in ArchiMate 2.0. For this government agency with approximately 1200 employees there is a large repository of architectural elements, building blocks and diagrams. 

Because we maintain this repository with four architects a number of challenges arise: 

  • Everybody uses the same definition of elements and concepts 

  • The repository structure is managed by one authorized team-member (the custodian)  

  • There is agreement about the architecture process and products 

These activities are embedded in the team structure and process and gives us the opportunity to cooperate in producing our architect documents and products. However one problem is hard to solve: the duplication of architecture elements. This article introduces a solution based on a automation extension for Enterprise Architect. 

The problem 

The repository in our organisation has around 2000 ArchiMate elements stored in a relational database. The repository explorer has therefor a tree-structure with multiple layers and multiple entrypoints. For creating a model and the containing elements these is a description of an architecture modelling process, see the paragraph below. However this process is not always followed. 

This causes a problem of duplication of elements. In the figure below we see an example of this problem. There are three architects that created a model for their one document or project and they did not validate the repository for existence of the elements. This causes that there are elements with the same characteristics in the repository 

Afbeelding 

Figure: Duplication problem 

This duplication problem has a number of disadvantages like: 

  • Associations of elements with other elements and diagrams are incomplete 

  • Documentation and notes are scattered over the duplicated elements 

  • Future use of elements can cause further inconsistencies and duplications 

  • Merging of duplicated elements is a time-consuming activity   

Therefor we search for a solution to tackle this problem based on the automation model of Enterprise Architect 

The modellingprocess 

The modelling process has a number of steps based on the structure of the user interface in Enterprise Architect. In the figure below you can see the steps of this process in an ArchiMate notation. The steps in the figure is the correct process and it includes a step to check for existence of each element in the repository before creating it. 

Afbeelding 

Figure Correct modelling process 

Unfortunately this correct process has an extra step which is easily forgotten when the model is created. For example in an interactive workshop with the stakeholders, the validation step is time-consuming for the architect and therefor forgotten. In the figure below you see the incomplete process.  

Afbeelding 

Figure Incomplete modelling process 

A repository which is based on an incomplete modelling process will slowly be polluted with duplicate elements and is therefor harder to maintain and use for future diagrams. To reduce this risk the following solution is introduced. 

The solution 

The solution is an automation extension developed in VB.Net and attached to Enterprise Architect as an extension. There are a number of entries available: 

  • After creating or modifying an element in the repository the element properties like stereotype and name are validated for existence in the repository. When this is the case the user gets a warning. 

In a diagram or in a package in the explorer the extension menu has an extra option for validating all the elements in the diagram or packages. When there are duplicated elements these are displayed in a overview dialog window. 

In the figure below you see an example of the validation screen. When an element is visible in this screen it has one or more duplicates 

Afbeelding 

Figure: Duplicate screen 

Implementation of the extension 

For the implementation of the extension I used the examples on the website of Sparx. Furthermore the article of Geert Bellekens was of great value see http://bellekens.com/2011/01/29/tutorial-create-your-first-c-enterprise-architect-addin-in-10-minutes/ 

Unfortunalety I am a developer older than fourty and therefore experienced in VB.Net and less in C#. Howeverthere is a web converterfor C# and VB.Net that is of great assistance in this situation. See http://www.developerfusion.com/tools/convert/csharp-to-vb/  for more information.  

The source code of the extension is divided in threesections: 

  • Handling the events 

  • Do the validation checks 

  • Display warnings or lists of elements 

 

The first section is an implemention three events of the mentioned examples. The second section is of more interest and a codesnippet is given below: 

 Private Function CheckUniqueElement(oElement As EA.Element,_ 

 oRepo As EA.Repository) As Boolean 
 
Dim sSql As String 
 
If oElement.Stereotype.Length > 0 Then 
sSql = "SELECT Count(*) as aantal FROM t_object  

WHERE t_object.name = '#name#' AND t_object.Stereotype='#stereotype#'  

AND t_object.ea_guid<>'#guid#' " 
sSql = Replace(sSql, "#name#", oElement.Name) 
sSql = Replace(sSql, "#stereotype#", oElement.Stereotype) 
sSql = Replace(sSql, "#guid#", oElement.ElementGUID) 
 
   strVal As String 
   strVal = oRepo.SQLQuery(sSql) 
   Return strVal.Contains("<aantal>0</aantal>") 
End If 
Return True 
End Function 

In the codesnippet a simple check is made based on a SQL statement. This statement checks for duplication on name and stereotype of the element. For ArchiMate this is sufficient, possibly for other notations another combination of attributes is necessary. 

Another part of the validation section is looping through the collection of elements in a package or  diagram. The code below shows the example of the diagram function: 

If Location.ToUpper() = "DIAGRAM" Then 
 Dim oElement As EA.Element 
 Dim oDiagramObject As EA.DiagramObject 
 For EachoDiagramObject In _ 

 Repository.GetCurrentDiagram().DiagramObjects 
  oElement = Repository.GetElementByID(oDiagramObject.ElementID) 
 If Me.CheckUniqueElement(oElement, Repository) = FalseThen 
   oWnd.AddElement(oElement) 
  End If 
 Next 
End If 

The last section of the display on the screen of the validation results is handled. In the source code files of the download you can find the example.  

Using the extension 

This extension is developed as a solution in Visual Studio Express. The solution is available in a zip file and can be downloaded from http://www.interactory.nl/frmFormManager.aspx?webpage=dla2ea 

When you compile the solution in Visual Studio it is automatically registered for automation usage in the registry. For deployment without Visual Studio you have to use regasm.exe. Make sure that you use the correct version of regasm.exe, especially when you have multiple versions of the DotNet framework on your environment. 

The DLL is available in the BIN/Release folder and is compiled under DotNet 4.0. Furthermore you have to make a registry entry with regedit under the EA AddIns The value that you have to add points to the entry class in the DLL. The value is:DLA2EA.DLA2EAAddIn. 

The extension is at the moment still limited in functionality. In our organisation we are thinking about a number of extra functions like merging elements to one element based on the attributes of elements or via a user interface.

Read 7563 times Last modified on Tuesday, 01 April 2014 21:25
Rate this item
(2 votes)
Bert Dingemans

I am an independent (data) architect and EA consultant working often with enterprise architect mostly for UML class diagrams and ArchiMate 2.0. I am using enterprise architect for  generating documentation, XSD files and modelling enterprise architectures with ArchiMate 2.0. I have developed an Open Source Web Publication Platform for EA.  You can reach me at bert@interactory.nl

Website: www.interactory.nl
Login to post comments