This blog post in intended for anyone who is familiar with Nuxeo Studio and is interested to learn a bit more about automation chains. As noted in my previous post, creation of automation chains is a prominent feature in Nuxeo Studio which allows users to set a series of instructions that can be executed.

Operations

Automation chains are made up of multiple bits of instructions called ‘operations’. There are many operations that are already defined in Studio that are generally sufficient for most situations. These operations can include fetching a document, creating a task, and logging in as a specific user to name just a few. When creating an automation chain, a user simply needs to add one operation at a time for the task they have in mind. For example, if they want to have a chain where you login as the administrator and create a new document, they would only need to add the corresponding operations for logging in and creating a document.

MVEL Language

The Language is used to create the input values for the operations in an automation chain. MVEL helps determine what metadata should be extracted from specific data types, such as a document file’s title by calling expr:Document[“dc:title”]. With this, you can also set up your own variable names to temporarily hold data, and use them as needed. Here are some basic MVEL scripting features to take note of:

  • If you were to type “description” it would have no special interpretation and just literally mean “description”.
  • If you were to type “expr:description” the expr means to examine “description” as a scripting expression, and not as a literal one. This allows any scripting interpretation in the expression to return their value.
  • If you were to type “expr:Description – @{description}”, and “description” is a variable that holds a string value of “a standard file”, it would return “Description – a standard file”. Having @{} means that it will interpret anything inside the brackets as a variable, which is “a standard file” in this case.
  • It’s important to note that if the “expr:” part wasn’t there in the above example, it would just return “Description – @{description}” since it would return as a literal.

There are many more uses of the MVEL language for automation chains, which can be found at the following link: https://doc.nuxeo.com/display/NXDOC/Use+of+MVEL+in+Automation+Chains.

MVEL also has a list of operators to use, which can be found here: http://mvel.codehaus.org/Operators.

If you are curious to see a sample script that uses MVEL, there’s a posted example which creates a random number guessing game: https://github.com/mvel/mvel/blob/master/samples/scripts/randomguess.mvel.

User-Created Operations

Even though the Studio provides a vast amount of useful operations, those aren’t the only ones that are usable. Users are freely able to create their own operations themselves. However for this part, the user should be able to code with Java, and be able to utilize MVEL. This requires the installation of the Eclipse IDE, the Nuxeo SDK, and the Nuxeo IDE for Eclipse. The Nuxeo IDE has a wizard to help set up an operation template to give users a start. From here, the users are free to utilize the Nuxeo SDK library to code a specific operation they need. There’s a tutorial to create your first operation which results in the creation of a random string generator:

http://doc.nuxeo.com/display/NXDOC56/Coding+your+first+operation

To see more information related to creating an operation, refer to here too:

http://doc.nuxeo.com/display/NXDOC/Contributing+an+Operation

These are just the main features associated with automation chains, but I hope this helps anyone get a general idea about the usage of these chains with Nuxeo Studio. Next time, I’d like to elaborate on event handlers, which is the feature responsible for triggering automation chains.