It's all about the answers!

Ask a question

How can I get the defect owner name?


Rui Shen (51103) | asked Apr 22 '09, 4:32 a.m.
What I want to do is executing a query and get some defects and get their bug owner names and user ids (E-mail address). Now I can make the query work and get a IQueryResult object and iterate it and get IResolvedResult object, then I call the getOwner method to get a IContributorHandle object. How should I go forward to get a IContributor object and retrieve the contributor's attributes(including user name, user id and others)?

I cannot find Javadoc for the Java client library, so I don't what I should do to get this done, please help, thanks.

4 answers



permanent link
Peter Cogill (6) | answered Apr 23 '09, 1:31 a.m.
You can get the IContributor by using the IItemManager's fetchCompleteItem method. You get the IItemManager from the ITeamRepository, eg:

ITeamRepository repository = login(monitor); // login actually connects, etc.

IItemManager itemManager = repository.itemManager();
// Use your query to get an IContributorHandler contribHandle
IContributor contrib = (IContributor) itemManager.fetchCompleteItem(contribHandle, IItemManager.DEFAULT, monitor);


Once you've got the IContributor, you can just use the getName() and getEmailAddress() methods to get the attributes you're looking for.

permanent link
Rui Shen (51103) | answered Apr 23 '09, 2:31 a.m.
Thanks. How about the defect severity and priority? The method getSeverity() and getPriority() of IWorkItem returns Identifier object. And from this object, I only can get the select option value like 'literal.0' using the method getStringIdentifier(). How can I get its corresponding display text like 'Sev3'?

permanent link
Marcel Bihr, Jazz Work Item team (1.4k) | answered Apr 27 '09, 6:10 a.m.
JAZZ DEVELOPER
Hi
For the enumeration, use the IWorkItemClient library . The method 'resolveEnumeration' will give you an IEnumeration where you can use the findEnumerationLiteral method with the identifier from the work item to retrieve the ILiteral. ILiteral has a getName method.

Regards

Marcel
Jazz Work Item team

permanent link
Rui Shen (51103) | answered Apr 28 '09, 4:56 a.m.
Hi
For the enumeration, use the IWorkItemClient library . The method 'resolveEnumeration' will give you an IEnumeration where you can use the findEnumerationLiteral method with the identifier from the work item to retrieve the ILiteral. ILiteral has a getName method.

Regards

Marcel
Jazz Work Item team


Thank you very much for your help!

Your answer


Register or to post your answer.