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?
Accepted answer
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
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
Comments
Marko Tomljenovic
May 07 '15, 10:17 a.m.Using your referenced code helps. It works now.