class QueryRegistryTransformer {

    public EbXMLAdhocQueryRequest toEbXML(QueryRegistry request) {
        if (request == null) {
            return null;
        }
        
        Query query = request.getQuery();
        EbXMLAdhocQueryRequest ebXML = createAdhocQueryRequest(query);        
        query.accept(new ToEbXMLVisitor(ebXML));        

        ebXML.setReturnType(request.getReturnType().getCode());

        return ebXML;        
    }

}