Add administrator to existing team area using Java API
I want to add administrator in the existing team area using plain Java API. I can successfully add administrator while creating new team areas but the same thing doesn't work when I try to add administrator to existing team areas. I get a long error message.
List <TeamAreaHandle> teamlist = area.getTeamAreas();
ITeamAreaHandle newTAHandle = findTeamAreaByName(teamlist,teamAreaName,monitor);
ITeamArea TA = (ITeamArea)teamRepository.itemManager().fetchCompleteItem(newTAHandle,ItemManager.DEFAULT,monitor);
IContributor contributor =teamRepository.contributorManager().fetchContributorByUserId(administrator, monitor);
if (TA !=null){
TA.addAdministrator(contributor);
}
Error message:
Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException
at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2060)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280)
at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:310)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
at com.ibm.team.process.internal.common.impl.ProcessAreaImpl.addAdministrator(ProcessAreaImpl.java:1390)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597)
at $Proxy15.addAdministrator(Unknown Source)