RTC: How to get deleted components list form the stream using Java API
3 answers
In the Eclipse client, open the stream. On the button top left with the stream name click the triangle. Select Show>Operation History
Comments
Thank you for quick response.
But i am looking for java API implementation.
If you could suggest me some sample code then it will be great.
I don't know the SCM API that is needed for this operation. I tried to look into the Eclipse client to find a thread to start, but was not able to.
In eclipse the Show History events is useful here but it is time consuming.
My requirement is on one click gets list (in faster way)
i only want to display removed components name
Here the options I see:
- Create an enhancement request in the IBM Enhancement Request Community
- Install the SDK and use YARI https://marketplace.eclipse.org/content/yet-another-rcp-inspector or another such tool to find out how the view is created.
There is no official API for retrieving this information.
Nothing should really stop you from trying to do what the Operation History does however (which is not official API).
Note: This is pseudo-code giving you some rough direction:
ParmsGetWorkspaceHistory parms = new ParmsGetWorkspaceHistory();
parms.workspaceId = uuidOfStream;
IScmRichClientRestService scmService = (IScmRichClientRestService) ((IClientLibraryContext) repository).getServiceInterface(IScmRichClientRestService.class);
ScmWorkspaceHistory workspaceHistory = scmService.postGetWorkspaceHistory(parms);
<iterate across workspaceHistory.getHistoryEntries()>
ScmWorkspaceHistoryEntry workspaceHistoryEntry = (ScmWorkspaceHistoryEntry) workspaceHistory.getHistoryEntries().get(i);
ScmWorkspaceOperationDescription desc = workspaceHistoryEntry.getDescription();
@SuppressWarnings("unchecked") // Safe to cast per Javadoc
List<ScmComponentOperationDescription> componentOperations = desc.getComponentDescriptions();
for (ScmComponentOperationDescription componentOp : componentOperations) {
// check if componentOp.getOperation() == OperationKind.REMOVE_COMPONENT
ScmComponent component = componentOp .getComponent()
String componentName = component.getName();
}
For iterating across 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.