It's all about the answers!

Ask a question

Error programmatically archiving users


Susan Hanson (1.6k2201194) | asked Oct 24 '12, 2:15 a.m.
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


permanent link
Susan Hanson (1.6k2201194) | answered Oct 24 '12, 2:27 a.m.
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



permanent link
Ralph Schoon (63.1k33646) | 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.

Susan


Ralph Schoon commented Oct 24 '12, 4:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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


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