Search code examples
javaoslcpolarion

Remove OSLC link using Polarion API in Java


I am working on a Polarion Adapter in order to be able to communcate Polarion with other tools. My connector is based on OSLC standard, Polarion is not fully OSLC standard compliant, so i need to use its Java API.

My problem using this API is that i can't remove a OSLC link. I had no problem creating them through the TrackerWebService, but there is not any method to do the opposite. Looking the doc pages i found an interface with removeLinkedOslcResource method but no class that implemets this interface.


Solution

  • Polarion does indeed not cover the complete OSLC specs. It only provides/consumes delegateUI capabilities to allow end-users to create links. So, in most cases, link removal is also done via the end-user GUI.

    But it should be possible to remove links programmatically. The IWorkItem interface (https://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/tracker/model/IWorkItem.html) does implement the needed method removeLinkedOslcResource.

    So, if you have a workItem instance, you can simply call workItem.removeLinkedOslcResource(arg0, arg1)

    In many cases, I normally end up with an IPObject instance, so you have to do some casting first. Something like:

    IWorkItem workItem = (IWorkItem) pObject;
    workItem.removeLinkedOslcResource(theURi, theRole)