Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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 ?

0 votes



2 answers

Permanent link
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

0 votes


Permanent link
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

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jan 15 '08, 10:25 a.m.

Question was seen: 5,837 times

Last updated: Jan 15 '08, 10:25 a.m.

Confirmation Cancel Confirm