CMIS Cancel Checkout fails

I'm using a Nuxeo 5.9.5 repository with CMIS atompub binding.

I found that I can explicitly checkout a document with a CMIS atompub POST, sending the ID of the document in the payload:

http://localhost:8080/nuxeo/atom/cmis/default/checkedout

The checkout can then be canceled by deleting the PWC. That's done by sending an HTTP Delete message as follows:

http://localhost:8080/nuxeo/atom/cmis/default/entry?id=6a76272e-e2ff-4622-9b59-a6aacfd68a54

I can execute these two commands repeatedly to checkout and then cancel the checkout. That works OK. After doing a checkout, the document is both marked as 'checkedout' and 'locked' [I'm not totally clear why there are both properties.]

Now, if I then use CMIS to update properties on the uncheckedout document, I find that Nuxeo will do an automatic checkout. I can query the PWC of the document, and it exists. But I notice that the document is not locked, although it is marked as checked out.

If I try to cancel the checkout of that document then via CMIS by deleting the PWC, the result is that the entire version series of the document gets deleted. This is something I don't want!

When I inspect the Nuxeo code to see what's happening, I see the following in the method NuxeoCMISService.deleteObjectOrCancelCheckOut(…):

        // If doc has versions, is locked, and is checkedOut, then it was likely
        // explicitly checkedOut so invoke cancelCheckOut not delete
        if (verRef != null && doc.isLocked() && doc.isCheckedOut()) {
            cancelCheckOut(repositoryId, objectId, extension);
        } else {
            deleteObject(repositoryId, objectId, allVersions, extension);
        }

(The comment shown here is from the actual code). Since at that point the document isn't locked – doc.isLocked() is false – it falls through to run the deleteObject(…);

I'm relatively new to Nuxeo, but what I expect should have happened is that on CMIS property update, if the plan is to auto checkout the document, it should also automatically lock it?

0 votes

1 answers

1034 views

ANSWER



There is a bit of an impedance mismatch between Nuxeo and CMIS versioning. In CMIS, a document is either versioned or not versioned. Nuxeo OTOH, supports a hybrid with its “+” versions. We have chosen to deal with this issue by tweaking the Web UI to enforce a “once versioned, always versioned” semantic to ensure CMIS never encounters documents with hybrid “+” versions which are problematic. I suspect each customer's approach to addressing this impedance mismatch is based on how extensively they use CMIS APIs to interact with the repository.

0 votes