It's all about the answers!

Ask a question

Recommended way to obtain a work item given a work item numb


Michael Valenta (3.7k3) | asked Nov 19 '07, 2:48 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
I am working on a feature that extracts a work item number from some
text and I need to translate that into a work item. I got this to work
in the Eclipse client using a Location that contains the URI for a work
item as obtained from the work item editor. However, this approach does
not work on the server since it requires the use of the Item Manager
(and is rather round about in the first place). What is the recommended
way to fetch a work item given the work item number from both an Eclipse
client and from the server (i.e. a scheduled task)?

Michael

2 answers



permanent link
Andre Weinand (4811) | answered Nov 20 '07, 10:18 a.m.
Hi Michael,

The closest what we have today is the predefined query
WorkItemQueries.workItemById(...)
that returns a WorkItemHandle via an ItemQueryIterator.

This isn't the easiest API to use, but since it lives in common,
it is at least available both on the server and the client.

I've create enhancement request 37012 for providing a better API
within the M4 timeframe.

Cheers,
--andre


On 2007-11-19 20:41:14 +0100, Michael Valenta
<Michael_Valenta@ca.ibm.com> said:

I am working on a feature that extracts a work item number from some
text and I need to translate that into a work item. I got this to work
in the Eclipse client using a Location that contains the URI for a work
item as obtained from the work item editor. However, this approach does
not work on the server since it requires the use of the Item Manager
(and is rather round about in the first place). What is the recommended
way to fetch a work item given the work item number from both an
Eclipse client and from the server (i.e. a scheduled task)?

Michael

permanent link
Todd Lainhart (40611) | answered Nov 27 '07, 10:48 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Michael -

If you have a Location on the server, you can use the ILocationService
to resolve the location to an IItem.

However, if you only have the item number Andre's suggestion is the way
to go, rather than crafting by the URI by hand.

-- Todd

Michael Valenta wrote:
I am working on a feature that extracts a work item number from some
text and I need to translate that into a work item. I got this to work
in the Eclipse client using a Location that contains the URI for a work
item as obtained from the work item editor. However, this approach does
not work on the server since it requires the use of the Item Manager
(and is rather round about in the first place). What is the recommended
way to fetch a work item given the work item number from both an Eclipse
client and from the server (i.e. a scheduled task)?

Michael

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.