workitem getOwner
For example I got a code like this: (this code does not work, it is not returning a string)
public String getOwner(IWorkItem workItem) {
return workItem.getOwner();
}
So I want the content of the owner-attribute (= string) for a given workitem.
getOwner() returns a IContributorHandle. But what can I do with this handle?
public String getOwner(IWorkItem workItem) {
return workItem.getOwner();
}
getOwner() returns a IContributorHandle. But what can I do with this handle?
Accepted answer
Something like this should work:
IContributorHandle conHandle = wi.getOwner();
ITeamRepository repo = (ITeamRepository) conHandle.getOrigin();
IContributor contrib = (IContributor) repo.itemManager()
.fetchCompleteItem(conHandle, IItemManager.DEFAULT, null);
contrib.getName();
contrib.getUserId();
One other answer
Something like this should work:
IContributorHandle conHandle = wi.getOwner();
ITeamRepository repo = (ITeamRepository) conHandle.getOrigin();
IContributor contrib = (IContributor) repo.itemManager()
.fetchCompleteItem(conHandle, IItemManager.DEFAULT, null);
contrib.getName();
contrib.getUserId();
That works perfectly although I used IContributorHandle[] contributors = projectArea.getMembers(); to get the list of members then looped through them using them as the conHandle to find the user I wanted form those in the project area, words cannot describe how useful this was.