RTC Java API: How to get the component Owned by Name
One answer
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
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/