code: protected CmsLockActionRecord ensureLock(CmsResource resource) throws CmsException {
  
          CmsObject cms = getCmsObject();
          return CmsLockUtil.ensureLock(cms, resource);
      }
docs: Locks the given resource with a temporary, if not already locked by the current user.
  Will throw an exception if the resource could not be locked for the current user.<p>
  
  @param resource the resource to lock
  
  @return the assigned lock
  
  @throws CmsException if the resource could not be locked