Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to delete link associated as related change request to a workitem?

Hi,
I had linked a Related Change Request to my workitem and the link is perfectly visible. But now I want to programmatically delete the link thus created on triggering some event. I am unable to find any programmatic way to delete the link created after linking Related Change Request to a workitem. Can someone please help me with the problem.
Thanks in advance.

1 vote



One answer

Permanent link
Hi Bhushan,

Please try following method.

public void removeLinks(IWorkItem source, IWorkItem target, IProgressMonitor monitor)
            throws TeamRepositoryException {
        IWorkItemClient workItemClient = (IWorkItemClient) ((ITeamRepository) source
                .getOrigin()).getClientLibrary(IWorkItemClient.class);
        IWorkItemWorkingCopyManager copyManager = workItemClient
                .getWorkItemWorkingCopyManager();
        URI sourceURI = ItemURI.createWorkItemURI(
                workItemClient.getAuditableCommon(), source.getId());
        URI targetURI = ItemURI.createWorkItemURI(
                workItemClient.getAuditableCommon(), target.getId());
        IReference referenceTarget = IReferenceFactory.INSTANCE
                .createReferenceFromURI(targetURI);
       
       
        WorkItemWorkingCopy workingCopySource=copyManager.getWorkingCopy(source);
        workingCopySource.getReferences().remove(referenceTarget);
        workingCopySource.save(monitor);

    }


Kindly acknowledge the result.

1 vote

Comments

Hi Ajay,
Thanks for your answer and really appreciate such a quick response. Apologies for asking programmatic way of doing the thing. I was just wondering can we do the same using web based rest client (like that of Mozilla Rest Client) by firing some delete query to workitem for deleting link? 

Hi Bhushan and Ajay,
As per my understanding bushan is looking for removing the relatedChangeRequest from the workitem using the OSLC REST Services.
I am also interested to see how can we do the same using the OSLC REST API in RTC.
Thanks,
Rahul

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 1,700
× 383
× 382

Question asked: Aug 27 '14, 6:28 a.m.

Question was seen: 4,788 times

Last updated: Sep 12 '14, 6:15 a.m.

Confirmation Cancel Confirm