@SuppressWarnings("unchecked")
  @Override
  public void display(HttpServletRequest request, ReportObject reportObject) {

    // get the gene/protein in question from the request
    InterMineObject object = reportObject.getObject();
    // wrapper for the result so we can say what type it is
    HashMap<String, Object> result = new HashMap();

    // API connection
    HttpSession session = request.getSession();
    final InterMineAPI im = SessionMethods.getInterMineAPI(session);
    Model model = im.getModel();
    PathQuery query = new PathQuery(model);

    // dealing with genes...
    if (object instanceof Gene) {
      // cast me Gene
      Gene gene = (Gene) object;
      String geneID = String.valueOf(gene.getId());
      query = geneCommentsQuery(geneID, query);

      Profile profile = SessionMethods.getProfile(session);
      PathQueryExecutor executor = im.getPathQueryExecutor(profile);
      ExportResultsIterator values;
      try {
        values = executor.execute(query);
      } catch (ObjectStoreException e) {
        throw new RuntimeException(e);
      }

      result.put("gene", geneComments2(values));

      // result.put("gene", geneComments(gene));
    } else if (object instanceof Protein) {
      // cast me Protein
      Protein protein = (Protein) object;
      String proteinID = String.valueOf(protein.getId());
      query = proteinCommentsQuery(proteinID, query);

      Profile profile = SessionMethods.getProfile(session);
      PathQueryExecutor executor = im.getPathQueryExecutor(profile);
      ExportResultsIterator values;
      try {
        values = executor.execute(query);
      } catch (ObjectStoreException e) {
        throw new RuntimeException(e);
      }

      result.put("protein", proteinComments2(values));

      // result.put("protein", proteinComments(protein));
    } else {
      // big fat fail
    }

    request.setAttribute("response", result);
  }
  /**
   * @param pt paged table
   * @param request request
   * @return all results of pathquery corresponding specified paged table.
   */
  public ExportResultsIterator getResultRows(PagedTable pt, HttpServletRequest request) {
    PathQuery pathQuery = pt.getWebTable().getPathQuery();
    HttpSession session = request.getSession();
    final InterMineAPI im = SessionMethods.getInterMineAPI(session);
    Profile profile = SessionMethods.getProfile(session);

    executor = im.getPathQueryExecutor(profile);
    executor.setBatchSize(BATCH_SIZE);
    return executor.execute(pathQuery);
  }
  @Override
  public void display(HttpServletRequest request, ReportObject reportObject) {

    // get the gene/protein in question from the request
    InterMineObject object = reportObject.getObject();

    // API connection
    HttpSession session = request.getSession();
    final InterMineAPI im = SessionMethods.getInterMineAPI(session);
    Model model = im.getModel();
    PathQuery query = new PathQuery(model);

    // cast me Gene
    Gene gene = (Gene) object;
    Object genePrimaryIDObj = gene.getPrimaryIdentifier();
    if (genePrimaryIDObj != null) {
      // fetch the expression
      String genePrimaryID = String.valueOf(genePrimaryIDObj);
      query = geneExpressionAtlasQuery(genePrimaryID, query);

      // execute the query
      Profile profile = SessionMethods.getProfile(session);
      PathQueryExecutor executor = im.getPathQueryExecutor(profile);
      ExportResultsIterator values = executor.execute(query);

      // convert to a map
      GeneExpressionAtlasDiseasesExpressions geae =
          new GeneExpressionAtlasDiseasesExpressions(values);

      // attach to results
      request.setAttribute("expressions", geae);
      request.setAttribute("url", "http://www.ebi.ac.uk/gxa/experiment/E-MTAB-62/" + genePrimaryID);
      request.setAttribute("defaultPValue", "1e-4");
      request.setAttribute("defaultTValue", "4");

      // get the corresponding collection
      for (FieldDescriptor fd : reportObject.getClassDescriptor().getAllFieldDescriptors()) {
        if ("atlasExpression".equals(fd.getName()) && fd.isCollection()) {
          // fetch the collection
          Collection<?> collection = null;
          try {
            collection = (Collection<?>) reportObject.getObject().getFieldValue("atlasExpression");
          } catch (IllegalAccessException e) {
            e.printStackTrace();
          }

          List<Class<?>> lc =
              PathQueryResultHelper.queryForTypesInCollection(
                  reportObject.getObject(), "atlasExpression", im.getObjectStore());

          // create an InlineResultsTable
          InlineResultsTable t =
              new InlineResultsTable(
                  collection,
                  fd.getClassDescriptor().getModel(),
                  SessionMethods.getWebConfig(request),
                  im.getClassKeys(),
                  collection.size(),
                  false,
                  lc);

          request.setAttribute("collection", t);
          break;
        }
      }
    }
  }