Automation context is statefull, we don't clear the input owned by Operation object, used to make requests agains Nuxeo.
As it, sometimes we lead to issues because parameters are present due to a former call.
The example below will attach correctly blob1 on "/file " + i only for the first iteration ( i == 0 ).
for (int i = 0; i < 10; i++) { // create a document Document doc = new Document("file " + i, "File"); doc.setTitle("file" + i); doc = nuxeoClient.repository().createDocumentByPath("/", doc); // attach blobs // blob1 will be attached to default xpath file:content Blob blob1 = new Blob(FileUtils.getFile("sample.jpg")); nuxeoClient.automation() .newRequest("Blob.AttachOnDocument") .param("document", "/file " + i) .input(blob1) .execute(); // blob2 will be attached to files:files xpath Blob blob2 = new Blob(FileUtils.getFile("sample.jpg")); nuxeoClient.automation() .newRequest("Blob.AttachOnDocument") .param("xpath", "files:files") .param("document", "/file " + i) .input(blob2) .execute(); }
As workaround, you can put the right parameter and not rely on default.
- is related to
-
JAVACLIENT-128 Refactor the client
- Resolved