2

I'm trying to use Java api of Rhapsody. When I looked at the tutorial of the api, there is lots of different irp interfaces, also sometimes they have the same operations.. I could'nt make concrete. For example, I'm trying to reach interface package. I wrote the following code segment.

IRPApplication rpy=null;
IRPModelElement ele =null;
rpy= RhapsodyAppServer.getActiveRhapsodyApplication();

How can I reach the interfaces in Interface package and the operations in one interface class?

Thomas Uhrig
  • 30,811
  • 12
  • 60
  • 80

3 Answers3

1

This should help (there's a sample project at the end of the article)

Rhapsody Helpers

  • Answers only pointing to a link are generally unhelpful. Could you copy a relevant section of code so the answer stays on this site, just in case your link were to go down? – Pimgd Jul 18 '14 at 09:55
0
IRPProject project = rpy.activeProject();
IRPModelElement thatInterface = project.findNestedElementRecursive("[interface name]", "Interface");

if the interface is at the top level, you don't need Recursive, but it's not a bad idea to leave it in either way.

Centimane
  • 280
  • 5
  • 17
0

This is how you can find a package that contains the interface

IRPModelElement interfacePackage = project.findNestedElement("[package name]", "Package");

This is how you can find the interface in that package

IRPClass m_interface = (IRPClass)interfacePackage.findNestedElement(interfaceName, "Interface");