/* update document */
LOG.debug("Found old doc " + oldDoc.getDocId());
// check if the document is locked by another user
final Account lockUser = oldDoc.getUserLock();
if(lockUser != null && !lockUser.equals(broker.getSubject())) {
throw new PermissionDeniedException("The document is locked by user '" + lockUser.getName() + "'.");
}
// do we have write permission on the old document or are we the owner of the old document?
if (!((oldDoc.getPermissions().getOwner().getId() == broker.getSubject().getId()) || (oldDoc.getPermissions().validate(broker.getSubject(), Permission.WRITE)))) {
throw new PermissionDeniedException("A resource with the same name already exists in the target collection '" + path + "', and you do not have write access on that resource.");