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

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)

0 votes


Accepted answer

Permanent link
DUH!!

                            IContributor workingCopy = (IContributor) me.getWorkingCopy();
                            workingCopy.setArchived(true);
                            icm.saveContributor(workingCopy, monitor);

Ralph Schoon selected this answer as the correct answer

1 vote


One other answer

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

0 votes

Comments

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

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

Question asked: Oct 24 '12, 2:15 a.m.

Question was seen: 5,028 times

Last updated: Oct 24 '12, 4:47 a.m.

Confirmation Cancel Confirm