if (collection == null) {
LOG.debug("collection " + docUri.removeLastSegment() + " not found!");
return null;
}
if(!collection.getPermissionsNoLock().validate(user, Permission.READ)) {
throw new PermissionDeniedException("Insufficient privileges to read resource");
}
doc = collection.getDocumentWithLock(broker, docUri.lastSegment(), Lock.READ_LOCK);
if (doc == null) {
LOG.debug("document " + docUri + " not found!");
throw new EXistException("document not found");
}
if(!doc.getPermissions().validate(user, Permission.READ))
{throw new PermissionDeniedException("Insufficient privileges to read resource " + docUri);}
final Serializer serializer = broker.getSerializer();
serializer.setProperties(parametri);
final String xml = serializer.serialize(doc);
return xml;