It's all about the answers!

Ask a question

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


Naveen Tyagi (19769152) | asked Oct 28 '16, 6:16 a.m.
I'm new to RTC API. i have IComponent object, How can i get the OwnedBy name from the IComponent .Thanks in advance.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Oct 28 '16, 6:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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/

Comments
Naveen Tyagi commented Nov 02 '16, 4:33 a.m.

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);


Ralph Schoon commented Nov 02 '16, 5:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Naveen Tyagi commented Nov 02 '16, 7:34 a.m.

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();


Ralph Schoon commented Nov 02 '16, 7:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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

Your answer


Register or 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.