Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: Create File (IRPModule) elements from Rhapsody Java API
Topic Summary: How can File elements (Types, Variables, Functions) be created using the Rhapsody API
Created On: 8-Apr-2008 18:42
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 8-Apr-2008 18:42
User is offline View Users Profile Print this message


Galen Johney

Posts: 3
Joined: 28-Jan-2008

We are trying to use the Rhapsody API (Java) to create a "File" (IRPModule) and its associated elements (Type definitions, Variables, and Functions). We are able to create the File, but have not found a way to create the elements within the file.

Any suggestions or examples would be greatly appreciated.
Report this to a Moderator Report this to a Moderator
 9-Apr-2008 08:28
User is offline View Users Profile Print this message


Simon Morrish

Posts: 127
Joined: 17-May-2005

Hi Galen

In the past, when I've had trouble doing this kind of thing, I've found the addNewAggr method of IRPModelElement to be extremely useful. The help description for it is misleading. As far as I can tell, it allows you to add any valid type of model element within any other. E.g., in VBA:

Dim elem As RPModelElement
Set elem = getSelectedElement
elem.addNewAggr("Comment", "MyComment")

I haven't tested your specific case - I don't use the Java API - but this might help. Let us know how you get on!

best regards,
Simon

-------------------------
Simon Morrish
simon.morrish@eu.panasonic.com
http://panasonic.co.uk
Panasonic ideas for life
Report this to a Moderator Report this to a Moderator
 9-Apr-2008 15:17
User is offline View Users Profile Print this message


Galen Johney

Posts: 3
Joined: 28-Jan-2008

Hi Simon

Thanks for the suggestions, but the addNewAggr method didn't work for us either.
We experimentally found out how to create "File" (IRPModule) elements and add child elements:

Given a package instance myPackage (of type IRPPackage):

// Create an instance of a "File" element
IRPModule myFile = myPackage.addModule("MyFile")

// Get handle to myFile's implicit Class object
IRPClass myFileClass = myFile.getObjectAsObjectType()

// Now we can create elements within the class
// Variables get created as an "Attribute"
IRPAttribute myFileVar1 = myFileClass.addAttribute("Var1")

// functions get created as an operation
IRPOperation myFileFunc1 = myFileClass.addOperation("Func1")

// Types get created as a Type
IRPType myFileType1 = myFileClass.addType("Type1")

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That was the more direct method that we found. The other technique is that through the Rhapsody IDE, one can create an Object with the same types,attributes, and functions, then convert the Object into a "File". We haven't found out how to perform this operation through the API yet.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 1 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.