prevDoc = doc;
prevCollection = collection;
	public long process()		throws PermissionDeniedException, EXistException {		ArrayList qr = select(docs);		NodeList children = content.getChildNodes();		if (qr == null || children.getLength() == 0)			return 0;		IndexListener listener = new IndexListener(qr);		NodeImpl node;		DocumentImpl doc, prevDoc = null;		int len = children.getLength();		for (Iterator i = qr.iterator(); i.hasNext();) {			node = (NodeImpl) i.next();			doc = (DocumentImpl)node.getOwnerDocument();			doc.setIndexListener(listener);			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");			node.appendChildren(children);			doc.clearIndexListener();			prevDoc = doc;		}		return qr.size();	}