How can I get the list of the columns of a query using Plain API?
Hi, I've a shared query (an IQueryDescriptor) that I've obtained and used to get the result list (which is the list of work items returned by the query). I would like to know which are the field used in the query as output (the column list to be clear).
How can I obtain them? Thanks, Michele. |
2 answers
In the Eclipse client, the com.ibm.team.workitem.ide.ui.internal.queryeditor.QueryEditorInput has a getConfiguration() method to return com.ibm.team.workitem.ide.ui.internal.queryeditor.QueryEditorConfiguration which has methods like getColumnAttributes(), getDefaultColumns(), getDefaultSortOrder(). Maybe it could help you...
Cheers.
|
I found it. Here it is if someone else needs it.
Expression exp = queryDescriptor.getExpression(); if(exp instanceof Statement){ Statement statement = (Statement)exp; List<String> attributeIds = statement.getSelectClause().getColumnIdentifiers(); } Statement object has also the sorting clause. |
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.
Comments
in my execute shared query code, I supply the profile for the workitems.
see my code in the accepted answer here
https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes
private static void printResolved(IQueryClient queryClient,
IQueryDescriptor queryToRun,
how did u execute the query?
I did
IQueryResult<IResolvedResult<IWorkItem>> resolvedResults = queryClient
.getResolvedQueryResults(queryToRun, IWorkItem.FULL_PROFILE);
Sam, the question as I understand it is, how to get the output columns (and parameters) that are specified for the query to print them according to the query specification.
Yes, it is correct. I'm already using the full profile otherwise I would not be able to get the values. I'm ok with the query results as work item list, I'm trying to get the query configuration for the output.
yes, I understand what the question was..
I don't see that data in the query descriptor tho.. parameters is the filter for WHICH workitems, not the column contents.. t would make sense that there is a profile object saved with the query descriptor someplace.