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

Where are the constants for the 'state' of a work item defin

I need to programmatically monitor when a work item has changed to a resolved state. For this I use
IWorkitem.getState2().getStringIdentifier()

The returned value, I need ot compare it with a constant for a resolved state. The value comes back as "3". I don;t want to hard-code a "3" in my code. Where are the constants defined so I could use them?

Thanks.

0 votes



4 answers

Permanent link
These values are configured in the process configuration and not fixed, you could use the following instead:

IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
IWorkflowInfo workflowInfo= workItemClient.findWorkflowInfo(workItem, monitor);
boolean isResolved= workflowInfo.getStateGroup(workItem.getState2()) == IWorkflowInfo.CLOSED_STATES;

HTH,

Christof
Jazz Work Item team

0 votes


Permanent link
Thanks Christof for the fast reply. That's exactly what I wanted to hear.

I am using this piece of code to get the IWorkflowInfo and is possibly similar to what you suggest.

IWorkflowInfo info = getWorkItemServer().findWorkflowInfo(workItem, new NullProgressMonitor());

and that works. This piece of code I realized is used elsewhere in our product. Do you see one approach better than the other?

Thanks.

Regards,
Ashish

0 votes


Permanent link
The two approaches are basically the same. Your snippet uses the server-side service which is the only option on the server and corresponds to what I posted for the client-side. (The method is actually coming from an interface IWorkItemCommon that is shared between client and server.)

Christof
Jazz Work Item team

0 votes


Permanent link
Thanks. That's good to know. I need this on the server side only.

Regards,
Ashish

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
× 10,929

Question asked: Aug 04 '08, 1:15 p.m.

Question was seen: 7,554 times

Last updated: Aug 04 '08, 1:15 p.m.

Confirmation Cancel Confirm