Relationship history of work items
regards..IAuditableHandle auditableHandle = (IAuditableHandle) workItem.getItemHandle(); IItemManager itemManager = teamRepository.itemManager(); IWorkItem historyWI = null;
List<IWorkItemHandle> handles = itemManager.fetchAllStateHandles(auditableHandle, null);
List<IWorkItem> workItems = new ArrayList<IWorkItem>();
workItems = itemManager.fetchCompleteStates(handles, null);
Collections.reverse(workItems);
if (!workItems.isEmpty()) {
for (Iterator<?> iterator = workItems.iterator(); iterator.hasNext();) {
historyWI = (IWorkItem) iterator.next();
System.out.print(historyWI.modified() + " - ");
System.out.print(historyWI.getModifiedBy().getItemId() + " - ");
System.out.println("\t");
}
}</pre> <div> </div>
Accepted answer
I have no example code.....
In theory, as far as I can tell, IWorkItems implement IAudible which allows you to iterate the history. Each state can have at most two predecessors. By fetching all states, I think you get all the historic versions - not sure though.
You can try to search how the history presentation does this or search the API for examples in general. If you have your environment not set up with the SDK, I would suggest you do, because otherwise you waste your time. See https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ for how to.
As mentioned in the posts in the above link, there are very few getters on a work item. You need to access e.g. the attributes.
References are however not attributes and you might need to use the link API to get them e.g. https://rsjazz.wordpress.com/?s=link+api
https://www.google.com/search?q=fetchAllStateHandles+site:jazz.net shows questions and links that deal with similar topics, so you might want to check them.
Comments
Sorry, I always wanted to publish something along those lines, unfortunately I have no time and no opportunity to dig into it at the moment. No fun time for me unfortunately. 8D
See my answer here: https://jazz.net/forum/questions/242495/how-to-retrieve-work-item-link-history-with-java-plain-api/246235 for details where to look how that works.
Hello Ralph,
Comments
Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 23 '17, 4:07 p.m.What do you mean by "include/exclude information"?
Lucas Pascoal
Oct 24 '17, 8:44 a.m.