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

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

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

0 votes


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
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

0 votes


5 other answers

Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes

Comments

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
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.

0 votes

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

Question asked: Jan 21 '09, 11:04 a.m.

Question was seen: 6,079 times

Last updated: Nov 12 '16, 10:00 a.m.

Confirmation Cancel Confirm