How to add users and roles in child team area using plain java API
Is it possible to add users and roles in child team area? My code currently can add users and roles in team areas but how can I add them in child team area.
ITeamArea TA = (ITeamArea)teamRepository.itemManager().fetchCompleteItem(newTAHandle,ItemManager.DEFAULT,monitor);
IContributor contributor = teamRepository.contributorManager().fetchContributorByUserId(members,monitor);
ArrayList roles = getTeamRoleName(projectArea,member_roles);
IProcessAreaWorkingCopy areaWc = (IProcessAreaWorkingCopy)service.getWorkingCopyManager().createPrivateWorkingCopy(TA);
areaWc.getTeam().addContributorsSettingRoleCast( new IContributor[] {contributor}, new IRole[] {roles}));
areaWc.save(null);
I was trying to find the hierarchy stuff, but then not finding the option of adding contributors to child team area.
IProjectArea workinCopyProjectArea = (IProjectArea) projectArea.getWorkingCopy();
ITeamAreaHierarchy teamAreaHierarchy = (TeamAreaHierarchy) workinCopyProjectArea.getTeamAreaHierarchy();
One answer
You get the ITeamArea of the sub team and use the same API you use for the top level team area.
Comments
Here is code to understand how to traverse the hierarchy: https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/