if (!doc .getCollection() .getPermissions() .validate(user, Permission.UPDATE)) throw new PermissionDeniedException( "write access to collection denied; user=" + user.getName());
	public long process()		throws PermissionDeniedException, EXistException {		ArrayList qr = select(docs);		if(qr == null)			return 0;		IndexListener listener = new IndexListener(qr);		NodeImpl node;		Node parent;		DocumentImpl doc;		for (Iterator i = qr.iterator(); i.hasNext();) {			node = (NodeImpl) i.next();			doc = (DocumentImpl) node.getOwnerDocument();			if (!doc				.getCollection()				.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 to remove document denied");			doc.setIndexListener(listener);			parent = node.getParentNode();			if (parent.getNodeType() != Node.ELEMENT_NODE) {				LOG.warn("cannot remove the root node");			} else				parent.removeChild(node);			doc.clearIndexListener();		}		return qr.size();	}