Hi,

is it possible to unlock a Node locked by a different session. I don´t know 
exactly which session.

If not, how can i be sure that a node will be unlocked when a functions throws 
an exception. 

I´ve programmed an example of editing an article:

        try {
                node = 
ocm.getSession().getNodeByUUID(docList.get(index).getUuid());
                doc = (JCRDokumentContent) 
ocm.getObjectByUuid(docList.get(index).getUuid());

                doc.setTempContent(false);
                ocm.checkout(doc.getPath());
                ocm.update(doc);
                ocm.save();
                ocm.checkin(doc.getPath());
        }
        catch (ObjectContentManagerException e) {
                logger.error(e.getLocalizedMessage(), e);
        }
        finally {
                if (doc != null && StringUtils.hasText(doc.getPath())) { 
                        JCRUtility.removeExistingLock(doc.getPath(), ocm, 
node.getLock().getLockToken());
                }
        }

JCRUtility.removeExistingLock  - Function:

        if (ocm.objectExists(path)) {
                if (ocm.isLocked(path)) {
                        ocm.unlock(path, lockToken);
                }
        }

Is this a good solution to avoid unresolved locks?

Thanks 
Christian

Reply via email to