It's all about the answers!

Ask a question

Exception on saving userproperty on Versionable in operationParticipant


erling jorgensen (40911) | asked Aug 02 '12, 9:10 a.m.
 Hi

I want to save a string on a file/folder on delivery, implemented in an operationparticipant. My code is quite simple:
IVersionable item = (IVersionable) iVersionable.getWorkingCopy();
item.setUserProperty("<Keystring>", "<valuestring>");
getService(IRepositoryItemService.class).saveItemInTxn(item);
On the saveoperation, I get an exception:

ERROR com.ibm.team.process.common                         - Access violation in component item service.  Service component: com.ibm.team.repository.service, 
		
Model component: com.ibm.team.scm, 
		
Item type: com.ibm.team.filesystem#FileItem
		
com.ibm.team.repository.common.InternalRepositoryException: Access violation in component item service.  Service component: com.ibm.team.repository.service, Model component: com.ibm.team.scm, Item type: com.ibm.team.filesystem#FileItem
		
at com.ibm.team.repository.service.internal.ComponentRepositoryItemService.checkComponentPermission(ComponentRepositoryItemService.java:141)
		
at com.ibm.team.repository.service.internal.ComponentRepositoryItemService.saveItemInTxn(ComponentRepositoryItemService.java:659)
		
at dk.bankdata.rtc.extensions.contributors.FileUserPropertyCreator.createUserDefinedPropertyOnChanges(FileUserPropertyCreator.java:82)
		
at dk.bankdata.rtc.extensions.contributors.FileUserPropertyCreator.run(FileUserPropertyCreator.java:50)
		
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)
		
.......

I have suspect the componentid on the extensionservice is causing the failure. It is set to componentId="com.ibm.team.repository.service". But if it is wrong, I don't know a better value (I've tried several).

...and by the way: I plan to use the userproperty, assuming it is ment for users to set in customization. Is that true or am I abusing something?

Regards

Erling

Comments
Ralph Schoon commented Jan 06 '16, 5:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Hi Erling, I am not sure about the context of the operation. There are several things that can prevent this from working.
One is the service. There is an IScmService and I am not sure the IRepositoryItemService can do the save you want.
I searched the SDK for setUserProperty() as a method and there are several ways of how it is used, also containing save operations, which are usually done on an IWorkspaceConnection using the IWorkspaceConnection.configurationOpFactory().save(). I assume the call you are doing is not allowed in the context.

Accepted answer


permanent link
Darcy Wiborg-Weber (16) | answered Dec 08 '15, 3:12 p.m.
 Just a followup to say this was implemented in RTC 5.0.2.  Here's a link to more information:
https://jazz.net/downloads/rational-team-concert/releases/5.0.2?p=news
Ralph Schoon selected this answer as the correct answer

3 other answers



permanent link
erling jorgensen (40911) | answered Aug 08 '12, 2:33 p.m.
 Actually my need is to put a property value on a particular version of the versionable. In my case always the last (and current version).

Perhaps it was possible to set a version property on checkin. But can it be done in a server trigger?

Comments
erling jorgensen commented Sep 07 '12, 4:25 a.m.

My need is to set a user property on a version of an item, and to be able to modify it later (after the item is delivered).

So the workitem Geoffrey made for this is still valid .


Ralph Schoon commented Jan 06 '16, 5:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

To put a property on an artifact, you will have to put it there in a change set that is not complete and later deliver.
If you want to be able to put information on a version of an artifact that is already delivered, since 5.0.2 there are "Attributes" that ├Żou can define and that can be changed without the need to a new version.


permanent link
Geoffrey Clemm (30.1k33035) | answered Aug 07 '12, 11:23 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As John says, currently, a version property is part of the state of a version, and cannot be modified once that version is created by the checkin operation.  I've created work item 220897, requesting support for modifiable version properties ( https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/220897 ).

permanent link
John Camelon (1.7k14) | answered Aug 07 '12, 9:40 a.m.
JAZZ DEVELOPER
Versionables can only be saved via a commit operation. See IScmService#batchCommit. I am not sure If properties behave as you would like. They are baked Into the version.

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.