What is the name of the input variable which contains the documents for an operation?

I want to use the result from Document.GetChildren to calculate a dynamic folder name. My idea is that MVEL provide the length of an array via the object method size.

The problem is that I cannot find the right variable which contain the output documents. I know that an operation can return a list of documents or a reference to a list of documents. Nevertheless I don't find the correct variable name ;(

<?xml version="1.0"?>
  <component name="org.nuxeo.dev.cookbook.example.pap.process-request.chains">

    <extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent" point="chains">

      <chain id="CreateDevCookbookExamplePapProcessRequest">
          Input: Called from the folder with all requests
          Calculate a name for the new folder
          Create folder with title
          Create customer_form
          Open customer form
        <!-- get the folder as input -->
        <operation id="Seam.AddErrorMessage">
          <param type="string" name="message">Cannot load the folder with the requests.</param>
        <!-- usually unnecessary -->
        <operation id="Context.FetchDocument">
        <!-- determine number of children -->
        <operation id="Seam.AddErrorMessage">
          <param type="string" name="message">Cannot calculate the name of the new file.</param>
        <operation id="Context.SetInputAsVar">
          <param type="string" name="name">requests</param>
       <operation id="Document.GetChildren">
       <operation id="Context.SetVar">
         <param type="string" name="name">form_name</param>
           here  I want to calculate a dynamic new file name
           BUT:  I cannot access the document list from GetChildren.
           BUT:  It looks like all variable names are unknown.
           MVEL: documents.size (should be the length of the list)
         <param type="object" name="value">expr:@{Documents.size}</param>

The error messages always look like this one:

Caused by: [Error: could not access: Documents; in class: null]
[Near : {... Unknown ....}]

The example is from the tutorial which I prepare for the Dev Cookbook.

0 votes

1 answers



Hi Michael,

I manage to do it by first setting the input of the getChildren operation as a context variable. Here's a screenshot of my example:

0 votes

Hi Laurent,

this workaround fixes the issue for me. Nevertheless it is at minimum a flaw in the documentation.

I fixed and uploaded the JAR archive for the tutorial but Solen actually fixes my tutorial. If she completed her work then I will complete my stuff. It is the first time that I experience the luxury of a technical writer. Unfortunately it is not possible to vote for such stuff ;)

Thanks a lot.