It's all about the answers!

Ask a question

RTC SCM API examples


Bruce Eifler (3912) | asked May 16 '13, 12:17 p.m.
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?


Comments
Tim Mok commented May 16 '13, 1:53 p.m. | edited May 23 '13, 5:10 a.m.
JAZZ DEVELOPER

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.


Bruce Eifler commented May 20 '13, 11:34 a.m.

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?



Bruce Eifler commented May 22 '13, 11:57 a.m.

That worked.  Thanks

Accepted answer


permanent link
Tim Mok (6.6k38) | answered May 21 '13, 9:22 a.m.
JAZZ DEVELOPER
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

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.