I'm using CMIS to make changes to alfresco document, I need to add new aspect to document, but I'm facing:
org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException: Update conflict: 06160811 Cannot perform operation since the node (id:88289ea7-16b7-40ff-938b-b2888ef5bca5) is locked.
Below is the code I'm trying to unlock the document, but it's not successful. kindly suggest other alternatives to unlock a locked document using CMIS
       for (QueryResult result : results) {
            String objectId = result.getPropertyValueByQueryName(PropertyIds.OBJECT_ID);
            AlfrescoDocument document = (AlfrescoDocument) session.getObject(session.createObjectId(objectId));
            if (document != null) {
                if(document.hasAspect("P:cm:lockable")) {
                    System.out.println(document.getName());
                    document.removeAspect("P:cm:lockable");
                }
            } else {
                System.out.println("Document is null");
            }
        }
 
                        
Use LockService.
lockService.unlock("nodeRef of the node to unlock")