Plain Java API to display all the work Item type??
Hi,
I am trying to display the Id of all the work Item I mean everything (resolved ,archived ...)
Some how i am not getting the complete list I am missing the defect which I created and and in a status new
The code which I am using is
IProgressMonitor progressMonitor = new NullProgressMonitor();
IAuditableClient auditableClient = (IAuditableClient)teamRepository.getClientLibrary(IAuditableClient.class);
IQueryClient queryClient = (IQueryClient) teamRepository.getClientLibrary(IQueryClient.class);
IQueryableAttribute attribute=QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea,IWorkItem.PROJECT_AREA_PROPERTY, auditableClient, null);
Expression expression = new AttributeExpression(attribute, AttributeOperation.EQUALS, projectArea);
IQueryResult<IResolvedResult<IWorkItem>> results = queryClient.getResolvedExpressionResults(projectArea, expression, IWorkItem.FULL_PROFILE);
while(results.hasNext(progressMonitor)){
IWorkItem workItem= results.next(progressMonitor).getItem();
int workItemID=workItem.getId();
System.out.println(workItemID+" "+workItem.getWorkItemType());
}
Any kind of help is appreciated
Thanks
I am trying to display the Id of all the work Item I mean everything (resolved ,archived ...)
Some how i am not getting the complete list I am missing the defect which I created and and in a status new
The code which I am using is
IProgressMonitor progressMonitor = new NullProgressMonitor();
IAuditableClient auditableClient = (IAuditableClient)teamRepository.getClientLibrary(IAuditableClient.class);
IQueryClient queryClient = (IQueryClient) teamRepository.getClientLibrary(IQueryClient.class);
IQueryableAttribute attribute=QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea,IWorkItem.PROJECT_AREA_PROPERTY, auditableClient, null);
Expression expression = new AttributeExpression(attribute, AttributeOperation.EQUALS, projectArea);
IQueryResult<IResolvedResult<IWorkItem>> results = queryClient.getResolvedExpressionResults(projectArea, expression, IWorkItem.FULL_PROFILE);
while(results.hasNext(progressMonitor)){
IWorkItem workItem= results.next(progressMonitor).getItem();
int workItemID=workItem.getId();
System.out.println(workItemID+" "+workItem.getWorkItemType());
}
Any kind of help is appreciated
Thanks
Accepted answer
IProgressMonitor progressMonitor = new NullProgressMonitor();
ItemProfile<IWorkItem> arg1 = IWorkItem.FULL_PROFILE;
IWorkItem foundId = workItemClient.findWorkItemById(ticketId, arg1, progressMonitor);
This solves the issue.
Problem with my precious code was in RTC by default the Maximum Query Result Set Size was set to 1000 so I was not getting all the work Item I was only getting 1000 work Items
ItemProfile<IWorkItem> arg1 = IWorkItem.FULL_PROFILE;
IWorkItem foundId = workItemClient.findWorkItemById(ticketId, arg1, progressMonitor);
This solves the issue.
Problem with my precious code was in RTC by default the Maximum Query Result Set Size was set to 1000 so I was not getting all the work Item I was only getting 1000 work Items
3 other answers
For how to avoid the limit see https://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/
https://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/ and for load profiles see