コード例 #1
0
  /**
   * Performs the action
   *
   * @param req The http request object
   * @param context The servlet context
   * @return True if the action could be performed
   */
  public boolean performAction(HttpServletRequest req, ServletContext context)
      throws ApplicationException {
    Collection phenotypes = null;
    try {
      MugenCaller caller = (MugenCaller) req.getSession().getAttribute("caller");
      Navigator nav = (Navigator) req.getSession().getAttribute("navigator");

      Collection funcsigs = new ArrayList();

      String type = req.getParameter("_type");
      String message = "";
      if (exists(type)) {
        message =
            "<b>NOTE: Sampling unit filter may be incorrectly adjusted since listing originated from Functional Significance Types view which is <u>Sampling unit independent</u>.</b>";
        funcsigs =
            modelManager.getFunctionalSignificancesForType(
                Integer.parseInt(type), caller, nav.getPageManager());
        nav.getPageManager()
            .setMax(modelManager.getNumberOfSignificancesForType(Integer.parseInt(type), caller));
      } else {
        funcsigs = modelManager.getFunctionalSignificances(caller, nav.getPageManager());
        nav.getPageManager()
            .setMax(modelManager.getNumberOfFunctionalSignificances(caller.getSuid(), caller));
      }

      Collection samplingunits = samplingUnitManager.getSamplingUnits(caller.getPid(), caller);

      req.setAttribute("message", message);
      req.setAttribute("funcsigs", funcsigs);
      req.setAttribute("samplingunits", samplingunits);

      return true;
    } catch (ApplicationException e) {
      throw e;
    } catch (Exception e) {
      e.printStackTrace();
      throw new ApplicationException("Could not retrieve functional significances.");
    }
  }
コード例 #2
0
  /**
   * Performs the action
   *
   * @param request The http request object
   * @param context The servlet context
   * @throws com.arexis.mugen.exceptions.ApplicationException If the action could not be performed
   * @return True if the action could be performed
   */
  public boolean performAction(HttpServletRequest request, ServletContext context)
      throws ApplicationException {
    try {
      HttpSession session = request.getSession();

      MugenCaller caller = (MugenCaller) session.getAttribute("caller");
      Navigator nav = (Navigator) request.getSession().getAttribute("navigator");

      FormDataManager formDataManager =
          getFormDataManager(
              MugenFormDataManagerFactory.U_MARKER_SET_MEMBERSHIP_FILTER,
              MugenFormDataManagerFactory.WEB_FORM,
              request);
      System.out.println(formDataManager.toString());
      int suid = caller.getSuid();
      int sid = caller.getSid();

      Collection umarkersets = genotypeManager.getUMarkerSets(caller, sid);

      String tmpUmsid = formDataManager.getValue("umsid");
      int umsid = 0;

      // If it is the first time we show the page...
      // Choose the first unified marker set
      if (!exists(tmpUmsid)) {
        Iterator i = umarkersets.iterator();
        if (i.hasNext()) {
          UMarkerSetDTO dto = (UMarkerSetDTO) i.next();
          umsid = dto.getUmsid();
        }
      }
      // else, use the requested unified  marker set id
      else {
        umsid = Integer.parseInt(tmpUmsid);
      }

      Collection available = genotypeManager.getUMarkers(caller);
      Collection included =
          genotypeManager.getUMarkerSetPositions(umsid, caller, nav.getPageManager());

      if (umarkersets.size() == 0) {
        available = new ArrayList();
        included = new ArrayList();
      }

      available.removeAll(included);
      request.setAttribute("umarkersets", umarkersets);
      request.setAttribute("available", available);
      request.setAttribute("included", included);
      request.setAttribute(
          "species", samplingUnitManager.getSpeciesForProject(caller.getPid(), caller));
      request.setAttribute("formdata", formDataManager);

      return true;
    } catch (ApplicationException e) {
      throw new ApplicationException(
          "Could not get unified marker set membership information: " + e.getMessage());
    } catch (Exception e) {
      e.printStackTrace();
      throw new ApplicationException("Could not get unified marker set membership information.");
    }
  }