How can I read history from RTC workItem jazz

how can i read history from RTC workItem. I want to check some changes to an attribute and its value before and after the change history. Using the jazz API. how is it possible? Please help.

+3


source to share


2 answers


Attribute markup, you can see more at Working with Work Item Attributes "

If you have an attribute id available as a string, you can use this code to get the attribute.

IWorkItemClient workItemClient = (IWorkItemClient) fTeamRepository.getClientLibrary(IWorkItemClient.class);
IAttribute someAttribute= workItemClient.findAttribute(fProjectArea, "some_attribute_ID", monitor);

      



For history, this thread might help

you can use IItemManager.fetchCompleteState()

to get the complete item in its historical state.
If you want to get the full story, you can also get all the state handles at once using IItemManager.fetchAllStateHandles()

instead of walking through the story using IAuditable.getPredecessorState()

.

+1


source


Use the snippet below:



IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.FULL_PROFILE, monitor);

IItemManager itm = teamRepository.itemManager(); 
List history = itm.fetchAllStateHandles((IAuditableHandle) workItem.getStateHandle(), monitor);
System.out.println("Record history details:-");
for(int i = history.size() -1; i >= 0; i--){
    IAuditableHandle audit = (IAuditableHandle) history.get(i);
    IWorkItem workItemPrevious = (IWorkItem) teamRepository.itemManager().fetchCompleteState(audit,null);
    //Operations to be carried on workItemPrevious
}

      

0


source







All Articles