It's all about the answers!

Ask a question

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


Ashish Mathur (12174) | asked Aug 04 '08, 1:15 p.m.
JAZZ DEVELOPER
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.

4 answers



permanent link
Christof Marti (681) | answered Aug 05 '08, 2:31 a.m.
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

permanent link
Ashish Mathur (12174) | answered Aug 05 '08, 2:51 a.m.
JAZZ DEVELOPER
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

permanent link
Christof Marti (681) | answered Aug 06 '08, 3:20 a.m.
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

permanent link
Ashish Mathur (12174) | answered Aug 06 '08, 9:24 p.m.
JAZZ DEVELOPER
Thanks. That's good to know. I need this on the server side only.

Regards,
Ashish

Your answer


Register or to post your answer.