Error programmatically archiving users
I am working on a archiving tool, that validates a set of information and then, if things are okay, it attempts to archive this user.
I have the userID and retrieve the contributor: IContributor me = icm.fetchContributorByUserId(userID, null); Then I attempt to setArchived(true) me.setArchived(true); And I get an exception, but I'm not sure what an ImmutablePropertyException is. I can archive the users manually via the jts/admin UI using the same logged-in userid, so I don't believe it can be a permissions problem. com.ibm.team.repository.common.internal.ImmutablePropertyException at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2001) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280) 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:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597) at $Proxy10.setArchived(Unknown Source) at archiveusertool.Main.main(Main.java:123) |
Accepted answer
DUH!!
IContributor workingCopy = (IContributor) me.getWorkingCopy(); workingCopy.setArchived(true); icm.saveContributor(workingCopy, monitor); Ralph Schoon selected this answer as the correct answer
|
One other answer
Ralph Schoon (63.3k●3●36●46)
| answered Oct 24 '12, 3:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Oct 24 '12, 4:45 a.m.
Right Susan,
also see http://rsjazz.wordpress.com/2012/10/12/changing-the-jazz-user-id-using-the-rtc-plain-java-client-libraries/ ** DELETED CODE TO DELETE USERS ** Don't delete users, it seems to affect the dasboard servcice. Comments
Susan Hanson
commented Oct 24 '12, 3:41 a.m.
Is there any benefit to deleting vs archiving (other than if you archive, you can unarchive them)? is there any performance gains, database size gains? What happens to work items that were created by or owned by a user that gets deleted (resolved ones, for example)? i know with archiving, they are shown as archived.
Hi Susan, I just tried deleting a user with 4.0.0.1 and it appears to have an ill effect on the dashboard service. I will delete my comments and recommend not to play with deleting users so far.....
|
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.