![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
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 |
![]() |
![]()
|
![]() |
|
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. |
|
![]() |
|
![]() |
|
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: 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 |
|
![]() |
|
![]() |
|
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. |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.