if (!collection.getPermissions().validate(user, Permission.UPDATE))
if (!collection.getPermissions().validate(broker.getUser(), Permission.UPDATE))
	public long process() throws PermissionDeniedException, EXistException, XPathException {		NodeImpl qr[] = select(docs);		NodeList children = content.getChildNodes();		if (qr == null || children.getLength() == 0)			return 0;		DocumentImpl doc = null;		Collection collection = null, prevCollection = null;		NodeImpl node;		NodeImpl parent;		IndexListener listener = new IndexListener(qr);		String newName = children.item(0).getNodeValue();		int modificationCount = 0;		for (int i = 0; i < qr.length; i++) {			node = qr[i];			doc = (DocumentImpl) node.getOwnerDocument();			collection = doc.getCollection();			if (prevCollection != null && collection != prevCollection)				doc.getBroker().saveCollection(prevCollection);			if (!collection.getPermissions().validate(user, Permission.UPDATE))				throw new PermissionDeniedException(					"write access to collection denied; user=" + user.getName());			if (!doc.getPermissions().validate(user, Permission.UPDATE))				throw new PermissionDeniedException("permission denied to update document");			doc.setIndexListener(listener);			parent = (NodeImpl)node.getParentNode();			switch(node.getNodeType()) {				case Node.ELEMENT_NODE :					((ElementImpl)node).setNodeName(new QName(newName, "", null));					parent.updateChild(node, node);					modificationCount++;					break;				case Node.ATTRIBUTE_NODE :					((AttrImpl)node).setNodeName(new QName(newName, "", null));					parent.updateChild(node, node);					modificationCount++;					break;				default :					throw new EXistException("unsupported node-type");			}			prevCollection = collection;			doc.clearIndexListener();			doc.setLastModified(System.currentTimeMillis());		}		if (doc != null)			doc.getBroker().saveCollection(collection);		return modificationCount;	}