Book a Demo

Author Topic: How do I Create and Delete realisation in add-in  (Read 5374 times)

jeanfrancois

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
How do I Create and Delete realisation in add-in
« on: January 28, 2010, 08:04:12 pm »
Hi

I am writing an add-in that attempts to link activities in activity diagrams to classes via realisation. It works in that when done, the realisation links are visible in 'properties' in 'links' of the activity elements and the class elements in EA.

However, it does not allow me to (after right clicking the realisation link) delete it, it gives an error DAO.Database [3167]. The link remains under properties no matter how many times I delete it. Why does this happen? It also does not allow me to follow the link to locate the class from the link, nothing happens.

I have tried creating realisations from activities to classes manually in EA, and when deleting I get the same error.

Any advice?

Code: [Select]
Connector connector = (Connector)activityElement.Connectors.AddNew string.Empty, "Realisation");
connector.ClientID = activityElement.ElementID;
connector.SupplierID = classElement.ElementID;
connector.Direction = "SourceToDestination";
connector.Update();

activityElement.Update();
classElement.Update();
activityDiagram.Update();
classDiagram.Update();

I noted that when deleted from the code:
Code: [Select]
activityElement.Realizes.Delete(i)
it does delete the realisation links, however, it also deleted the related activities and class elements, which is not what I want.
« Last Edit: January 28, 2010, 08:04:41 pm by hdjjqj »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How do I Create and Delete realisation in add-
« Reply #1 on: January 28, 2010, 08:16:09 pm »
Have you tried this on the latest version?

Geert

jeanfrancois

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: How do I Create and Delete realisation in add-
« Reply #2 on: January 28, 2010, 08:18:55 pm »
Hi Geert. Yes, I use version 7.5.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How do I Create and Delete realisation in add-
« Reply #3 on: January 28, 2010, 08:23:12 pm »
You could try with "Realization", maybe that works?

I've just tested the manual scenario you described, but I don't get an error when deleting a realization.

Geert

jeanfrancois

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: How do I Create and Delete realisation in add-
« Reply #4 on: January 28, 2010, 11:15:44 pm »
It works now, thanks :). I still use "Realisation" as it is what is used when manually creating one. I switched the source and destination, the class is now source, now they delete and work fine. I'm still not sure why the other way round does not want to delete, Maybe it's because my model is corrupted since I've been using it for testing on my add-ins for a while, and have deleted and created stuff over and over, though it seems to only happen when I create the realize link with the activity as source.

I tried this in a new model with a small activity diagram and class diagram, and everything worked, so must be something I did to damage the model somehow.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How do I Create and Delete realisation in add-
« Reply #5 on: January 29, 2010, 10:05:31 am »
I always run the Project Integrity Check before and after I do this kind of stuff (in development).  That way you can often find "funnies" that you're doing that corrupt EA's view of the world.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

jeanfrancois

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: How do I Create and Delete realisation in add-
« Reply #6 on: January 29, 2010, 08:15:02 pm »
Thanks :), I've just run that on my model and it was all smashed up with invalid things. I've started up a new project and will keep on checking the integrity now.