Document creation handler succeeds from UI but fails from CMIS document creation
What needs to be done in order to avoid the following error from a operation event handler?
org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentVersion$VersionNotModifiableException: Cannot set property on a version:
My code works correctly when documents are created from the UI – it sets additional metadata based on web service call results, similar to the external web service example on the Nuxeo blog.
However when I attempt to use cmislib's createDocument call, the
VersionNotModifiableException error is returned when Document.Save is called on the modified object.
Is there something I should be doing in my Operation, or some special property or set of properties I should be setting on the createDocument call?
I solved this issue by filtering the event in Nuxeo Studio to only fire when “Current document is: Mutable Document.”
I guess the CMIS createDocument must fire off multiple events for document creation, one containing a live document and one containing a version? Is this expected behavior?