Troubleshooting
Problem
When using the deleteOSLCLink() method in the COM API to delete a set of established OSLC trace links from Rhapsody model elements to DOORS objects, you do not receive any compile or runtime errors. However, the links remain after code is run.
Resolving The Problem
The following java script should used:
IRPRequirement req = (IRPRequirement)app.getSelectedElement(); // or any other way to get the remote requirement
IRPCollection refs = req.getReferences();
int numberOfRef = refs.getCount();
for(int i = 1; i < numberOfRef+1 ; i++)
{
IRPModelElement ref = (IRPModelElement)refs.getItem(i);
if (ref instanceof IRPDependency)
{
IRPDependency dependency = (IRPDependency)ref;
IRPModelElement element = dependency.getDependent();
element.deleteOSLCLink(IRPModelElement.OSLCLink.Types.TRACE, dependency.getRemoteURI());
}
}
element.deleteOSLCLink - deleteOSLCLink should be called form link model element owener
IRPModelElement.OSLCLink.Types.TRACE - You should use predefined typs (= type URI)
dependency.getRemoteURI() - req..getRemoteURI() can also be used (getRmmUrl() is the AM URI of model elements, which for OSLC link it is empty as they are considered as external model data).
Calling element.deleteOSLCLink("*","*") works but it deletes only single link on each call.
A defect (PH17234) has been submitted for this last issue:
https://jazz.net/jazz04/web/projects/Design%20Management#action=com.ibm.team.workitem.viewWorkItem&id=71542
Document Location
Worldwide
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
ibm11119207