Author Topic: Change Stereotypes  (Read 3908 times)

Zeradius

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Change Stereotypes
« on: December 04, 2013, 05:02:36 pm »
Good Day

I want to develop a c# application that will compare XML extracted from an other application and according to that change an activity stereotype.

I do not know where to start and need help with connecting to the stereotypes for that particular activity.

Please any input will be appreciated. :)


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Change Stereotypes
« Reply #1 on: December 04, 2013, 05:36:05 pm »
An activity is an element and that has a stereotype property you can change. Probably you should have a look in my scripting book. There's a free sample available.

q.

Zeradius

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Change Stereotypes
« Reply #2 on: December 04, 2013, 06:41:51 pm »
Thanks.

So I will use the EaElement with the GUID and also the stereotype.

What it needs to do is...when a customer selected yes or no then this must go into the EA Database and change the Element stereotype.

So when the modeller goes into the database then he/she can see what is required and not required.

This is my first time programming with EA and I am struggling to get the EA elements.

Is there any more guides I can work through?

Regards
« Last Edit: December 04, 2013, 06:42:52 pm by Zeradius »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13240
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change Stereotypes
« Reply #3 on: December 04, 2013, 07:17:57 pm »
Some sources for info:


- the help file: there a whole automation section in the help file
- Thomas Kilians scripting book
- The examples in the installation folder (on my machine on C:\Program Files (x86)\Sparx Systems\EA\Scripts)
- The community site
- this forum (there are a lot of posts with code snippets)
- My blog Tutorial: Create your first C# Enterprise Architect addin in 10 minutes
-  My open source repositories (C#)

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Change Stereotypes
« Reply #4 on: December 04, 2013, 10:35:03 pm »
Check out the resources Geert pointed out. Once you have got a feeling for the API and you have questions then post here. You will of course not get a programming tutorial here on the forum ;)

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Change Stereotypes
« Reply #5 on: December 04, 2013, 10:55:25 pm »
If you're only just starting out, it's probably worth it to point out that there are two major ways to write software that interacts with an EA repository: from inside or outside the EA application.

Inside means your code runs within EA, either in the form of a script or an Add-In. An Add-In is a DLL written to respond to the various events EA triggers; see the help file under Automation and Scripting -- Enterprise Architect Add-In Model. Among other things, an Add-In can add its own menu items to EA:s GUI (where they appear under Extensions).

You can also write your own stand-alone application to access an EA repository. This uses the Object Model API, also documented under Automation and Scripting. The section Using the Automation Interface tells you how to get started. The Object Model API contains all the stuff for storing and retrieving models, and you use it in scripts and Add-Ins too -- the only major difference is that in an Add-In, you don't open the repository yourself but get an event when the user opens it.

The main consideration is whether you want to respond to things like elements being changed by the user (and perhaps prevent this). If so, you need to write an Add-In. If on the other hand you are primarily interested in doing bulk changes to a model without user interaction, you can write a stand-alone application.
My theories are always correct, just apply them to the right reality.