Reputation: 695
I'm currently working on a project that was started by another company. They created some CMIS connector and it is currently being used to store documents inside Alfresco. We don't have the source for that connector/component. Things turned sour between the client and provider, and it's been an uphill battle to get the code that we do have.
As it turns out, every once in a while a document update will fail because the file has already been check-out and is currently locked. Considering there are no users inside the alfresco server (it's all done via the web service), we believe at some point it's silently crashing and leaving documents checked-out indefinitely. I'm assuming the problem is on the app we are managing. It could be that the problem is caused by Alfresco.
The function that we've found failing to update the document -- not the one that leaves it checked-out, but the one that fails because of it -- is this:
cmisHelper.checkIn(cmisHelper.checkOut(cr.getId()), "Update", null, docBytes, mimeType);
cr.getId()
has the document id. The check-out fails for obvious reasons.
Is there any way to check-in a document that may have been check-out by another session? That custom-made cmisHelper class doesn't seem to have anything that would relate to an unlock. Documentation is, as you can guess, missing in action.
Something else I considered was soem option in alfresco that would automatically checkin "expired" checkouts. But I haven't found such an option.
thanks
Upvotes: 0
Views: 1742
Reputation: 13514
There's no timeout of working copies, and checked out documents can stay in that state as long as the user leaves it that way. You first need a way to identify which working copies are expired, possibly introducing the concept of a checkout timeout yourself.
E.g. let's say you're going to tell the users that the operation which translates in an Alfresco checkout has to complete in one hour. Then you can configure a cron job to run every hor that can run a script like the following:
var nodes = search.query("ASPECT:\"cm:workingcopy\" AND @cm\:created:\$\{luceneDateRange(today, \"-P1H\")\}");
for each (n in nodes) {
n.remove();
}
Upvotes: 2