Zurück zu Willert.de

Link creation using Java API

how to access or perform things by using the Rhapsody API (not how to use the UI)

Link creation using Java API

Postby manpe » September 30th, 2011, 4:05 pm


I am desperately trying to create a link object between two ports.
I have a class "ClassA" and its part "itsClassB" or type "ClassB". The port "PortA" is on the class "ClassA" and the port "PortB" is on the class "ClassB".
When I create a link on the diagram it looks more or less like this:
ClassA --- PortA <--- Link --> PortB --- itsClassB

The properties of the link created under "ClassA" in the browser are:
End1: itsClassB
ViaPort: PortB
End2: ClassA
ViaPort: PortA

This induces the correct code generation in the "initRelations()" method of "ClassA":
Code: Select all

I have tried in so many ways the "IRPLink com.telelogic.rhapsody.core.IRPPackage.addLink(IRPInstance fromPart, IRPInstance toPart, IRPRelation assoc, IRPPort fromPort, IRPPort toPort)" method to get the same result through the API but I did not get to the bottom of it.

I managed to create a Link between "ClassA" and "ClassB" in the same package where "ClassA" exists, with the following properties:
End1: ClassB
ViaPort: PortB
End2: ClassA
ViaPort: PortA

I have "ClassB" instead of "itsClassB" for End1. The problem in my eyes is that in the meta model the "part" which is "itsClassB" does not have a port under it. The port is located under the class "ClassB", but this is a Rhapsody constraint one cannot workaround.

Any help would be highly appreciated.

Thanks in advance!
Posts: 2
Joined: June 16th, 2011, 2:31 pm

Return to Rhapsody API

Who is online

Users browsing this forum: No registered users and 3 guests