How to get and update the status of the work item via Java API?
IWorkItem workItem .....;
IWorkItemHandle handle = (IWorkItemHandle) workItem.getItemHandle();
IWorkItemWorkingCopyManager wcm = workItemClient
.getWorkItemWorkingCopyManager();
wcm.connect(handle, IWorkItem.FULL_PROFILE, null);
WorkItemWorkingCopy wc = wcm.getWorkingCopy(handle);
IWorkItem copiedWorkItem = wc.getWorkItem();
IAttribute statusAttribute= workItemClient.findAttribute(projectArea, IWorkItem.STATE_PROPERTY, monitor);
IWorkflowInfo workflowInfo = workItemClient.findWorkflowInfo(copiedWorkItem, monitor);
String currentStatus = workflowInfo.getStateName(copiedWorkItem.getState2()); // I have gotten the current status of the work item.
Now I want to change the status but failed via either of the following two ways.
Way 1:
wc.setWorkflowAction("In Progress");
Way 2:
Identifier <IState> [] allStatus = workflowInfo.getAllStateIds();
copiedWorkItem.setState2(allStatus[2]);
Seems I used the right API but the status was not changed on RTC.
One answer
There is blog article written by our colleague.
http://rsjazz.wordpress.com/2012/11/26/manipulating-work-item-states/
There is a sample code in the middle of the blog entry. I recommend to subscribe this blog as we will get notification of sample codes !
http://rsjazz.wordpress.com/2012/11/26/manipulating-work-item-states/
There is a sample code in the middle of the blog entry. I recommend to subscribe this blog as we will get notification of sample codes !
Comments
Takehiko Amano
JAZZ DEVELOPER Mar 12 '13, 1:14 a.m.