Nuxeo framework enables to implement custom operations, meaning operations different from the ones you can find in the Studio Operation browser. When implementing your own operation, you can entirely decide what the operation does, what are its parameters, its input...
We provide explanations on how to implement a custom operation. Pre-requisites are basic knowledge of Java and Nuxeo API.
Basically, to enable a custom operation in your Studio project, you need to:
- Implement an operation.
- Import its definition in Studio to be able to use it in the Content Automation Chain editor. An operation definition can be serialized in JSON and uploaded in this format in Studio. As a consequence, the new operation will appear aside built-in operations, in the operation browser in a location that depends on the Operation category you defined.
To import the operation definition:
- Make sure you have an custom operation implemented and deployed on the Nuxeo instance where you also deployed your Studio plugin.
- Go to Advanced settings > Registries > Automation Operations
Pay attention to the given sample definition, copy-paste it and adapt to your custom operation (regarding operation ID, parameters type and value, accepted input and output, ...).
You can add multiple operation definitions.
You can get the full JSON definition of your operation on the operation documentation, on your deployment. Go to the following URL:
http://NUXEO_SERVER/nuxeo/site/automation/doc. The served page builds dynamically the operations documentation. You will find your operation(s) there. Once on the documentation of the operation, in the "LINKS" section, click on the
JSON definitionlink. Note that this link is not available on Nuxeo DM 5.3.2 and previous versions.
- Once the JSON is ok, save and you are done! You should see the operation in its category.
Putting your logic inside operations is always better than directly in SEAM components or custom listeners because:
- It forces you to think a bit generic and re-usable,
- You produce easily configurable and maintainable code.