Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to delete the workspace programmatically in RTC SCM API

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.

0 votes



One answer

Permanent link

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)

0 votes

Comments

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 ?


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.

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jun 06 '17, 5:34 a.m.

Question was seen: 1,904 times

Last updated: Jun 08 '17, 4:03 a.m.

Confirmation Cancel Confirm