It's all about the answers!

Ask a question

How to upload a file into Jazz repository ?


Vibha Sinha (1643610) | asked Jul 09 '08, 6:11 a.m.
Hi,

I am extending the Jazz repository and one of the data items I need to store is file attachments. I have modeled the file contents as "Content" in my ecore.

I am using TeamModelledService, to expose the get/post operations on the extended data-store.

From the browser side, I would be using post with enctype = multipart/form-data.

Could someone please guide me as to how I would need to implement this on server side ?

Thanks
- Vibha

2 answers



permanent link
Christof Marti (681) | answered Jul 10 '08, 2:59 a.m.
You could also take a look at AttachmentRestService in the com.ibm.team.workitem.service plug-in which does the same for work item attachments.

Christof
Jazz Work Item team


lavinm wrote:
To handle the file upload, you can create a new TeamRawService that
handles the form POST data. When you receive the data, you will need
to:

1) Find the item that the data will be attached to
2) Create a new IContent object using the IContentService with the
uploaded data
3) Create a working copy of your item
4) Attach the content to the working copy
5) Save the new item state

The LicenseUploadService does something similar (though it doesn't
create and save content). You can use that service as a starting
point for how to handle the form POST request.

permanent link
Matt Lavin (2.7k2) | answered Jul 09 '08, 8:53 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
To handle the file upload, you can create a new TeamRawService that handles the form POST data. When you receive the data, you will need to:

1) Find the item that the data will be attached to
2) Create a new IContent object using the IContentService with the uploaded data
3) Create a working copy of your item
4) Attach the content to the working copy
5) Save the new item state

The LicenseUploadService does something similar (though it doesn't create and save content). You can use that service as a starting point for how to handle the form POST request.

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.