API for work items
I would like to know if there are the APIs for work items. For example, if I don't use Eclipse to query work items, can I use an API to do this ?
|
2 answers
Hi Dac Lan
I would like to know if there are the APIs for work items. For Yes, there are APIs for work items, queries etc.: Take a look at IWorkItemClient, IAuditableClient, IQueryClient (i.e the client libraries exposed by the work item component). The client libraries that expose those APIs are available from an ITeamRepository instance. In an non-OSGi Java app, you can start the team platform using the following code (I am guessing here as I haven't used this myself): TeamPlatform.startup(); ITeamRepositoryService service= TeamPlatform.getTeamRepositoryService(); ITeamRepository repository= service.getTeamRepository(...); ....log in IAuditableClient client= (IAuditableClient) repository.getClientLibrary(IAuditableClient.class); ....do something with IAuditableClient ....log out TeamPlatform.shutdown(); Here's an example of some query code (returning all work items of a project area) that I posted in another news thread: Assuming that you have a project area handle: IProjectAreaHandle projectArea= ... Access the client libraries: ITeamRepository repository= (ITeamRepository) projectArea.getOrigin(); IAuditableClient auditableClient= (IAuditableClient) repository.getClientLibrary(IAuditableClient.class); Create the query: WorkItemQueryModel model= WorkItemQueryModel.ROOT; IItemQuery query= IItemQuery.FACTORY.newInstance(model); IPredicate predicate= model.projectArea()._eq(query.newItemHandleArg()); query.filter(predicate); Execute the query: ItemQueryIterator<IWorkItemHandle> iterator= new ItemQueryIterator<IWorkItemHandle>(auditableClient, query, new Object[] { projectArea }); List<IWorkItem> workItems= auditableClient.resolveAuditables(iterator.toList(monitor), IWorkItem.SMALL_PROFILE, monitor); HTH, Patrick |
Hi Patrick,
How can I take a look at IWorkItemClient, IAuditableClient, IQueryClient ? Where can I see Javadoc for these classes ? Thanks a lot ! Hi Dac Lan I would like to know if there are the APIs for work items. For Yes, there are APIs for work items, queries etc.: Take a look at IWorkItemClient, IAuditableClient, IQueryClient (i.e the client libraries exposed by the work item component). The client libraries that expose those APIs are available from an ITeamRepository instance. In an non-OSGi Java app, you can start the team platform using the following code (I am guessing here as I haven't used this myself): TeamPlatform.startup(); ITeamRepositoryService service= TeamPlatform.getTeamRepositoryService(); ITeamRepository repository= service.getTeamRepository(...); ....log in IAuditableClient client= (IAuditableClient) repository.getClientLibrary(IAuditableClient.class); ....do something with IAuditableClient ....log out TeamPlatform.shutdown(); Here's an example of some query code (returning all work items of a project area) that I posted in another news thread: Assuming that you have a project area handle: IProjectAreaHandle projectArea= ... Access the client libraries: ITeamRepository repository= (ITeamRepository) projectArea.getOrigin(); IAuditableClient auditableClient= (IAuditableClient) repository.getClientLibrary(IAuditableClient.class); Create the query: WorkItemQueryModel model= WorkItemQueryModel.ROOT; IItemQuery query= IItemQuery.FACTORY.newInstance(model); IPredicate predicate= model.projectArea()._eq(query.newItemHandleArg()); query.filter(predicate); Execute the query: ItemQueryIterator<IWorkItemHandle> iterator= new ItemQueryIterator<IWorkItemHandle>(auditableClient, query, new Object[] { projectArea }); List<IWorkItem> workItems= auditableClient.resolveAuditables(iterator.toList(monitor), IWorkItem.SMALL_PROFILE, monitor); HTH, Patrick |
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.