Search code examples
javarhapsody

IBM Rhapsody Java API - Get every element in a project


I'm currently trying to find or make a function to get every item in a Rhapsody project, meaning the nested elements of the project and the nested elements of those elements, etc.

Is there an easy way to do this? And with easy I don't mean a looped function continually using the getNestedElements() function ;)


Solution

  • there is method called selected_el.getNestedElementsByMetaClass(ClassType, 0/1) that will return all the elements of that MetaClass recursively based on 0/1 which is the second argument

    ClassType is either Class, Port, Package -- find out the ClassType you are looking for

    Alternatively there is myPrj.findNestedElementRecursive( name, metaClass) for example myPrj.findNestedElementRecursive( namedPkg, "Package") will find a Package under the 'myPrj' project that has a name that matches the value of the 'namedPkg' variable.

    The Rhapsody Java API can be found here.