Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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)


0 votes



2 answers

Permanent link
Please have a look into the snippets that ship with the Plain Java Client Libraries. Snippet 3 shows code how to do this. http://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ talks about getting working copies so that you can modify artifacts.

1 vote


Permanent link
 I could get this working now. Thanks Ralph for your hint.
 IProcessAreaWorkingCopy areaWc = (IProcessAreaWorkingCopy)service.getWorkingCopyManager().createPrivateWorkingCopy(TA);
        areaWc.getAdministrators().addContributors(new IContributor[] {contributor});
        areaWc.save(monitor);

0 votes

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Jul 15 '13, 9:27 a.m.

Question was seen: 3,984 times

Last updated: Jul 15 '13, 2:26 p.m.

Confirmation Cancel Confirm