Can I create a workspace from a component baseline? How do I load this workspace?

Hello,
I have a snapshot. User selects requisite baseline from the snapshot and I am able to get the handle to that component baseline (within the snapshot)
I need to download the source code from this baseline and copy it to another component.
Correct me if I am wrong, the steps are --- create workspace with that component baseline --- load workspace --- copy code to another workspace containing new selected component and check-in
I am trying use the createWorkspaceAPI and I find that IBaselineSet and IHistoryReference are 2 ways to call the API
How can I create workspace with Baseline ONLY
Is it possible? or I have to create workspace with the snapshot I have and then fetch the required component baseline in it...
How can I load the workspace once I have the IWorkspaceConnection Handle
IWorkspaceConnection wcMy = workspaceManager.createWorkspace(owner, workspaceName, workspaceComment, baselineSet, monitor.newChild(10));
One answer

You might wqant to have a look here: https://github.com/jazz-community/ewm-scm-utils especially the functions
- uploadToStream
- downloadComponentBaseline
- downloadComponentBaseline
Comments
Shashikant Padur
JAZZ DEVELOPER Feb 07 '21, 11:57 p.m.Are you copying code selectively? or copying the entire code? If copying the entire code, why can't you replace the target component with the baseline of the source component?