It's all about the answers!

Ask a question

How to get history of project area by JAVA API?


varathan anandaraj (85212) | asked Apr 25 '16, 9:25 a.m.
edited May 05 '16, 5:21 a.m.
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

}

2 answers



permanent link
Hakki Bozkurt (1631328) | answered Apr 26 '16, 4:38 a.m.
 Hi Varathan,

Maybe its help >>  questions/81391


Comments
varathan anandaraj commented Apr 26 '16, 6:12 a.m.

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


Ralph Schoon commented Apr 26 '16, 6:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


varathan anandaraj commented Apr 26 '16, 7:29 a.m.

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


1
Ralph Schoon commented Apr 26 '16, 7:43 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.









varathan anandaraj commented Apr 29 '16, 4:20 a.m.

Can you please provide the code with example ?


masoom Abdullah commented Sep 07 '17, 12:42 a.m. | edited Sep 07 '17, 4:47 p.m.

 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
Marie Michelin (14417) | answered Aug 29 '18, 8:50 a.m.

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

Your answer


Register or 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.