How to get OperationHistory of the stream programmatically using RTC api?
Thanks in advance!!
Accepted answer
parms.workspaceId = uuidOfStream;
parms.includeDetails = false; // We don't care about all the details, only the time really....
parms.maxResultSize = 1; // We just need the most recent operation entry
IScmRichClientRestService scmService = (IScmRichClientRestService) ((IClientLibraryContext) repository).getServiceInterface(IScmRichClientRestService.class);
ScmWorkspaceHistory workspaceHistory = scmService.postGetWorkspaceHistory(parms);
if (workspaceHistory.getHistoryEntries().size() > 0) {
ScmWorkspaceHistoryEntry entry = (ScmWorkspaceHistoryEntry) workspaceHistory.getHistoryEntries().get(0);
date = entry.getDate(); // This is the date of the last operation against this stream....
}
Comments
1 vote
Hello David ,
ParmsGetWorkspaceHistory parms = new ParmsGetWorkspaceHistory();
parms.workspaceId = uuidOfStream;
For identifying the components:
-->ScmWorkspaceHistory .getHistoryEntries() to give ScmWorkspaceHistoryEntry
-->ScmWorkspaceHistoryEntry.getDescription() to give ScmWorkspaceOperationDescription
-->ScmComponentOperationDescription.getComponent() to identify the component
For getting the entire history:
IScmRichClientRestService.postGetWorkspaceHistory() will not return the entire history as that may be too large. To get all the data you will need to make multiple calls, paging through the results. If the return value has ScmWorkspaceHistory.getNextPage() non-null and non-empty, then you pass that along as an argument using ParmsGetWorkspaceHistory.pageToken to get subsequent pages.
1 vote
Hello David,
parms.workspaceId = uuidOfStream;
Hello David,
To clarify, workspaceHistory.getHistoryEntries() is non-empty for the first page, but it is empty for the 2nd page?
Also, it's hard for me to confirm that your stream has more than 512 'changes' to it (perhaps they all do fit within the 1st page). What type of changes are you missing? (perhaps you are expecting a change type that is not actually included in the operation history)
1 vote
workspaceHistory.getHistoryEntries() is non-empty for the first page but for second page also it is non empty.
workspaceHistory.getNextPage(); value remains constant 1586880172836, does it indicate something.?
Are you sure in the code you are using that you are getting the getNextPage() from the correct workspaceHistory instance?
1 vote
1 vote
Glad you resolved it.
Please click 'Mark this answer as the accepted answer'.
1 vote
For identifying the components:
-->ScmWorkspaceHistory .getHistoryEntries() to give ScmWorkspaceHistoryEntry
-->ScmWorkspaceHistoryEntry.getDescription() to give ScmWorkspaceOperationDescription
-->ScmComponentOperationDescription.getComponent() to identify the component
It's literally the first method in the ScmWorkspaceOperationDescription.java file. Please spend a bit of effort looking through the classes to see what's available :)
ScmWorkspaceOperationDescription desc = workspaceHistoryEntry.getDescription();
List<ScmComponentOperationDescription> componentOperations = desc.getComponentDescriptions();
Hallo Andrew Niefer,
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Dec 18 '19, 2:50 a.m.You have asked your question Dec 13th. You could edit that if you wanted to. Please do not spam the forum with duplicate questions. I closed the older one for this time.
Rajat Krishnan
Dec 18 '19, 4:34 a.m.@Ralph Schoon, Apologies for the same but there seems some problem with jazz forum, like i was trying to delete my earlier question but it was not getting deleted, may be next time i will keep this thing in my mind, but anyway can you please help me with the above query ?
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Dec 18 '19, 4:48 a.m.