It's all about the answers!

Ask a question

workitem getOwner


Jens Kordowski (3651) | asked Sep 23 '08, 8:29 p.m.
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?

Accepted answer


permanent link
Pat McCarthy (12152) | answered Sep 24 '08, 1:38 a.m.
JAZZ DEVELOPER
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();
Ralph Schoon selected this answer as the correct answer

Comments
Albert Yao commented Jun 14 '14, 6:04 a.m.

"ITeamRepository"  is the object of client side.

When I develop a plug-in/advisor in the server side, it will always be "null".
What should I do in the server side?


Ralph Schoon commented Jun 14 '14, 6:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

One other answer



permanent link
Laurence Caraccio (9166) | answered Aug 24 '11, 9:11 a.m.
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.

Your answer


Register or to post your answer.