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

How to change the ownership of a component ?

 I have found one code snippet from somewhere but it is not working for me. Can you please help me on this 

IScmService scmService = null; 
IRepositoryItemService itemService;
IComponentHandle componentH;
ComponentOwnerHandle componentOwnerH = scmService.getComponentOwnerRecord((ComponentHandle) componentH);
ComponentOwner componentOwner = (ComponentOwner) itemService.fetchItem(componentOwnerH, IRepositoryRemoteService.COMPLETE);
IAuditableHandle ownerH = componentOwner.getOwner();
if (componentHandle == null) {
// Rename component
componentHandle = wm.createComponent(componentName,
teamRepository.loggedInContributor(), monitor);
wm.setComponentOwner(componentHandle, ownerH, monitor);
} else {
// Rename component
wm.renameComponent(componentHandle, componentName, monitor);
wm.setComponentOwner(componentHandle, ownerH, monitor);
}

0 votes



One answer

Permanent link
  1. " I have found one code snippet from somewhere but it is not working for me." This is a pointless statement.
  2. The snippet is from https://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/ it basically works
  3. The code to get a component owner in your example seems to be pretty pointless and does not seem to do anything useful. If you had a reasonable value in ownerH your code might even do something. Since you seem to get the old owner and set that, what do you expect?

0 votes

Comments
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(teamRepository);
wm.setComponentOwner(componentHandle, newOwnerHandle , monitor);

newOwnerHandle the new owner; must be either a IContributorHandle or a IProcessAreaHandle; must not be null (IProcessAreaHandle = ProjectAreaHandle or TeamAreaHandle)

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
× 11,073

Question asked: Jun 12 '18, 2:24 a.m.

Question was seen: 3,557 times

Last updated: Jun 12 '18, 4:54 a.m.

Confirmation Cancel Confirm