Using IItemManager to modify items in the repository
I am trying to use IItemManager to modify items in the repository, but IItemManager.applyItemUpdates() does not seem to commit any change to the repository. Is this the correct way?
My problem is: I have an item attribute of type Content, and I am wondering how to upload data from the client. The jazzbot example is only server-side, while the documentation on IContentManager only shows how to upload a file directly to the workspace. Moreover, it refers to the non-existing function com.ibm.team.repository.client.ITeamRepository.save(IAuditable). |
9 answers
There is no generic way from the client to modify items in the repository. You will need to use the API provided by the item type owner component.
IItemManager.applyItemUpdates only updates the item copy that is cached on the client and should only be called by component implementers. |
Thanks for the clarification. But how can I pass the Content to the component? I have tried to pass it as a parameter in a method (IContent type), but the server component receives a null value.
|
Which item are you trying to modify?
|
The item contains an attribute of type Content, and the client should be able to put a file in it. I cannot use a method similar to the one in the jazztalk example, postNewMessage(NewMessageParameters params), because IParameterWrapper only supports Strings and primitive types.
|
You need to use the IContentManager interface to save contents.
|
I did. But to save the contents... where? I cannot pass an IContent in the params, and I cannot use IItemManager to modify the item in the repository.
The only way I see now is just a workaround, i.e. upload the contents somewhere in the workspace and then ask the server to read the content from that place and to put them into the item. Or is there any straightforward support to perform this operation? |
What is the Item type of the Item you are trying to save? Did you define the item type yourself using EMF Ecore? If that is the case, you will need to define an RPC service that runs on the server and exposes a save method.
|
Yes, I defined the item type myself using EMF Ecore. I defined a service derived from com.ibm.team.repository.service.AbstractService as I saw in the example https://jazz.net/wiki/bin/view/Main/JazzTalkWalkthrough . The problem is: how can I pass the Content to the save method? IParameterWrapper only supports Strings and primitive types.
|
I solved by passing the content uuid value in the params.
|
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.