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

programmatically adding RELATED_ARTIFACT link doesn't work on client side

 I am attempting to add a RELATED_ARTIFACT link to a set of work items using the RTC Java Client APIs.  The same code (or almost the same code) works fine via a Server-side plugin.

However, when this runs, nothing is added, but no errors occur either.

It uses a WorkItemOperation, which then calls this:
private void addMyLink(WorkItemWorkingCopy workingCopy) throws TeamRepositoryException, URISyntaxException {
String URL = "http://<my_valid_url>";
IWorkItemClient _service = myRepository.getWorkItemClient();
IWorkItemReferences references = _service.resolveWorkItemReferences((IWorkItemHandle) workingCopy.getWorkItem().getItemHandle(), null); //this is basically the only line changed, since I need the workItemHandle, which my execute() method of the WorkItemOperation gets the workingCopy only
IURIReference reference = IReferenceFactory.INSTANCE.createReferenceFromURI(new URI(URL), "Current Template", "ODP Format");
references.add(WorkItemEndPoints.RELATED_ARTIFACT, reference);
//the save occurs just by dropping out of this since it is a WorkItemOperation, which differs from the Server-Side action which requires a call to save the work item.
}

Does anybody know offhand why this is not working?  As I mentioned, no errors and I can debug and actually get through that it is calling these, and looking at the "reference" variable looks okay also.

0 votes

Comments

Can you edit the workItem via the same plugin? (e.g change the description)

I have also managed to do this via server-side. Luckily though https://jazz.net/wiki/bin/view/Main/ProgrammaticLinkCreation this link here describes how you could do that via the client. It does look like you need to call

linkManager.saveLink(link, monitor);


Be the first one to answer this question!

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

Question asked: Jan 06 '15, 1:04 p.m.

Question was seen: 2,768 times

Last updated: Jan 06 '15, 2:45 p.m.

Confirmation Cancel Confirm