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

Programmatically resolving tracks/contributes links does not work

Hi,
I have problems getting linked work items (tracks/contributes) using the Java API. My code roughly looks like this:

// Resolve all work item references for the given item
IWorkItemReferences iWorkItemReferences = this.workItemClient.resolveWorkItemReferences(currentWorkItem, monitor);
// Find linked items of the given link type -> tracks/contributes
for (IEndPointDescriptor endPtDescriptor : this.linksToFollow) {
  List<IReference> wiReferencesTmp = iWorkItemReferences.getReferences(endPtDescriptor);
  if (wiReferencesTmp != null) {
    outgoingWIReferences.addAll(wiReferencesTmp);
  }
}
for (IReference iReference : outgoingWIReferences) {
  IWorkItem nextWorkItem = null;
  try {
    IWorkItemHandle wiHandle = null;
    Object resolve = iReference.resolve();

I can get all the work item reference objects. But when calling the resolve() method it always returns null.
The reference objects are URI references with this URI  format: https://....com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/9749

What I found out is that Location.locationFromAbsUri(URI) is called where the ItemHandle in the Location instance is set to null.

        IItemHandle itemHandle = null;
        IType type = null;
        if (isOidUri(relativeUri)) {
            itemHandle = itemOidUriToHandle(relativeUri);
            type = itemHandle.getItemType();
        }
        if (type == null) {
            type = relativeUriToType(relativeUri);
        }
Any Idea why it does not work?

0 votes

Comments

Using your referenced code helps. It works now.


But shouldn't the resolve() method do the job properly?


Accepted answer

Permanent link
Marko,

will the code in this post to turn the URI into a WorkItem handle help?
If you can send me the code to business mail I can look over it, but not before next Monday.

gg,
Arne
Marko Tomljenovic selected this answer as the correct answer

0 votes

Comments

Marko,

since you mentioned it works with the referenced code I converted my comment to answer. Could you please mark it as accepted?

Thanks,
Arne

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,952

Question asked: May 07 '15, 5:40 a.m.

Question was seen: 2,330 times

Last updated: May 12 '15, 3:53 p.m.

Confirmation Cancel Confirm