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. |
4 answers
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 |
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 |
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 |
Thanks. That's good to know. I need this on the server side only.
Regards, Ashish |
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.