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

RTC Java API: How to get the component Owned by Name

I'm new to RTC API. i have IComponent object, How can i get the OwnedBy name from the IComponent .Thanks in advance.

0 votes



One answer

Permanent link
Try com.ibm.team.scm.common.IScmService.getComponentOwnerRecord(ComponentHandle)

How to get the service and for client code see https://rsjazz.wordpress.com/2016/02/03/setting-access-control-permissions-for-scm-versionables/

0 votes

Comments

HI Ralaph,
I  get the componentOwner object but didn't find any way to get the name of owned by field of the Component.

IScmService scmService = (IScmService) ((TeamRepository) teamRepository).getServiceInterface(IScmService.class);
ComponentHandle c = (ComponentHandle)component;
        ComponentOwnerHandle componentOwnerH  = scmService.getComponentOwnerRecord(c);
ComponentOwner componentOwner = (ComponentOwner) teamRepository.itemManager().fetchCompleteItem(componentOwnerH, IItemManager.DEFAULT, null);

It is all internal API from com.ibm.team.filesystem.service.internal.FilesystemWorkItemService.protectProjectMove(IRepositoryItemService, IChangeSetHandle...)

                IAuditableHandle owner = ((ComponentOwner) co).getOwner();

You have to use getOwner() to get an IAuditableHandle that you can then resolve.

forget to add the last Line. I got IAuditableHandle but struggling to get the name of Ownedby for component from IAuditableHandle  [ not sure if this is correct way to proceed]. it may be Project, team or any member who owns the Component.
IAuditableHandle owner = (IAuditableHandle )componentOwner.getOwner();

It should be an IContributor and you can search for code to resolve that here: https://rsjazz.wordpress.com/

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

Question asked: Oct 28 '16, 6:16 a.m.

Question was seen: 2,540 times

Last updated: Nov 02 '16, 7:41 a.m.

Confirmation Cancel Confirm