Search code examples
javajakarta-eenuxeo

NUXEO Attach Multiple Files on Single Document


I am newer to Nuxeo. I had integrated my Portal with Nuxeo 8.1 CE & now using Java Automation Client API I am performing Operations in Nuxeo from my Portal. My problem is I want to attach Multiple Files on Single Document. I found its operation as BlobHolder.Attach from http://explorer.nuxeo.com/nuxeo/site/distribution/Nuxeo%20DM-5.5/listOperations

But I am not able to find any such example of this Operation. Any example of this Operation will be of great help.


Solution

  • https://www.nuxeo.com/blog/qa-friday-add-extra-files-document-content-automation/

    Here is documentation for setting few blobs to document. I`m not sure but you can try to set Blobs on chain call like in example below.

    HttpAutomationClient client = new HttpAutomationClient("http://localhost:8080/nuxeo/site/automation");
    Session session = client.getSession("Administrator", "Administrator");
    File dummyFile = new File("/tmp/dummy");
    session.newRequest("Blob.AttachOnDocument")
        .set("document", "/path/to/my/doc")
        .set("xpath", "files:files")
        .setInput(new Blobs(Arrays.asList(
                new FileBlob(dummyFile),
                new FileBlob(dummyFile),
                new FileBlob(dummyFile)
        ))).execute();