IReference to IWorkItem
3 answers
You have to use IItemReference class
where items is an ItemProvider instance.
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.
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();
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();
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.
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.