IBM Support

How to find unresolved elements in the model using Java-API

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":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5.1.1;7.5.1","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21426648