How can I get the defect owner name?
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.
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
You can get the IContributor by using the IItemManager's fetchCompleteItem method. You get the IItemManager from the ITeamRepository, eg:
Once you've got the IContributor, you can just use the getName() and getEmailAddress() methods to get the attributes you're looking for.
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.
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'?
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
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
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!