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

RTC SCM API examples

I need to set the user properties for a part and check it in programmatically.

I have tried the following =>

  IChangeSetHandle cs1 = workspace.createChangeSet( component, monitor );
     
  fileItem.setUserProperty( "testKey" , "TestValue" );
      
 workspace.commit( cs1, Collections.singletonList( workspace.configurationOpFactory().save( fileItem ) ), monitor );


However this throws IllegalArgumentException without any additional detailed message.

Is there any RTC SCM API documentation or examples that could shed light here?

0 votes

Comments

Can you get a stack trace of the error?

At a glance, it seems like you didn't get the working copy for the file item. You need that before you can change anything on the versionable.

I don't know what you mean by "working copy for the file item".
I am using what seems to be a valid IFileItem object.

I tried to paste the stacktrace into this comment however when I do the "Post comment" button greys out.  It must not like something about the stacktrack format.
Is there a trick to doing it?


That worked.  Thanks


Accepted answer

Permanent link
IFileItem extends IItem and all items are copies that cannot be modified. You have to get a working copy of the IItem (ie. call #getWorkingCopy() on the item) before you can modify it. If you didn't know what a working copy was before then that is the issue you're encountering. You'll be fine once you change your code to get the working copy and set the user property on the working copy.
Ralph Schoon selected this answer as the correct answer

2 votes

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: May 16 '13, 12:17 p.m.

Question was seen: 3,998 times

Last updated: May 23 '13, 5:10 a.m.

Confirmation Cancel Confirm