简体   繁体   中英

How to get History data of workitem using RTC Java API

Basically I want to read History of workitem to identify whether the workitem is being modified (I am aware that I can use modifiedDate to query records but it is not considering timestamp. Details How to get workitem based on modified date and time using RTC Java API )

It would be helpful if someone can share code to fetch history from RTC using Java API along with modified date of each history record, history record id if avaliable.

I got it:

    IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.FULL_PROFILE, monitor);
    System.out.println("Last modified date: "+workItem.modified()+"\n");

    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);
        Date recordModifiedDate = workItemPrevious.modified();
        System.out.println("Record modification date: "+recordModifiedDate);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM