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

How to get history of project area by JAVA API?

How to get Project Area History from IAuditable interface ? My code like below  

List<IAuditableHandle> iAuditableHandles;

IAuditable iAuditable;

iAuditableHandles = itemManager.fetchAllStateHandles(projectArea.getPredecessorState(), nPMonitor);

for(IAuditableHandle iaHandle : iAuditableHandles)

{

iAuditable = itemManager.fetchCompleteState(iaHandle, nPMonitor);

// here I want to get history of project area , like which user added/removed scenario

}

0 votes



2 answers

Permanent link
 Hi Varathan,

Maybe its help >>  questions/81391

0 votes

Comments

No . above question discussion about Iteration history . Not project history . I tried same way , but no luck .

The project area history is the only place that contains the iteration creation and deletion information as far as I can tell. I would consider to really read the whole set of answers. A colleague used that approach and found what they where looking as far as I can tell.

I cross verified multiple times . IDevelopmentLine not return the history project . it is returning iteration Details

As Jared points out there are more objects involved here. I cite:

Key things to understand about the data we store and the history of that data: 1. There are three types of "items" involved here: project areas (IProjectArea), timelines (IDevelopmentLine), and iterations (IIteration). 2. All these items inherit from IAuditable, which inherits from IItem. 3. Every time an IAuditable is saved, it generates a new "state". 4. When you fetch an IAuditable from the repository, you get the current state. 5. IAuditable#getPredecessorState() will give you access to next oldest state. And that predecessor will have a pointer to the next predecessor once you fetch it
You want to do this on the IProjetArea and not on the iteration, obviously.








1 vote

Can you please provide the code with example ?

 Hi Varathan,


I am working on the same. Were you able to fetch the history of PA using java api.

Thanks in advance.

showing 5 of 6 show 1 more comments

Permanent link

Hello,

Just in case, I wrote a small code to do the job (to be improved of course!).
It is just to display the members of a project area, who made the last modification and what was the member list at this time.
So it does not display the diff, but the state in which the project area was (only from the member list point of view).

I don't display the date of modification too.

Assume you have the project area (IProjectArea type), a monitor (IProgressMonitor type), a repository (ITeamRepository type) and a listProjectAreaMembers function (to display the project area members) :

IContributorHandle modifierHandle = projectArea.getModifiedBy();
IContributor modifier = repository.itemManager().fetchCompleteItem(modifierHandle, IItemManager.REFRESH, monitor);

System.out.println(modifier.getUserId());

IAuditableHandle it = projectArea.getPredecessorState();

IProjectArea prevPA=projectArea;
while(it != null)
{
    System.out.println("Change made by : ");

prevPA = (IProjectArea)repository.itemManager().fetchCompleteState(it, monitor);

    modifierHandle = prevPA.getModifiedBy();
    modifier = repository.itemManager().fetchCompleteItem(modifierHandle, IItemManager.REFRESH, monitor);          
    System.out.println(modifier.getUserId());

listProjectAreaMembers(prevPA);

it = prevPA.getPredecessorState();

}

Once again it is not optimized code, and it is perfectible, but it is a start for people who would like to do the same (because in my case I have several users with the same name and different IDs and I would like to see exactly who modified the members list as it is not possible to see in the history in the web client).

Hope this could help!
Marie

0 votes

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

Question asked: Apr 25 '16, 9:25 a.m.

Question was seen: 2,717 times

Last updated: Aug 29 '18, 8:50 a.m.

Confirmation Cancel Confirm