It's all about the answers!

Ask a question

How to delete the workspace programmatically in RTC SCM API


Jazzuser user (68849) | asked Jun 06 '17, 5:34 a.m.

Hello All,
We have a usecase wherein we, need to get the Changesets from a particular snapshot given(Baselines).

We are creating the workspace connection for getting the connection object as mentioned in below uri :
https://jazz.net/forum/questions/239965/how-to-get-the-changesets-linked-to-a-particular-snapshot

 IWorkspaceConnection tempwrkspaceCon=workspaceMgr.createWorkspace(scopeHandle, "testStreamDemoPurpose2", "forTestingpurpsose", snapShot, null);
           

                  IChangeHistory changeHistory = wrkspaceCon.changeHistory(compHandle);
                  List<IChangeHistoryDescriptor> csDescriptorList = changeHistory.getHistoryDescriptors(Integer.MAX_VALUE, false, null);
                for (IChangeHistoryDescriptor csDescriptor : csDescriptorList) {
//some more code.
}

After getting all the ChangeSets, we need to delete the tempwrkspaceCon workspace, because that is not required anymore.

Could you please suggest as how to delete the workspace pointer programmatically ?

Thanks.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Jun 06 '17, 8:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 06 '17, 8:22 a.m.

I believe you use the same API you used to create the workspace to delete it: com.ibm.team.scm.client.IWorkspaceManager.deleteWorkspace(IWorkspaceHandle, IProgressMonitor)


Comments
Jazzuser user commented Jun 08 '17, 3:12 a.m.

Thanks for the reply Ralph.
I was not able to use this API, since i have the IWorkspaceConnection object and not the IWorkspaceHandle.

 IWorkspaceConnection tempwrkspaceCon=workspaceMgr.createWorkspace(scopeHandle, "testStreamDemoPurpose2", "forTestingpurpsose", snapShot, null);

Is there any other way to delete the workspace from its connection object ?



Ralph Schoon commented Jun 08 '17, 3:41 a.m. | edited Jun 08 '17, 3:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you want to do this kind of work, you basically have to learn how to search in the SDK. Finding the IWorkspaceManager.deleteWorkspace() after the createWorkspace was already at IWorkspaceManager is a no brainer. Searching for IWorkspaceManager.deleteWorkspace() in the SDK is a 30 seconds operation and finding one of the first is SCMPlatform.getWorkspaceManager(workspace.teamRepository()).deleteWorkspace(workspace.getResolvedWorkspace(), null); which shows that com.ibm.team.scm.client.IFlowNodeConnection.getResolvedWorkspace() always returns the IWorkspace which is its own handle. Before you ask  com.ibm.team.scm.client.IWorkspaceConnection extends com.ibm.team.scm.client.IFlowNodeConnection.


Ralph Schoon commented Jun 08 '17, 4:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The easiest way to search is to open a class or method, right click at it and open the declaration. On the declaration right click and select References to search for them. 

Another is to use Java Search, type in names (with asterisk if needed) and search for classes, interfaces and methods. 

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.