Author Topic: Integration with EA  (Read 4216 times)

Neoris_alm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Integration with EA
« on: October 25, 2007, 01:29:14 pm »
 How can I make to insert a new element to EA from
another application? I try to use a java API, but I don´t see which classes have that operation ??

The elements that I need to Insert like new are Requirements and package and its relations.

EA has some another method to get this Integration like webservices ??

thanks

Israel Ruiz

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Integration with EA
« Reply #1 on: October 25, 2007, 02:56:08 pm »
Israel,

What you actually have to do in add a new element to the appropriate collection. You will call the collection's AddNew method to accomplish this.

This theme is repeated throughout the API, with minor variations in what you supply as values for the two parameters.

HTH, David
No, you can't have it!

Neoris_alm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Integration with EA
« Reply #2 on: October 26, 2007, 05:32:33 am »
Ok  :o , but Where can I find some examples about that.
or the Api documentation ??

thanks.


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Integration with EA
« Reply #3 on: October 26, 2007, 07:25:42 am »
Israel,

You need to look in the SDK, which is now a section of the EA User Guide, or the EA Help file.

In contents, look up Extend Enterprise Architect - Software Developers Kit | Enterprise Architect Object Model.

The Reference section is what you want, though you might also want to read through the Using section too. There are some (very basic) code samples in the Reference section. These show several variations on the AddNew theme, and should be enough to get you started.

You can also search the forum for AddNew. You'll find a lot of general discussion, but also some code snippets.

David
No, you can't have it!

Neoris_alm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Integration with EA
« Reply #4 on: October 26, 2007, 09:09:36 am »
Hi David!!

I looked for the examples but I don´t find anything about insert from Java api () a new Element. I do this

Repository r = new Repository();

r.OpenFile("c:\\ALM_Process.eap");
 
Collection <Datatype> coll =  r.GetDatatypes();
coll.AddNew("New Requirement", "Requirement");
 
r.CloseFile();

it run without problems, but I don´t see any change on my
ALM_Process.eap

do u have some suggestion ??

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Integration with EA
« Reply #5 on: October 26, 2007, 10:34:00 am »
Yes I do.

I should have mentioned this. However, it is one of the 'gotchas' in EA - it is almost impossible to figure out until you've seen it, and afterwards it is so obvious that you forget all about it.

After you create (or modify) anything in EA you need to call the thing's Update() method (there are no arguments). Until then EA really doesn't store the new thing or the changes. If you forget this method it is as if you never did the previous operation. In the case you mention you will get the symptoms you describe - nothing has happened.

Let me know if this gets you going.

David
No, you can't have it!

Neoris_alm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Integration with EA
« Reply #6 on: October 26, 2007, 11:25:09 am »

Thanks David,
I follow your comments and I get it  :)

also I found the steps into the "Help Contents" to Add new elemet in my Model

1. Call AddNew to add a new item
2. Modify the item as required
3. Call Update on the item to save it to the database
4. Call Refresh on the collection to include it in the current set

I´m grateful for your quickly answers

TA

Israel Ruiz





«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Integration with EA
« Reply #7 on: October 26, 2007, 11:33:29 am »
OK, good to know this is working for you.

The Refresh() call is not absolutely necessary, unless you will need to get the new item from its parent collection right away. If you are only going to create the item, and perhaps manipulate its properties, then you've got the appropriate object variable - the return value from AddNew().

However, if you are then going on to create another item, and might come back to the first (or any other scenario where you need to get an item from the parent collection) you will need to call Refresh(). This makes your copy of the collection accurately reflect the current contents.

Refresh() is also important when you have deleted items in the collection.

BTW, in some scenarios it is worth populating the collection  with several items and the calling Refresh() once at the end of the sequence. This can save some time when you are adding many new items, but not fetching any until later.

David
No, you can't have it!