upload blob/byte[]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2017 03:09 PM
Hello everyone, Is it possible to upload a file by just blob or byte [] instead of the file itself ??? See the example below:
private Document exportNuxeo() throws IOException {
Document doc = new Document("file", "File");
doc.set("dc:title", "Documento 1");
doc = nuxeoClient.repository().createDocumentByPath("/camara.leg/workspaces/", doc);
Document docCriado = nuxeoClient.repository().fetchDocumentByPath("/camara.leg/workspaces/file");
Blob fileBlob = new Blob(new File("c:\\Desenvolvimento\\doc-nuxeo\\teste.pdf"));
nuxeoClient.automation().newRequest("Blob.AttachOnDocument").param("document", docCriado).input(fileBlob)
.execute();
return doc;
}
Blob fileBlob = new Blob(new File("c:\\Desenvolvimento\\doc-nuxeo\\teste.pdf"));
Instead of being the File object being, I use a Blob or byte []
Because I will need to migrate multiple files from the sql server database to nuxeo....
att Ana Paula Lopes Araújo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 10:04 AM
someone???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 10:59 AM
Hello,
This is currently not possible with our java client. I created https://jira.nuxeo.com/browse/JAVACLIENT-125 to add this feature to client. But it may take times to be done. You can create a PR with the feature if you want, have a look at https://doc.nuxeo.com/nxdoc/contributing-to-nuxeo/ before.
Unless, I'm afraid you need to serialize the byte[] to a file in order to upload it. Something like this should work:
FileUtils.writeByteArrayToFile(new File("pathname"), myByteArray)
FileUtils is a class from Apache Common IO, used by the client.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 11:50 AM
I need to migrate some files (+/- one million and a half) that are in SQL Server to nuxeo ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 11:51 AM
I would have these files in blob or byte []
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 02:26 PM
The only way to do this is to write the blob or byte[] to a temporary file and then upload this file by using blob object from nuxeo-java-client.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 03:14 PM
Do you have any examples using this getByteArray() ???? and could you share it for me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2017 01:02 PM
This isn't nuxeo-related, it's just pure java code. Something like this should work
