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

Relationship history of work items

 

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

</pre>
<div>
</div>

regards..

0 votes

Comments

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

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

 

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

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

0 votes

Comments

 

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.

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

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 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
× 10,936
× 67
× 49

Question asked: Oct 23 '17, 6:47 a.m.

Question was seen: 2,206 times

Last updated: Jan 03, 5:17 a.m.

Confirmation Cancel Confirm