It's all about the answers!

Ask a question

History of one versionable


Clemens Hübner (1122) | asked Apr 08 '16, 3:29 a.m.
Hi everybody,

I'm trying to get the history of one versionable in a component using the Java API, in detail I need the informations who changed the file when with what comment.
I'm getting lost in ChangeSet, HistoryEntry, etc. Can someone give me a hint for this?

Thank you!

One answer



permanent link
Morten Madsen (3053250) | answered May 15 '17, 12:08 p.m.

 Normally, when you request the history of one versionable, you would get an ChangeHistoryEntry[] entries (array).


You can then loop this, and get the information you need (repo is your :

ITeamRepository repo; // you should have this already
IAuditableClient audCli = (IAuditableClient) repo.getClientLibrary(IAuditableClient.class);
for (ChangeHistoryEntry changeEntry : entries)
{
  ICangeSetHandle csh = changeEntry.getChangeSet();
  IChangeSet cs = repo.itemManager().fetchCompleteItem(handle, ItemManager.DEFAULT, monitor);
  IContributorHandle conHdl = cs.getAuthor(); // this would get you the author. Only the handle though. You need to resolve it as below
  IContributor con = audCli.fetchCurrentAuditable(conHdl, .......... )
  cs.getLastChangeDate(); // get the change time stamp
  cs.getComment(); // get the comment
}


I hope this helps, else just ask again :).

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.