Work with Query Results in RTC (Java API client side)
IBM RTC 5.0.2 (client side)
IQueryDescriptor query = findPersonalQuery(pa, queryName, mon); //function for find queryDescriptor by name
if (query != null) { //query_find!
IWorkItemClient workItemClient = (IWorkItemClient) repo.getClientLibrary(IWorkItemClient.class);
IQueryClient queryClient = workItemClient.getQueryClient();
IQueryResult unresolvedResults = queryClient.getQueryResults(query);
if (unresolvedResults != null) { //query_OK
long total = unresolvedResults.getTotalSize(mon);
long pages = (total % 256);
long curPage = 0;
ResultSize resultSize = unresolvedResults.getResultSize(mon);
IAuditableCommon auditableCommon = (IAuditableCommon) repo.getClientLibrary(IAuditableCommon.class);
while (unresolvedResults.hasNext(mon)) { //GO_to_results_in_page
IResult result = (IResult) unresolvedResults.next(mon);
IWorkItem workItem = auditableCommon.resolveAuditable((IAuditableHandle) result.getItem(), IWorkItem.FULL_PROFILE, mon);
// get custom text attribute
String val = getCustomAttributeValueByIdentifierAsString(workItem, repo, "custom.field.identifer.txt", mon, true);
} //GO_to_results_in_page
} //query_OK
else System.out.println("INFO : no results!");
} //query_find!
else System.out.println("ERROR : query \"" + queryName + "\" not found!!!");
=======================================================================================
I try use IWorkItem.SMALL_PROFILE but it did'n get some performance.
One answer
You can only use the API as it is. You can get the result resolved or unresolved. If you want to get at attribute data you have to finally resolve the work item. You can get resolved results and you can use resolve for multiple work items that might perform faster, but ultimately the best way to use a query is to NOT get all work items back but only a subset defined by the conditions.