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

IReference to IWorkItem

Hi,

I have a reference of type IReference, from which I need to get the workitem (IWorkItem). Please provide you suggestion on this.


Thank you
Abhishek

0 votes



3 answers

Permanent link
You have to use IItemReference class

IReference source = ...

if(target.isItemReference()){
IItemReference itemRef = (IItemReference)target;
IItemHandle handle = itemRef.getReferencedItem();
if (handle instanceof IWorkItemHandle){
IWorkItemHandle wiHandle = (IWorkItemHandle)handle;
IWorkItem wi = (IWorkItem)items.fetchItem(wiHandle, monitor);
}
}


where items is an ItemProvider instance.

1 vote


Permanent link
Hi Abhishek,
yes, I was wrong with "source". It was "target".

For ItemProvider it depends on which side you are. On Client side you can use

ProviderFactory provider = (ProviderFactory)repo.getClientLibrary(ProviderFactory.class);
ItemProvider items = provider.getItemProvider();

On Server side use

ProviderFactory provider = getService(ProviderFactory.class)
ItemProvider items = provider.getItemProvider();

1 vote


Permanent link
Hi Michele,

Thanks for the quick reply. I have a couple of questions.

1) Is 'target' same as the source IReference ?
2) How can we get ItemProvider instance?

I appreciate your help on this.

You have to use IItemReference class

IReference source = ...

if(target.isItemReference()){
IItemReference itemRef = (IItemReference)target;
IItemHandle handle = itemRef.getReferencedItem();
if (handle instanceof IWorkItemHandle){
IWorkItemHandle wiHandle = (IWorkItemHandle)handle;
IWorkItem wi = (IWorkItem)items.fetchItem(wiHandle, monitor);
}
}


where items is an ItemProvider instance.

0 votes

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

Question asked: Jul 14 '09, 6:27 a.m.

Question was seen: 7,049 times

Last updated: Jul 14 '09, 6:27 a.m.

Confirmation Cancel Confirm