It's all about the answers!

Ask a question

RTC java API: How to get component Visibility using RTC Java API


Anurag Patel (21868) | asked Nov 15 '16, 12:47 a.m.
edited Nov 16 '16, 5:52 a.m.
Hi All, 
I am able to get the Owned By of the component but struggling to get the Visibility of the component . Any help would greatly appreciated.   
Here is the code i used for getting OwnedBy value: 

private static String getComponentOwner(ITeamRepository teamRepository, IWorkspaceConnection workspace, IComponent component) throws TeamRepositoryException{

                   String componenetOwnerName = null;

                                IScmService scmService = (IScmService) ((TeamRepository) teamRepository).getServiceInterface(IScmService.class);

                                ComponentHandle c = (ComponentHandle)component;

                                ComponentOwnerHandle componentOwnerH  = scmService.getComponentOwnerRecord(c);  

                                ComponentOwner componentOwner1 = (ComponentOwner) teamRepository.itemManager().fetchCompleteItem(componentOwnerH, IItemManager.DEFAULT, null);

                                IAuditableHandle au = (IAuditableHandle)componentOwner1.getOwner();

                                IAuditable ic = (IAuditable)teamRepository.itemManager().fetchCompleteItem(au, IItemManager.DEFAULT, null);

 

                                if(ic instanceof ITeamArea || ic instanceof ITeamAreaHandle)

                                {             

                                                ITeamAreaHandle areaHandle= (ITeamAreaHandle) ic;

                                                ITeamArea area =(ITeamArea) teamRepository.itemManager().fetchCompleteItem(areaHandle, IItemManager.DEFAULT, null);

                                                componenetOwnerName = area.getName();

                                }else if(ic instanceof IContributorHandle)

                                {

                                                IContributorHandle areaHandle= (IContributorHandle) ic;

                                                IContributor area =(IContributor) teamRepository.itemManager().fetchCompleteItem(areaHandle, IItemManager.DEFAULT, null);

                                                componenetOwnerName = area.getName();

                                }

                                else if(ic instanceof IProjectArea){

                                                IProjectAreaHandle projectHandle = (IProjectAreaHandle)ic;

                                                IProjectArea area =(IProjectArea) teamRepository.itemManager().fetchCompleteItem(projectHandle, IItemManager.DEFAULT, null);

                                                componenetOwnerName  = area.getName();

                                }

                                return componenetOwnerName;

                }


Be the first one to answer this question!


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.