It's all about the answers!

Ask a question

[closed] Exception calling setArchived() using the Jazz Plain java cl


Jeremy Hughes (2164837) | asked Jan 21 '09, 11:04 a.m.
closed Nov 12 '16, 10:00 a.m. by Ralph Schoon (63.1k33645)
Hi, I'm trying to use the Jazz Plain client libraries to archive some
users, but I'm getting this exception when I call
IContributor.setArchived(true) ...

Exception in thread "main"
com.ibm.team.repository.common.internal.ImmutablePropertyException
at
com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2047)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:247)
at
com.ibm.team.repository.common.model.impl.ContributorImpl.setArchived(ContributorImpl.java:464)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at
com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:596)
at $Proxy7.setArchived(Unknown Source)
at
com.ibm.wasrtc.tools.ArchiveUsersNotInLDAP.main(ArchiveUsersNotInLDAP.java:107)

I'm effectively doing:

IContributorManager icm = teamRepository.contributorManager();
List<IContributor> allContribs = icm.fetchAllContributors(new
NullProgressMonitor());

then picking the IContributor I want from that list and calling:

contributor.setArchived(true);

Any help appreciated.

Thanks,
Jeremy

The question has been closed for the following reason: "The question is answered, right answer was accepted" by rschoon Nov 12 '16, 10:00 a.m.

Accepted answer


permanent link
Matt Lavin (2.7k2) | answered Jan 26 '09, 11:38 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
I would highly recommend using the ITeamRepository.contributorManager()
API rather than casting to IContributorService, but I'm glad you got it
working.

-
Matt Lavin
Jazz Server Team


On Mon, 2009-01-26 at 14:29 +0000, Jeremy Hughes wrote:
On 24/01/2009 04:37, Matt Lavin wrote:
In Balaji's example, I believe that getContributorService() was a
shortcut for calling
getService(com.ibm.team.repository.common.service.IContributorService.class) from a server side service.

From the client side you could use
com.ibm.team.repository.client.ITeamRepository.contributorManager() to
get an instance of com.ibm.team.repository.client.IContributorManager.

Thanks ... in the end this worked for me:

ITeamRepository teamRepository = login(repositoryURI, userId, password,
monitor);

// Have to cast the teamRepository to an IContributorService because
// getServiceInterface() isn't on the ITeamRepository interface
IContributorService ics =
(IContributorService)iclc.getServiceInterface(IContributorService.class);

IContributor workingCopy = (IContributor)contributor.getWorkingCopy();
workingCopy.setArchived(true);
ics.saveContributor(workingCopy);

Thanks,
Jeremy
Ralph Schoon selected this answer as the correct answer

5 other answers



permanent link
Balaji Krish (1.8k12) | answered Jan 21 '09, 11:14 a.m.
JAZZ DEVELOPER
You need to get the workingCopy of the contributor before setting a value.

IContributor workingCopy = contributor.getWorkingCopy();
workingCopy.setArchived(true);
getContributorService().saveContributor(workingCopy);

--- Balaji

Hi, I'm trying to use the Jazz Plain client libraries to archive some
users, but I'm getting this exception when I call
IContributor.setArchived(true) ...

Exception in thread "main"
com.ibm.team.repository.common.internal.ImmutablePropertyException
at
com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2047)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:247)
at
com.ibm.team.repository.common.model.impl.ContributorImpl.setArchived(ContributorImpl.java:464)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at
com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:596)
at $Proxy7.setArchived(Unknown Source)
at
com.ibm.wasrtc.tools.ArchiveUsersNotInLDAP.main(ArchiveUsersNotInLDAP.java:107)

I'm effectively doing:

IContributorManager icm = teamRepository.contributorManager();
List<IContributor> allContribs = icm.fetchAllContributors(new
NullProgressMonitor());

then picking the IContributor I want from that list and calling:

contributor.setArchived(true);

Any help appreciated.

Thanks,
Jeremy

permanent link
Jeremy Hughes (2164837) | answered Jan 21 '09, 1:38 p.m.
On 21/01/2009 15:17, balajik wrote:
You need to get the workingCopy of the contributor before setting a
value.

IContributor workingCopy = contributor.getWorkingCopy();
workingCopy.setArchived(true);
getContributorService().saveContributor(workingCopy);

I can't see getContributorService() or saveContributor() in the 1.0.1

plan java jars. Am I missing something.

Thanks,
Jeremy

permanent link
Matt Lavin (2.7k2) | answered Jan 23 '09, 11:38 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
In Balaji's example, I believe that getContributorService() was a
shortcut for calling
getService(com.ibm.team.repository.common.service.IContributorService.class) from a server side service.

From the client side you could use
com.ibm.team.repository.client.ITeamRepository.contributorManager() to

get an instance of com.ibm.team.repository.client.IContributorManager.

-
Matt Lavin
Jazz Server Team


On Wed, 2009-01-21 at 17:38 +0000, Jeremy Hughes wrote:
On 21/01/2009 15:17, balajik wrote:
You need to get the workingCopy of the contributor before setting a
value.

IContributor workingCopy = contributor.getWorkingCopy();
workingCopy.setArchived(true);
getContributorService().saveContributor(workingCopy);

I can't see getContributorService() or saveContributor() in the 1.0.1
plan java jars. Am I missing something.

Thanks,
Jeremy

permanent link
Jeremy Hughes (2164837) | answered Jan 26 '09, 9:38 a.m.
On 24/01/2009 04:37, Matt Lavin wrote:
In Balaji's example, I believe that getContributorService() was a
shortcut for calling
getService(com.ibm.team.repository.common.service.IContributorService.class) from a server side service.

From the client side you could use
com.ibm.team.repository.client.ITeamRepository.contributorManager() to
get an instance of com.ibm.team.repository.client.IContributorManager.

Thanks ... in the end this worked for me:

ITeamRepository teamRepository = login(repositoryURI, userId, password,
monitor);

// Have to cast the teamRepository to an IContributorService because
// getServiceInterface() isn't on the ITeamRepository interface
IContributorService ics =
(IContributorService)iclc.getServiceInterface(IContributorService.class);

IContributor workingCopy = (IContributor)contributor.getWorkingCopy();
workingCopy.setArchived(true);
ics.saveContributor(workingCopy);

Thanks,
Jeremy

Comments
Ananya Joisa commented Aug 27 '12, 3:08 p.m.

Hi,

Could anyone please tell me what iclc in the above lines is?

And I am also getting this error:

00:31:02,375 [1245989444@qtp-1917350472-33] ERROR com.ibm.team.process.common - The service 'net.jazz.rtcext.workitem.extensions.service.BuildOnStateChangeParticipant@52a252a2' failed to find the required service 'interface com.ibm.team.repository.common.service.IContributorService'. Check <prerequisites> in plugin.xml. java.lang.IllegalArgumentException: The service 'net.jazz.rtcext.workitem.extensions.service.BuildOnStateChangeParticipant@52a252a2' failed to find the required service 'interface com.ibm.team.repository.common.service.IContributorService'. Check <prerequisites> in plugin.xml.

Could anyone please guide me.

Thanks.


permanent link
Dibyandu Roy (111) | answered Nov 11 '16, 5:20 p.m.
I am trying to automate the archival of a project area. When I execute this command, I am getting this error.

projectArea.setArchived(true)

Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException
at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2134)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
at com.ibm.team.process.internal.common.impl.ProcessAreaImpl.setArchived(ProcessAreaImpl.java:563)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597)
at com.sun.proxy.$Proxy16.setArchived(Unknown Source)
at com.intel.ArchiveProject.ArchiveProject.analyzeProjectArea(ArchiveProject.java:250)
at com.intel.ArchiveProject.ArchiveProject.run(ArchiveProject.java:183)
at com.intel.ArchiveProject.ArchiveProject.main(ArchiveProject.java:96)


Thanks for the help.