Uploaded image for project: 'Nuxeo Java Client'
  1. Nuxeo Java Client
  2. JAVACLIENT-130

Make Automation API stateless

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2, 2.5
    • Fix Version/s: 3.0.0
    • Component/s: API

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kleturc Kevin Leturc
                Reporter:
                kleturc Kevin Leturc
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: