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

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?

0 votes


Accepted answer

Permanent link
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

1 vote

Comments

"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?


One other answer

Permanent link
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.

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

Question asked: Sep 23 '08, 8:29 p.m.

Question was seen: 7,637 times

Last updated: Jun 14 '14, 6:15 a.m.

Confirmation Cancel Confirm