1 reply Latest Post - ‏2013-12-13T14:39:01Z by BuddyRobbins
18 Posts

Pinned topic Problem programmatically creating link

‏2013-12-12T20:40:07Z |

I'm trying to programmatically create a use case diagram.  I'm able to create a new diagram, and put the use case oval and all of the actors on it.

What's stumping me is that I can't figure out how to programmatically create the association between an actor and the use case oval.

I've got something like this:

IRPRelation theRelation =(IRPRelation) theActor.addNewAggr("AssociationEnd", "");


IRPLink link = thActor.addLinkToElement(theUseCase, theRelation,null,null);

It so doesn't work. After setting the other side of the relation (second line), if I look at it, it's still null.  In addition, when I try to create the link from the relation (third line), it throws a RhapsodyRuntimeException.

Has anyone ever created a link (based on an association relation) programatically?

  • BuddyRobbins
    18 Posts

    Re: Problem programmatically creating link

    ‏2013-12-13T14:39:01Z  in response to BuddyRobbins

    Found it.  I was using the wrong function to create the relation.

    theUseCase.addRelationTo(theActor, theActor.getName()+ theUseCase.getName(), ASSOCIATION,"1",theUseCase.getName()+ theActor.getName(),ASSOCIATION, "1", "");

    It's still throwing an exception trying to create a link, so I'm using the populate diagram method.