Example #1
0
  private void setGeneticProfiles(HttpServletRequest request) throws DaoException {
    CancerStudy cancerStudy = (CancerStudy) request.getAttribute(CANCER_STUDY);
    GeneticProfile mutProfile = cancerStudy.getMutationProfile();
    if (mutProfile != null) {
      request.setAttribute(MUTATION_PROFILE, mutProfile);
    }

    GeneticProfile cnaProfile = cancerStudy.getCopyNumberAlterationProfile(true);
    if (cnaProfile != null) {
      request.setAttribute(CNA_PROFILE, cnaProfile);
    }
  }
Example #2
0
  private boolean validate(HttpServletRequest request) throws DaoException {
    String cancerStudyID = request.getParameter(ID);
    if (cancerStudyID == null) {
      cancerStudyID = request.getParameter(QueryBuilder.CANCER_STUDY_ID);
    }

    CancerStudy cancerStudy = DaoCancerStudy.getCancerStudyByStableId(cancerStudyID);
    if (cancerStudy == null) {
      try {
        cancerStudy = DaoCancerStudy.getCancerStudyByInternalId(Integer.parseInt(cancerStudyID));
      } catch (NumberFormatException ex) {
      }
    }
    if (cancerStudy == null) {
      request.setAttribute(ERROR, "No such cancer study");
      return false;
    }
    String cancerStudyIdentifier = cancerStudy.getCancerStudyStableId();

    if (accessControl.isAccessibleCancerStudy(cancerStudyIdentifier).size() != 1) {
      request.setAttribute(
          ERROR,
          "You are not authorized to view the cancer study with id: '"
              + cancerStudyIdentifier
              + "'. ");
      return false;
    } else {
      UserDetails ud = accessControl.getUserDetails();
      if (ud != null) {
        logger.info("CancerStudyView.validate: Query initiated by user: "******"_all";
      request.setAttribute(QueryBuilder.CASE_SET_ID, sampleListId);
    }

    SampleList sampleList = daoSampleList.getSampleListByStableId(sampleListId);
    if (sampleList == null) {
      request.setAttribute(ERROR, "Could not find sample list of '" + sampleListId + "'. ");
      return false;
    }

    request.setAttribute(QueryBuilder.CASE_IDS, sampleList.getSampleList());

    request.setAttribute(CANCER_STUDY, cancerStudy);
    request.setAttribute(QueryBuilder.HTML_TITLE, cancerStudy.getName());
    return true;
  }
Example #3
0
  /**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    XDebug xdebug = new XDebug(request);
    request.setAttribute(QueryBuilder.XDEBUG_OBJECT, xdebug);

    try {
      if (validate(request)) {
        setGeneticProfiles(request);
      }

      if (request.getAttribute(ERROR) != null) {
        forwardToErrorPage(request, response, (String) request.getAttribute(ERROR), xdebug);
      } else {
        RequestDispatcher dispatcher =
            getServletContext().getRequestDispatcher("/WEB-INF/jsp/dashboard/dashboard.jsp");
        dispatcher.forward(request, response);
      }

    } catch (DaoException e) {
      xdebug.logMsg(this, "Got Database Exception:  " + e.getMessage());
      forwardToErrorPage(
          request, response, "An error occurred while trying to connect to the database.", xdebug);
    }
  }