Question & Answer
Question
How do you find unresolved elements in the model using Java-API in IBM Rational Rhapsody?
Answer
Unresolved Elements are elements that are not present in the model but have references in other parts of the model.
Using Java API in Rational Rhapsody, you can find if a model element is unresolved or not.
The API to use is getIsUnresolved() which returns '1' if the element is unresolved and '0' if not.
For instance, you may have a reference to an event unresolved in a Sequence Diagram because the event is not present in the model. The below code iterates over all events in the selected package prints the ones that is found unresolved.
IRPApplication app = RhapsodyAppServer.getActiveRhapsodyApplication();
IRPPackage pkg = (IRPPackage)app.getSelectedElement();
for(Object o: pkg.getEvents().toList())
{
IRPEvent evt = (IRPEvent)o;
if(evt.getIsUnresolved()==1)
System.out.println("Event :" + evt.getName());
}
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21426648