It's all about the answers!

Ask a question

Relationship history of work items


Lucas Pascoal (132) | asked Oct 23 '17, 6:47 a.m.
edited Oct 23 '17, 6:49 a.m.

 

Hi, I am trying to retrieve the include / exclude information from the work item relationship in the history, but I can not find the object that contains this attribute .. can anyone help me? I am using the code below:

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");
        
  }
        
}
        
regards..


Comments
Geoffrey Clemm commented Oct 23 '17, 4:06 p.m. | edited Oct 23 '17, 4:07 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

What do you mean by "include/exclude information"?

Is this some custom work item relation that you have defined?


Lucas Pascoal commented Oct 24 '17, 8:28 a.m. | edited Oct 24 '17, 8:44 a.m.

 

Sorry, I'm not being very clear .. I would like to retrieve from the history of the work item what has been added or removed from relationships (parent, child, related, mentioned .. etc) .. I'm working with the default links ..

Accepted answer


permanent link
Ralph Schoon (56.5k23642) | answered Oct 24 '17, 8:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 24 '17, 8:43 a.m.

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.

Lucas Pascoal selected this answer as the correct answer

Comments
Lucas Pascoal commented Oct 24 '17, 11:55 a.m.

 

hello Ralph, Unfortunately, I've already been through most of the submitted content and could not find a solution. I can see the default attribute updates, but I can not see the link updates. Thanks.


Ralph Schoon commented Oct 25 '17, 2:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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


Ralph Schoon commented Oct 27 '17, 6:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Lucas Pascoal commented Nov 06 '17, 1:57 p.m.

Hello Ralph, 

 I've seen your answer, but I still can not evolve with this information .. 
Can you help me with a snippet of code? 
Thanks a lot for the help.

Your answer


Register or to post your answer.