cancel
Showing results for 
Search instead for 
Did you mean: 

Document creation handler succeeds from UI but fails from CMIS document creation

Steven_Huwig1
Star Contributor
Star Contributor

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?

1 REPLY 1

Steven_Huwig1
Star Contributor
Star Contributor

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?