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

How to read Work Item history from RTC using java APIs?

Dears,
          I am able to read comments and some history items.
But i need i need to read changes in fields values that appears in histroy like the following:

Owned By XYZ  →  ABC
System    EAI  →  Siebel Dev

appreciate your help

Thanks

1

0 votes



2 answers

Permanent link
This can be done using the repository ItemManager something like the following:


         // workItem is of type IWorkItem
         // repository is of type ITeamRepository
        IAuditableHandle auditableHandle = (IAuditableHandle) workItem.getItemHandle();
         IItemManager itemManager = repository.itemManager();
         
         List<IWorkItemHandle> handles;

        try {
             handles = itemManager.fetchAllStateHandles( auditableHandle, null);
             List<IWorkItem> workItems = new ArrayList<IWorkItem>();
             
             workItems = itemManager.fetchCompleteStates(handles, null);

workItems will contain the history records of the work item ( basically a copy of the prior history state of the work item)
The hard part is the rooting through the list to note the changes you have interest in.     Look at the API doc for the named classes / methods.

0 votes

Comments

Hello,
Do you think that a method is available to compare the current version of a workitem and an old version ?
In fact, with your example, I can go back to an old state but I haven't got the list of modifications
Thanks for your help
Mathieu

YOU Have to compare the two states to see the differences.


Permanent link
 I don't know if there's something better but you may get inspiration looking at class ChangePresentation (from com.ibm.team.workitem.service.internal.save.notify.ChangePresentation) where changes of attributes are found using a sorted attribute list (buildSortedAttributeList) and then comparing the values of the attributes in history,

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
× 369
× 169
× 67

Question asked: Nov 30 '15, 4:30 a.m.

Question was seen: 4,536 times

Last updated: Jul 17 '16, 8:52 a.m.

Confirmation Cancel Confirm