In the RTC Java-API, how do I retrieve the "date added" property of a changeset to a workspace?
Accepted answer
With the client api you can retrieve the date added with using IWorkspaceConnection class.
Finally you get objects from type IChangeHistoryEntryChange. On this objects you can get the date added with invoke the creationDate() method.
IWorkspaceConnection stream = findWorkspace(repositoryWorkspaceName); List<IComponentHandle> components = stream .getComponents();
for (IComponentHandle componentHandle : components) {
IChangeHistory changeHistory = stream .changeHistory(componentHandle);
IComponent component = (IComponent) repository.itemManager().fetchCompleteItem(componentHandle,
IItemManager.REFRESH, null);
System.out.println("Component: " + component.getName());
System.out.println("==========================================================");
List<IChangeHistoryEntryChange> historyEntries = changeHistory.recent(monitor);
System.out.println("Comment" + " \t" + "Date Creaded" + " \t" + "Added By" + " \t" + "Date Added");
for (IChangeHistoryEntryChange changeHistoryEntry : historyEntries) {
IChangeSet changeSet = (IChangeSet) repository.itemManager().fetchCompleteItem(
changeHistoryEntry.changeSet(), IItemManager.REFRESH, null);
IContributor user = (IContributor) repository.itemManager().fetchCompleteItem(
changeHistoryEntry.createdBy(), IItemManager.REFRESH, null);
System.out.println(changeSet.getComment() + " \t" + changeSet.getLastChangeDate() + " \t" + user.getName()
+ " \t" + changeHistoryEntry.creationDate());
}
}