It's all about the answers!

Ask a question

API for work items


Dac Lan Khanh Nguyen (41186) | asked Jan 15 '08, 10:25 a.m.
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



permanent link
Patrick Streule (4.9k21) | answered Jan 15 '08, 11:28 a.m.
JAZZ DEVELOPER
Hi Dac Lan

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 ?

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

permanent link
Dac Lan Khanh Nguyen (41186) | answered Jan 15 '08, 2:49 p.m.
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
example, if I don't use Eclipse to query work items, can I use an API
to do this ?

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


Register or to post 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.