It's all about the answers!

Ask a question

Is there any way to read the work item history using RTC Java API's?


Dashrath Kale (1542623) | asked Jun 15 '15, 6:54 a.m.
Hi

Does RTC JAVA API provides the functionality to read the work item history like , who has changed the 1) particular work item state 2) attribute and 3) the date/time when it has been changed for every change in the work item.

One answer



permanent link
Kevin Ramer (4.5k8180199) | answered Jun 15 '15, 7:57 a.m.
edited Jun 15 '15, 7:58 a.m.
Look at the methods for ItemManager in the API doc.   In particular the fetch methods.

very _sparse_ snippet:

         // workItem is a particular work item already fetched from repository
         IAuditableHandle auditableHandle = (IAuditableHandle) workItem.getItemHandle();
         IItemManager itemManager = repository().itemManager();
         ...
         handles = itemManager.fetchAllStateHandles( auditableHandle, null);
             List<IWorkItem> workItems = new ArrayList<IWorkItem>();
             
             workItems = itemManager.fetchCompleteStates(handles, null);

You can now iterate workItems and get the attributes you wish to examine, each of which is a historic view of the starting work item.



Comments
Dashrath Kale commented Jun 16 '15, 8:34 a.m.

Hi Kevin

Thanks for the solution. I tried but found that it is always giving the last state of the work item for every instance of the work item history but I need the copy of the work item for every time when the work item is saved.


Kevin Ramer commented Jun 16 '15, 11:20 a.m.

Not an expert on this, but history should represent a workitem when it was saved.  It makes no logical sense that an attribute change is recorded w/o the work item being saved, whether by clicking the Save button on a UI or calling the save() method of an editable work item in a user-written program.

Your answer


Register or to post your answer.