It's all about the answers!

Ask a question

JavaPlainApi get workItem references from workItemCopy is always null

Fran Burgos (12312352) | asked Oct 18 '17, 8:48 a.m.

I'm developing a RTC Client with the Java Plain API 4.0.1. The client gets a WorkItem by Id and then it uses a WorkItemOperation for getting the current references and performing some modifications but the workitem references are always null although I can see the WI has links to other WIs on the web browser. ¿What else is needed for getting de references?

private static class WorkItemReferencesModification extends WorkItemOperation {

private IWorkItemHandle fOpposite;

public WorkItemReferencesModification() {
    super("Modifying Work Item References",IWorkItem.FULL_PROFILE);

protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException {
    IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes2.CUSTOM_LINK).getTargetEndPointDescriptor();
    workingCopy.getReferences().getReferences(endpoint); // THIS IS ALWAYS NULL!!!

2 answers

permanent link
Ralph Schoon (63.2k33646) | answered Oct 18 '17, 9:46 a.m.

permanent link
Fran Burgos (12312352) | answered Oct 18 '17, 10:09 a.m.

Hi Ralph, actually I read both articles and on other RTC 5.0.2 I have a client where this works right. But on this RTC 4.0.1 references come empty. I used your method analyzeReferences(IWorkItemReferences references) but on List endpoints = references.getTypes(); does not return any type.

In addition I tried force resolving references from WorkItem getting from WorkItemCopy with:

IWorkItemCommon common= (IWorkItemCommon) ((ITeamRepository)workItem.getOrigin()).getClientLibrary(IWorkItemCommon.class);
IWorkItemReferences references = common.resolveWorkItemReferences(workItem, null);
Maybe if I use IQueryResult the references could come resolved.

Your answer

Register or 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.