Need Java api calls for listing and executing Queries
![]()
Hi all,
I have a requirement where I need to show the list of pre-defined queries and my queries created in RTC 3.0 in my Java client code. Also, I need to execute those queries and display the results. Can anyone provide me with sample code for doing this? Thanks, Sumana Bhat |
8 answers
![]()
You have to use IQueryService, IQueryClient or IQueryCommon (it depends on what kind of use do you need). Then you can use, for example
IQueryCommon.findPersonalQueries IQueryCommon.findSharedQueries in order to get queries and than IQueryCommon.getQueryResults(query) to get results. Best regards, Michele. |
![]()
So now i got it and I want to share the results here.
The Queryclient is initialzied like this IWorkItemClient Client = (IWorkItemClient) this.teamRepository.getClientLibrary(IWorkItemClient.class); The query I search is shared within my Projectarea. It could also be a Team. Or both i think. List<IProjectAreaHandle> sharingTargets = new ArrayList<IProjectAreaHandle>(); The project is from type IProjectArea sharingTargets.add(Project.getProjectArea()); The method call for the SharedQueries List<IQueryDescriptor> SharedQueries = QueryClient.findSharedQueries(Project.getProjectArea(), sharingTargets, QueryTypes.WORK_ITEM_QUERY, QueryDescriptor.FULL_PROFILE, monitor);The method call for your personal "My Queries"
|
![]()
I don't know how to do it exactly, but there is no simple 'api'... there are a bunch of methods on objects as this is an Object Oriented system..
you will have to connect to the repository and then use the IQuery interface classes to get and manage queries see com.ibm.team.repository.common.query in the javadoc provided with 3.0.1.1. you will need some of com.ibm.team.repository.client and common to do that.. Sam |
![]() You have to use IQueryService, IQueryClient or IQueryCommon (it depends on what kind of use do you need). Then you can use, for example Hi Michele, Do you know what value I should be passing in as the QueryType to those method calls? I have been trying to use them and I keep getting back empty lists.
Regards, Adam |
![]()
I'm at the same point like you. Did you already find out which value you have to pass for QueryType?
Regards, Tobias |
![]()
In many cases, the only answers are to read the source code.
Sam |
![]()
Ralph Schoon (62.0k●3●36●43)
| answered Feb 11 '13, 4:08 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This post shows working code it especially allows you to exceed the query result set size limit. https://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/
|