It's all about the answers!

Ask a question

RTC: How to get deleted components list form the stream using Java API


Raj Kumar (21217) | asked Oct 06 '20, 12:31 a.m.

A list of old Components (past) which are no more part of stream currently.
How to find the name of those components ?

3 answers



permanent link
Ralph Schoon (63.3k33646) | answered Oct 06 '20, 5:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 In the Eclipse client, open the stream. On the button top left with the stream name click the triangle. Select Show>Operation History


Comments
Raj Kumar commented Oct 06 '20, 6:36 a.m.

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.


Ralph Schoon commented Oct 06 '20, 9:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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. 


Raj Kumar commented Oct 07 '20, 1:40 a.m.

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


Ralph Schoon commented Oct 07 '20, 3:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Here the options I see: 

  1. Create an enhancement request in the IBM Enhancement Request Community
  2. 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. 
I did not easily find it. I will ask a developer if they can throw us a bone here. No promises.


permanent link
Ralph Schoon (63.3k33646) | answered Oct 08 '20, 6:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

permanent link
David Lafreniere (4.8k7) | answered Oct 08 '20, 8:09 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 08 '20, 8:12 p.m.

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.

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.