As a developer of Alfresco applications, I want a RESTful API to perform the same operation on multiple nodes so that I can have all of the operations completed within a single request and transaction.
- Batch operations can be performed both asynchronously and synchronously
- The batch operations API can report on the progress
- If errors occurs the API should be flexible and allow different behaviours
- This work cannot be fully implemented before a queue system is in place (see API-1095).
- Batch operations needs to support use cases for which the SOAP CML was previously used (https://wiki.alfresco.com/wiki/CML)
- Using a CML command helps to add aspects, create associations, create nodes, trigger a custom action in a single call/transaction.
A customer has mentioned that RepositoryService.update(...) is no longer available for 5.1 as it was for 4.1.1. They use this method for updating multiple documents and are looking for a suitable replacement for it.
In this scenario the customer has a single parent document that already exists and is creating sub-documents that can be associated with the parent document. By using CML the system emulates transactions that do the following:
1. Add N subdocuments to alfresco
2. Add association between a subdocument and its parent document
3. Update the parent document properties to reflect information on who performed the operation update.
This uses the RepositoryService.update(CML cml) call to do this in one single transaction. If any of this fails, then all changes are reverted. For example: if a sub-document name already exists, it will fail.
In this scenario they have a single parent document that already exists with a few subdocuments that are associated with this parent document. Each subdocument has a property called "sequence". They need to perform a reorder operation on all subdocuments within a single transaction to change the property so that concurrent requests will not affect each other. It also uses RepositoryService.update(CML cml) call to do this as a single transaction to implement it as an atomic operation.