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

How to programmatically(Plain Java) create repository workspace for the specified changeset?

I want to create a repository workspace programmatically in order to get the file of  the specified changeset.

So, How I get the new workspace's IWorkspaceConnection?

I use the follow code,could create workspace.

But the baseline of workspace's component is initial baseline, so the content is empty.


 String StrChangeSetUUID    = "_r7455343xMsxIDwg";

UUID uuid = UUID.valueOf(StrChangeSetUUID); 

IChangeSetHandle csHandle = (IChangeSetHandle) IChangeSet.ITEM_TYPE.createItemHandle(uuid, null);
        
IChangeSet changeSet =  (IChangeSet) repo.itemManager().fetchCompleteItem(csHandle, IItemManager.DEFAULT, null);

IComponentHandle componentHandle = changeSet.getComponent();

IWorkspaceConnection workspaceConnection = null;
try
{
    // How to programmatically create repository workspace for the specified changeset?
    workspaceConnection = wm.createWorkspace(repo.loggedInContributor(), "Automatic created WM",                                                                                               "Description", monitor);
    workspaceConnection.addComponent(componentHandle, false, monitor);
}
catch (TeamRepositoryException e)
{
    e.printStackTrace();
}

0 votes


Be the first one to answer this question!

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,951

Question asked: Mar 15 '16, 6:06 a.m.

Question was seen: 1,820 times

Last updated: Mar 15 '16, 6:06 a.m.

Confirmation Cancel Confirm